Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

How to process the continuous serial data (Serial data frame time is 250ms)

Hi,

 

I need a help to "process the serial Hex data" serial data rate is 250ms.

I am able to read the serial data and right now, we have the Concatenated Hex string but not able to Spit this string the modify and write again.

Each 250ms i get new data frame,data frame length is 1st frame 13bytes, 2nd frame 17bytes and  3rd frame 17bytes * no of module.We are develope the application to change the perticular bytes of each frame and send it again.

Mach pattern,Replace pattern all string find and replace fundamental tried not working.

 

Please help.

0 Kudos
Message 1 of 8
(5,255 Views)

Where is the data coming from?  Is there anything in the frame to indicate what the frame is?  Is there a start character (often 0x2)?  Is there a checksum to make sure you read the frame right?



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 8
(5,237 Views)

Hi,

Yes,each frame having multiple CRC and Total frame also having stating and end frames and each frame having the start & end bytes.Please look into the attached Description.

0 Kudos
Message 3 of 8
(5,217 Views)

The way I see it, we first need to synch up to the 7F18.  Once you find the 7F18, you know how many characters are in a line and you know how many lines are to follow.  So you can just read that number of bytes once you get synched up.  You could do the synching in a simple loop that just reads 1 byte at a time.  Compare the previous byte and the current byte to 7F18.  Once you have a match, read 11 more bytes to complete that line.  If you want to make sure, you should also perform the CRC check in that line.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 8
(5,198 Views)

Hi,

Thanks for your valuable suggestion but we are tried all possible scanrios with "Match & Replace string" Or "Replace string" Or "Split String" but data from serial port is so fast replace,match loop is not able to execute.Output of all is showing blank.We get the 1 frame of 250ms,in that 1st  subframe 7F18 to 7F22 then no. of 7F22 to 7F22 subframe and last frame is 7F20.Please find the attached different  VI.

0 Kudos
Message 5 of 8
(5,183 Views)

I immediately see 2 really big issues.

1. Since you are dealing with binary data, turn the Termination Character off.  There is a boolean input on the Configure Serial Port to do so.  It is on by default.

2. Your VI is running slow because you have a constantly growing string.  Once you find a frame, remove it from the string that you are storing in the shift register.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 8
(5,171 Views)

Hi,

Would you please make the chnages and share to me?

0 Kudos
Message 7 of 8
(5,167 Views)

I thought about this way too much...

 

This should get you started for getting the frame itself.  I have not tested it at all.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 8 of 8
(5,159 Views)