unsigned int anaInDriver(unsigned int cmd, unsigned int len);

Reads the voltage of an analog input channel by serial-clocking an 8-bit command to the A/D converter by its Direct Mode method. This function assumes that Mode1 (most significant byte first) and the A/D converter oscillator have been enabled. See anaInConfig() for the setup.

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. D7—1; D6–D4—Gain Code; D3–D0—Channel Code

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

Single-Ended

4–20 mA

Lines

Input Lines*

Lines

0

+AIN0 -AIN1

 

8

 

AIN0

AIN0*

 

 

 

 

 

 

 

1

+AIN2 -AIN3

 

9

 

AIN1

AIN1*

 

 

 

 

 

 

 

2

+AIN4 -AIN5

 

10

 

AIN2

AIN2*

 

 

 

 

 

 

 

3

+AIN6 -AIN7

 

11

 

AIN3

AIN3

4

-AIN0 +AIN1

 

12

 

AIN4

AIN4

 

 

 

 

 

 

 

5

-AIN2 +AIN3

 

13

 

AIN5

AIN5

 

 

 

 

 

 

 

6

-AIN4 +AIN5

 

14

 

AIN6

AIN6

 

 

 

 

 

 

 

7

-AIN6 +AIN7

 

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 11-bit conversions

User’s Manual

49

Page 55
Image 55
Digi RCM4000 user manual Unsigned int anaInDriverunsigned int cmd, unsigned int len, Gain Code Multiplier