LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Specifying starting byte of byte string

Solved!
Go to solution

Hello dear community,

 

I am looking for a way to start reading a continuous serial string in specified increments at string specific positions. I will explain:

 

The whole idea is using an Arduino board to read the analog values of 16 photodiodes and send their data in ascii format to my computer. Values of the analog pins are in the range of 10 bits, so there are 2 bytes information neccessary per photodiode. Now I need to assign the right 2 bytes in this continuous string to the corresponding photodiode. So before the board starts reading all diodes, I programmed it to send 2 bytes (lets say 'xx') as starting indicator, resulting in 2 bytes ('xx', starting indicator) + 16*2 bytes (=photodiodes' data) = 34 bytes increments.

 

My plan now is to implement a routine, that reads 34 bytes, finds the 'xx' sequence and extracts the position (lets call the position number 'y') of the first 'x'. Now the programm reads y bytes. And now the programm again reads 34 bytes in a continuous cycle, every cycle starting with 'xx'.

 

How do I realize this?

 

I added the scheme I am working at: The structure in question is positioned in the first time frame. [Note, that so far, this programm only reads the second 2 bytes (=first photodiode).] The first VISA Read structure needs to find the position of 'xx' and send it to the second VISA Read structure, which forwards us to the start of the next full increment.

 

 

Best regards,

Friedrich G. Froebel

0 Kudos
Message 1 of 3
(2,779 Views)
Solution
Accepted by topic author Frieder713

Hi Friedrich,

 

I made some changes along with a suggestion on how to parse your data...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 3
(2,769 Views)

Hey Gerd!

 

Thank you so much for that fast reply! I could not use your programm, but it showed me how to do it the way I want it.

 

Again, thank you.

Friedrich

0 Kudos
Message 3 of 3
(2,742 Views)