Rockwell Automation 61C613 16 Channel Analog Input Module User Manual

Page 24

Advertising
background image

4Ć8

16130

ąIF BIT_SET@(STATUS%,0) THEN GOTO 16200

16140

NEXT I%

16150

ERR_CODE% = Ć1

\! Retry Error

16160

RETURN

16197

REM

16198

REM

Read error code

16199

REM

16200

ERR_CODE% = IOREAD%( 1, M!)

16220

RETURN

4.3.2

Reading Data with the DCS 5000/AutoMax

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

read data converted in the continuous mode from the module. This

subroutine uses the subroutine in section 4.3.1 to send the read

command to the module.

14989

REM

14990

REM

Read channel data from 61C613 module

14991

REM

14992

REM Inputs:

14993

REM

ąM!

= hex address

14994

REM

ąOPCODE%

= instruction

14995

REM

ąCHANNEL

_NO% = channel number

14996

REM

14997

REM

Output:

14998

REM

ąVALUE%

= value received from the channel

14999

REM

15000

OPCODE%=24 \ LS_BYTE% =CHANNEL_NO% \ MS_BYTE%=0 \ GOSUB
16000

15010

IF ERR_CODE% <> 0 THEN STOP

15047

REM

15048

REM

Read channel value

15049

REM

15050

LS_BYTE% = IOREAD%( 1, M!+1) \ MS_BYTE% = IOREAD%( 1, M!+2)

15060

VALUE% = SHIFTL%( MS_BYTE%, 8)+(LS_BYTE% AND 00FFH)

15070

RETURN

Advertising