beautypg.com

ProSoft Technology MVI56-BAS User Manual

Page 103

background image

MVI56-BAS ♦ ControlLogix Platform

Using DH-485 Communications

BASIC Module (DB/BAS Compatible)

User Manual

ProSoft Technology, Inc.

Page 103 of 234

December 13, 2011

The following is an example application where the data is transferred from the

RAM memory to the Output Buffer and from there to the Common Interface File

using CALL 85. After the data has been moved to the CIF it can be read by other

nodes at the DH-485 network:

The following is example code for BASIC CALL 85:

1 REM SAMPLE PROGRAM FOR BASIC CALL 93
10 FOR I=0 TO 19
20 K=200-I
30 PUSH K: REM VALUE TO BE TRANSFERRED
40 PUSH I: REM OUTPUT BUFFER ADDRESS
50 CALL 24
60 NEXT I
70 PUSH 0: REM STARTING OFFSET ADDRESS IN CIF
80 PUSH 10: REM NUMBER OF WORDS TO BE TRANSFERRED
90 CALL 85
100 POP S
110 PRINT "ERROR CODE = ",S

The following shows an example application where data is written from a remote

DH-485 node to the MVI56-BAS Common Interface File. The BASIC program

can transfer the contents of the CIF to the Input Buffer using CALL 84 and then

retrieve the data using CALL 14 or 15

The following shows example code for BASIC CALL 84:

10 REM EXAMPLE APPLICATION FOR CALL 84
20 PUSH 0: REM OFFSET IN CIF FILE
30 PUSH 0: REM NUMBER OF ELEMENTS TO BE TRANSFERRED
40 CALL 84
50 POP E: REM CALL STATUS
60 IF E<>0 THEN GOTO 140 ELSE GOTO 110
70 FOR I=0 TO 19
80 PUSH I: REM THE ADDRESS NUMBER AT THE INPUT BUFFER
90 CALL 14: