Dear board Im writing a driver for HX711 load cell pickup unit.
This has a clock pin which is input to hx711 ic and this clk will be driven by stm32f103 And a Dout pin where for every low to high transition hx711 will out a bit and this goes 24 bit long..
I need to read this serial input and store to a byte which is 24 bit data where i can use array of 3 bytes..
I can easily read input status low or high from input function.
But how can i assign that bit value to a byte at particular position??
Earlier in pic micro.. i have function called bit_set and bit_clear to set or clear particular bit in a byte...
I googled and found there are no code fullfilling my requirements.
Can anyone suggest me please?? I need to read pin and save 24 bit info and convert to decimal.
Thanks
you dont need bit test or set or clear to get your 24 bits collected. there is a more advanced technique. learn from my code.
int BLOCK_OF_24_BITS; int INDEX; BLOCK_OF_24_BITS = 0; for ( INDEX=0 ; INDEX < 24 ; INDEX += 1 ) { BLOCK_OF_24_BITS = BLOCK_OF_24_BITS << 1; if ( GET_SINGLE_BIT() == 1 ) { BLOCK_OF_24_BITS = BLOCK_OF_24_BITS + 1; } } /* Now VAR_OF_24_BITS has your collected data */