unsigned int anaInDriver(unsigned int cmd, unsigned int len);
Reads the voltage of an analog input channel by
The conversion begins immediately after the last data bit has been transferred. An exception error will occur if Direct Mode bit D7 is not set.
PARAMETERS
cmd contains a gain code and a channel code as follows.
Use the following calculation and the tables below to determine cmd:
cmd = 0x80 (gain_code*16) + channel_code
|
| Gain Code | Multiplier |
|
| ||
|
| 0 |
| ×1 |
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
| ×2 |
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
| ×4 |
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
| ×5 |
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
| ×8 |
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
| ×10 |
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
| ×16 |
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
| ×20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Channel Code | Differential Input | Channel Code | |||||
Lines | Input Lines* | Lines | |||||
0 | +AIN0 |
| 8 |
| AIN0 | AIN0* | |
|
|
|
|
|
|
| |
1 | +AIN2 |
| 9 |
| AIN1 | AIN1* | |
|
|
|
|
|
|
| |
2 | +AIN4 |
| 10 |
| AIN2 | AIN2* | |
|
|
|
|
|
|
| |
3† | +AIN6 |
| 11 |
| AIN3 | AIN3 | |
4 |
| 12 |
| AIN4 | AIN4 | ||
|
|
|
|
|
|
| |
5 |
| 13 |
| AIN5 | AIN5 | ||
|
|
|
|
|
|
| |
6 |
| 14 |
| AIN6 | AIN6 | ||
|
|
|
|
|
|
| |
7‡ |
| 15 |
| AIN7 | AIN7* |
* Negative input is ground.
†Not accessible on Prototyping Board
‡ Not accessible on Prototyping Board
len, the output bit length, is always 12 for
User’s Manual | 49 |