I am using a 16F872 10 bit ADC. I am storing the 10 bit number into a 16 bit register. How do I break the 16 bit number into 2 8 bit numbers so I can individually manipulate each byte?
Thanks in advance
Michael
___________________________
This message was ported from CCS's old forum
Original Post ID: 958
Justin Dobbs Guest
Re: How to I convert a 16 bit number to two 8 bit?
:=I am using a 16F872 10 bit ADC. I am storing the 10 bit number into a 16 bit register. How do I break the 16 bit number into 2 8 bit numbers so I can individually manipulate each byte?
___________________________
This message was ported from CCS's old forum
Original Post ID: 963
Tomi Guest
Re: How to I convert a 16 bit number to two 8 bit?
Posted: Tue Nov 06, 2001 3:01 am
Without arithmetics you can use the #byte directive:
int16 value;
#byte valueL = value
#byte valueH = value+1
Usage (example):
putchar(valueL); // send over RS232
putchar(valueH);
:=I am using a 16F872 10 bit ADC. I am storing the 10 bit number into a 16 bit register. How do I break the 16 bit number into 2 8 bit numbers so I can individually manipulate each byte?
:=
:=Thanks in advance
:=
:=Michael
___________________________
This message was ported from CCS's old forum
Original Post ID: 967
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum