Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
09/25/06 11:00
Read: times


 
#124983 - long int
Responding to: ???'s previous message
Rao Np said:
Hello

I am using 24bit adc interfacted to AT89s52. i am reading the output in 8bit formate i.e (low byte, mid byte, high byte) i want to integrate all the value into a integer value.i am using keil software.

low byte=33h
mid byte =04h
high byte =02h
i want to make the value as (value=020433h)

how can do this using c

An int is usually a 16 bit value (on the 8052 C compilers) so you really need to use a long int assumimg your compiler supports it e.g.

long adc;

adc = (high << 16) + (mid << 8) + low;

You may need to cast each element to keep your compiler happy.

Ian



List of 4 messages in thread
TopicAuthorDate
integer value            01/01/70 00:00      
   long int            01/01/70 00:00      
   This sounds familiar...            01/01/70 00:00      
      interestingly not a warning or an error            01/01/70 00:00      

Back to Subject List