Digi RCM4000 User Manual

Page 55

Advertising
background image

User’s Manual

49

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

len

, the output bit length, is always 12 for 11-bit conversions

unsigned int anaInDriver(unsigned int cmd,

unsigned int len);

Gain Code

Multiplier

0

Ч1

1

Ч2

2

Ч4

3

Ч5

4

Ч8

5

Ч10

6

Ч16

7

Ч20

Channel Code

Differential Input

Lines

Channel Code

Single-Ended

Input Lines

*

* Negative input is ground.

4–20 mA

Lines

0

+AIN0 -AIN1

8

AIN0

AIN0*

1

+AIN2 -AIN3

9

AIN1

AIN1*

2

+AIN4 -AIN5

10

AIN2

AIN2*

3

† Not accessible on Prototyping Board

+AIN6 -AIN7

11

AIN3

AIN3

4

-AIN0 +AIN1

12

AIN4

AIN4

5

-AIN2 +AIN3

13

AIN5

AIN5

6

-AIN4 +AIN5

14

AIN6

AIN6

7

‡ Not accessible on Prototyping Board

-AIN6 +AIN7

15

AIN7

AIN7*

Advertising