Quantcast
Channel: LabVIEW topics
Viewing all articles
Browse latest Browse all 66852

Specifying starting byte of byte string

$
0
0

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


Viewing all articles
Browse latest Browse all 66852

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>