DASYLab

cancel
Showing results for 
Search instead for 
Did you mean: 

Checksum DasyLab

Hello there!

I use DasyLab to acquire process value data from a process controller via the RS232 Input module (this works fine, since the checksum of the request command is always the same).

Another thing I want to do is to write set point values to the controller via the rs232 output module. Sending the command via the rs232 monitor of the input module works fine when using a checksum calculated by hand.

The command for setting a new process value is (ASCII characters):

$ 01 01 W 09 \r

So starting character is the $, device id is the first 01, zone ID is the second 01, W is the command code for write an 09 indicates the setpoint.
is a 6 charated block using only numbers 0-9 and . for decimal seperation (e.g.: 10.123).

I want to connect a input with the desired setpoint to the rs232 output module. I think the output format must be written as follows:

$0101W09[az4.1]\cq\r

Is this correct for cq checksums?

Unfortunately I dont know how the checksum algorithmen is called that is required by the controller communication protocoll, but I can describe the algorithm:

1. sum up all decimal values representing all ASCII of the command except the starting character, the carriage return and the checksum itself. For the above mentioned example this is: 01 01 W 09 10.123 --> 48+49+48+49+87+48+57+49+48+46+49+50+51 = 679
2. calculate MOD256 of the sum from point 1 --> 167
3. represent this numer by a two character code whre: The values of 0-9 have the values as their decimal counterparts and the letters A-Z have the values of 100-300 inclusively in increments of 10.
so 00 means 0, 99 means 99, A0 means 100, A2 means 102, B8 means 118 and P5 means 255

For the example the checksum is G7 (=167). What is this algorithm called? Or is it a custom manufacturer algorithm?

How can I automate this calculation process, because when using different set points, the checksum will be different as well...

Additional information:
The Used controller is a Omega CN8200 series controller with rs485 comunication. I use a converter to transform rs485 protocoll to rs232.

Please forgive me for typos and horrible english, since I'm no native speaker.

Thanks so far,
Sebastian
0 Kudos
Message 1 of 2
(7,141 Views)
All right mates, I solved the problem maybe not in the best way, but it's sufficient for me: I do not need to set decimal values on the controller setpoint. Integer values incrementing by values of 1 are enough. Value range was from 1 to 150, so 149 values. For these values I generated a list of the correct commands including the checksum (done with Mathematica). Looks like this (save as *.ini file):

[Global Strings]
P1=
1=0101W09001.00G1
2=0101W09002.00G2
3=0101W09003.00G3
4=0101W09004.00G4
5=0101W09005.00G5
6=0101W09006.00G6
...

Now we come to DasyLab. I simply connected my setpoint value to a round function and afterwards I stored the rounded value on a global variable. An action modul consisting of two channels is set up as well. Channel one is triggered when the value of the global variable changes and causes a action to read a string from my generated *.ini file. The Parameter for this channel is the global variable. The second channel is triggered by the changing global variable as well, but causes the RS232 output module to send the desired command.
Output module was configured to send only single commands with deactivated checkbox (no control input).
Format is

$[a]\r

Perhaps this will help someone when meeting comparable problems. I'm still looking forward to a better solution (e.g. continuously checksum calculation via custom rules [no \cq or \cc...] and command generation in DasyLab).

Greetings,
Sebastian
0 Kudos
Message 2 of 2
(7,128 Views)