Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

MODBUS P222 comand on CR1000


kyle Aug 11, 2017 05:03 AM

I am trying to convert a CR10X program using the Loggernet transformer utility.

When i try, this part ot the program

run modbus command

 243: If time is (P92)
 1: 0 Minutes (Seconds --) into a
 2: 1 Interval (same units as above)
 3: 22 Set Flag 2 Low

 244: ModBus Initiate Telecom (Special) (P222)
 1: 0153 Calling Mode
 2: 2 Flag 2
 3: 2 Modbus Address
 4: 0 Number of Retries
 5: 167 Result Code Loc [ MODBUS_RE ]
 6: 2 Command
 7: 9 Swath
 8: 158 Local Loc [ MODBUS_1 ]
 9: 1 Remote Loc

245: End (P95)

becomes

' run modbus command
If TimeInToInterval(0,1,Min) Then Flag(2) = False
'P222
EndSub

is there an equivilent command for the CR1000??


aps Aug 11, 2017 07:45 AM

The command was essentially split in two and a lot of extra functions have now been added to it was not so easy  to convert.   Have a look at the Modbusclient and Modbusmaster commands in the CRBasic one of which will do what you want.


kyle Aug 14, 2017 02:24 AM

Hi Andrew thanks for your reply.

I beleive i have made some progress

I was having difficulty working out how to transfer the data table i had created for the data i wanted transferred but i was shown how to create an array

' MODBUS send channels
Public MODBUS(9)

MODBUS(1) = WS_10_cms
MODBUS(2) = WD_10min
MODBUS(3) = TAir_10th
MODBUS(4) = RH_10th
MODBUS(5) = SR_W_m2
MODBUS(6) = BP_hPa
MODBUS(7) = Rain_10th
MODBUS(8) = KZ_Day
MODBUS(9) = LiveRain10th

and to send the data from there using

SlowSequence

Scan 1,min,0,0

ModbusMaster (MODBUS_RE,Com2,9600,2,16,MODBUS(),1,9,1,100,1)

NextScan

EndSequence

but i now have the issue that the MODBUS data being sent is twice as many bytes as i am expecting.

The CR10X logger was sending 9 locations of 2 bytes each so 18 bytes total

MODBUS data from the CR10X

002 016 000 000 000 009 018 000 000 000 000 078 094 000 000 000 000 027 087 000 000 000 000 000 000 143 205

 

i.e:

address [002]

               function [016]

               Start address [000 000]

               Number registers [000 009]

               Byte count [018]

               Data [ ……]

               Checksum [143 205]

The CR1000 looks like it is sending 18 locations of 2 bytes each so 36 total

MODBUS data from the CR1000

002 016 000 000 000 018 036 000 000 000 000 000 000 000 000 000 000 255 192 000 000 255 192 000 000 255 192 000 000 255 192 000 000 000 000 051 069 065 019 000 000 000 000 134 122

 

i.e.:

               address [002]

               function [016]

               Start address [000 000]

               Number registers [000 018]

               Byte count [036]

               Data [……]

               Checksum [134 122]

 

is there a way to replicate the output of the CR10X on the CR1000??

Many thanks

Kyle

Log in or register to post/reply in the forum.