where we are reading a 16 bit Hex number as two 8 bit Hex MSB and LSB, and we are returning these values as "Unsigned Char".
we want to concatenate these MSB and LSB "char" values, and finally we need one "Integer" value for our further processing.
for example: the following 2 methods are returning one "Unsigned Char" value, each
Expand|Select|Wrap|Line Numbers
- unsigned char i2c_readAck(void)
- {
- TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWEA);
- while(!(TWCR & (1<<TWINT)));
- return TWDR;
- }/* i2c_readAck */
- unsigned char i2c_readNak(void)
- {
- TWCR = (1<<TWINT) | (1<<TWEN);
- while(!(TWCR & (1<<TWINT)));
- return TWDR;
- }/* i2c_readNak */
we have to fetch MSB and LSB values from these 2 methods who are actual HEX values needed,
but in unsigned char type, concatenate it, and the finally the concatenated value must be converted to usable Integer format,
we are finding the the conversation part very tricky,
can anyone help us??