From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

DASYLab

cancel
Showing results for 
Search instead for 
Did you mean: 

RS232 Output Module - Checksum on part of String

Solved!
Go to solution

I am running DASYLab 11 and am trying to write a setpoint to a Eurotherm temperature controller via the EI-BISYNCH protocol over RS-232. This requires that I send some control characters and the address of the unit I am commanding, then the some control characters and the new setpoint value, and then an XOR checksum of the second part of the string (control characters + new setpoint). I can't seem to figure out a way to do this, as the /cx format command gives the checksum of the entire string. I tried placing the first part of the string in channel one, the second part and the checksum formatter in channel two, and then selecting sequential output, but that didn't work. Does anyone have any other ideas?

 

Thanks for your time!!!

0 Kudos
Message 1 of 11
(7,036 Views)

maffos,

 

Have you checked the documentation for your device for other possible commands that it would accept? Something that would more clearly split the two messages?

KyleP
Applications Engineer
National Instruments
0 Kudos
Message 2 of 11
(7,027 Views)

I have checked the documentation and all commands require the same checksum format.

 


 

0 Kudos
Message 3 of 11
(7,015 Views)

You will need two different strings... what are your strings? 

I do have a very happy customer using Eurotherm controllers... but he uses OPC, not RS232.

 

the help says this:

 

ChecksumControl CharactersDescription
Cross sum \cq Adds all bytes before the checksum character including the contained measurement values and sends the cross sum with the string.
If the format definition contains a \c control character, DASYLab makes the cross sum from the beginning of the string to the position of the control character. If the format definition contains several \c characters, DASYLab makes the subsequent cross sums from one checksum character to the next.
CRC test \cc Calculates all bytes of the string to be sent with the CRC16 method. DASYLab sends the binary sequence of the CRC test and the binary sequence of the CRC test including the CRC value as the result. The sent binary sequence are not numbers but polynomials.
XOR sum \cx Connects all bytes before the checksum character including the contained measurement values with the exclusive-or operator and sends the binary sequence with the character string.
XOR sum with control character suppression \cy Executes the same operation as the XOR sum and adds 32 to the result byte if the result byte is smaller than 32.
Measurement Computing (MCC) has free technical support. Visit www.mccdaq.com and click on the "Support" tab for all support options, including DASYLab.
0 Kudos
Message 4 of 11
(7,013 Views)

CJ...

 

The controller accepts a command of the format:

 

[EOT]0011[STX]SL22.0[ETX]{BCC}

 

where 0011 is the address of the controller, SL22.0 is the command I am sending, and {BCC} is the block checksum of "SL22.0"[ETX]". What I am confused on is how to perform the block checksum on only that portion of the string.

0 Kudos
Message 5 of 11
(7,011 Views)

clarification: when I said block checksum, I meant to specify that it was the XOR checksum!

0 Kudos
Message 6 of 11
(7,010 Views)

So...

 

 

\x040011\x02SL22.0\x03<checksum>

 

is what you want, where <checksum> is the XOR checksum of SL22.0\x03? 

 

do you have a fixed list of setpoints, or is it variable? 

 

\x040011\x02SL[a4.1]\x03<checksum>

Measurement Computing (MCC) has free technical support. Visit www.mccdaq.com and click on the "Support" tab for all support options, including DASYLab.
0 Kudos
Message 7 of 11
(7,004 Views)
Solution
Accepted by topic author maffos

What happens if you do it this way? 

 

Setup RS232 Output with 2 channels. 

 

Channel 0 is this... the input is from a Read Global variable module that has the unit number (11). 

 

ScreenShot360.jpg

 

Channel 1 is this - it would come from a slider or other input.

 

ScreenShot361.jpg

 

When I look at my serial port monitor, I get this.... hex on the left, ascii on the right.... 

 

ScreenShot362.jpg             ScreenShot363.jpg

Measurement Computing (MCC) has free technical support. Visit www.mccdaq.com and click on the "Support" tab for all support options, including DASYLab.
Message 8 of 11
(7,003 Views)

Thanks, CJ - I am trying to send the output of a sequence generator to the controller, so your solution with two channels is the way to go. i tried something similar but I don't think I had the strings configured properly. (Now that I've seen your example I know that!) I will try it and see how it works!

0 Kudos
Message 9 of 11
(7,000 Views)

I did have to scratch my head to ensure that the Ch0 string went before the Ch1 string... by making the unit number a variable, it seemed to work better. 

Measurement Computing (MCC) has free technical support. Visit www.mccdaq.com and click on the "Support" tab for all support options, including DASYLab.
0 Kudos
Message 10 of 11
(6,998 Views)