kingneb
Newbie level 3
- Joined
- Sep 7, 2010
- Messages
- 3
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,306
Hello,
I am using C on an ARM processor and am attempting to properly read parallel data off of a TI ADS7824 analog to digital converter. I would use serial but the application calls for parallel. Anyway, if you look at the datasheet,
https://www.ti.com/lit/ds/symlink/ads7824.pdf
you will see that, according to the state of the byte input, either the first four bits or the remaining eight are placed on the output pins. That data to my knowledge is signed, since the unit accepts +/- 10 volts on its analog inputs. How do you join, using C variables, the contents of a signed 12-bit quantity (in this case four and eight bits), broken into two parts? It is easy with unsigned data. I just do this:
I am using C on an ARM processor and am attempting to properly read parallel data off of a TI ADS7824 analog to digital converter. I would use serial but the application calls for parallel. Anyway, if you look at the datasheet,
https://www.ti.com/lit/ds/symlink/ads7824.pdf
you will see that, according to the state of the byte input, either the first four bits or the remaining eight are placed on the output pins. That data to my knowledge is signed, since the unit accepts +/- 10 volts on its analog inputs. How do you join, using C variables, the contents of a signed 12-bit quantity (in this case four and eight bits), broken into two parts? It is easy with unsigned data. I just do this:
Code:
short byteA = 0x00;
short byteB = 0x00;
byteB <<= 4
byteA |= ByteB