3 programming examples, 9 read analog input on demand – Rockwell Automation 61C613 16 Channel Analog Input Module User Manual

Page 23

Advertising
background image

4Ć7

The data returned is a signed integer. Location (M+1) is the least

significant byte, and location (M+2) is the most significant byte.

Depending upon how the channel was configured and the

temperature readĆout units selected (refer to section 4.2.2), the units

are either millivolts, degrees C, or degrees F.

4.2.9

Read Analog Input on Demand

The command to convert and read an analog input value on demand

will require between 45Ć110 milliĆseconds to execute, depending on

how the channel was configured. The command contains the

following information:

Location (M+0)

25

Location (M+1)

channel number

Location (M+2)

0

Valid channel numbers range from 0 to 15, corresponding to channel

numbers 0Ć15.
The data returned is a signed integer. Location (M+1) is the least

significant byte. Location (M+2) is the most significant byte. The units

are either millivolts, degrees C, or degrees F, depending on how the

channel was configured and the temperature readĆout units selected.

The units will also include any slope and offset specified for the

channel.

4.3

Programming Examples

This section describes some simple programming examples for the

61C613, using write commands and read commands.

4.3.1

Writing Commands with the DCS 5000/AutoMax

The following example is a DCS/AutoMax BASIC subroutine that will

write a command to the module. This subroutine is written under the

assumption that the command can be executed in a maximum of 33

milliĆseconds.

15981

REM

15982

REM

Write Commands to A/D

15983

REM

15984

REM

Inputs:

15985

REM

ąM!

= hex address of module (02X0000H), X = slot

15986

REM

ąOPCODE%

= byte value written to (M+0)

15987

REM

ąLS_BYTE%

= byte value written to (M+1)

15988

REM

ąMS_BYTE% = byte value written to (M+2)

15989

REM

15990

REM

Output:

15991

REM

ąERR_CODE% = 0 if normal; nonĆzero if error

15992

REM

15999

REM

16000

IOWRITE( 1, OPCODE%, M!+0)

16010

IOWRITE( 1, LS_BYTE%, M!+1)

16020

IOWRITE( 1, MS_BYTE%, M!+2)

16100

FOR I% = 1 TO 3

16110

ąDELAY 2 TICKS

16120

ąSTATUS% = IOREAD%( 1, M!+3)

Advertising