beautypg.com

Basic programming guide – Remote Processing BASIC for the CX-10 Modbus User Manual

Page 52

background image

BASIC PROGRAMMING GUIDE

2-43

PRINT #n,ID,16,start register,length,data,data,data...
Where: n = modbus port number on board. This is usually 1 or 3 or both. Refer to your board manual.

Id = modbus ID of device you want to get data from
start register =is start of modbus address you want to write to
length = number of registers you will write to
data = number information (integer or float, as appropriate to register) you wish to write.
Number of data elements must be the same as length and must all be included in the same line.

EXAMPLE

100

STRING 200,20 : $(0)="String" : B=PI*5

110

PRINT $(0),B,REGREAD(2)*.00215

>run

String 15.707963

0

For modbus read (query)

rem send out id, function number, address, length
70 print #3,id,fn,ad,le

For modbus write

rem print syntax is id, function, start register, length, data, ..

10

PRINT #3,11,16,4501,3,1,2,3