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 Input Module Configuration

Hello,

 

I want to decode a message from a blackbox but i don't know how to configure my RS232 Input module.

 

I copy the supplier informations about this message :

Channel Number8
Total Length6 bytes

ChannelData1Data2Data3Data4Checksum

Lateral = Data1 And 0x7F + Data2 / 0x100
If (Data1 And 0x80)=0 Then Lateral = -Lateral

Longitudinal = Data3 And &H7F + Data4 / 0x100
If (Data3 And &H80)=0 Then Longitudinal = -Longitudinal

 

At the end i want to read Lateral and Longitudinal informations.

 

Can someone help me ?

 

Thanks a lot

 

Hugus

 

0 Kudos
Message 1 of 3
(6,316 Views)

If one of the standard rS232 formats will not work, then read the 6 bytes as six channels, where the data format for each channel is b.

 

then, you can use the Bit arithmetic and bit mask modules, in combination with the Formula to do the math.

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 2 of 3
(6,315 Views)

Hello,

 

Thanks CJ !

 

My problem is that i have near 20 different messages, and the Message ID is written in the first Byte

So I have to read a Byte, compare it to my Message ID and after take x Bytes (not the same for all messages), verify the checksum to validate the message and then do my calcul on y bytes. Abd this for all my messages.

In ascii, i can configure the module to skip or find a special character but in Byte mode, no !

I test to read the bytes with my RS232 input module but how can i scan byte/byte to search my Message ID ?

 

Thanks to help me

 

Good day

 

Hugus

0 Kudos
Message 3 of 3
(6,259 Views)