02-28-2014 10:10 AM
Hello.
I have some sensors connected to a serial port and each minute I have a burst of 216 bytes coming in and then wait for the next burst.
The data have a specific format and I want to parse them and create a *.csv file.
I am having problems understanding some things for the VISA drivers and some things about the continuous parsing.
Attached is my simplified vi.
So, here are my questions:
1. What does the timeout in the wait for event function do? I put it 100 randomly. What happens if the timeout occurs while the data are coming in?
2. How does the read function knows when to give me the string? When I place an indicator in the count, I read 216, why does it not wait for 300, which is the number I have in there?
3. Since every minute I have 216 bytes, how will the parsing mechanism know that it is time to start/stop parsing?
4. How can I divide the string into smaller sub strings? Should I do it by using a lot of search/split strings lineary? How can I store it?
5. After the parsing of a string, how can I store it in an array of strings and store the next string in the next index of the array?
I know it's too much but can you point me to an example or a tutorial?
Thanks a lot,
Vasileis.
02-28-2014 10:20 AM
Does your device send a Termination Char?
02-28-2014 10:26 AM
It does send CR LF 3 times in the 216 bytes.
02-28-2014 10:30 AM - edited 02-28-2014 10:30 AM
I just posted a solution that could work in your case
Take a look at it
02-28-2014 10:55 AM
@vakost wrote:
Hello.
I have some sensors connected to a serial port and each minute I have a burst of 216 bytes coming in and then wait for the next burst.
The data have a specific format and I want to parse them and create a *.csv file.
I am having problems understanding some things for the VISA drivers and some things about the continuous parsing.
Attached is my simplified vi.
So, here are my questions:
1. What does the timeout in the wait for event function do? I put it 100 randomly. What happens if the timeout occurs while the data are coming in? The event will throw a time out error and VISA Read will not atempt to read any thing
2. How does the read function knows when to give me the string? When I place an indicator in the count, I read 216, why does it not wait for 300, which is the number I have in there? 216 I think is the bytes that it read in not the time it waited. The VISA event will only wait until the VERY first byte shows up at the port That could only be 1 sec. As soon as that ONE byte shows up it passes on to your READ.
3. Since every minute I have 216 bytes, how will the parsing mechanism know that it is time to start/stop parsing? Use the Termation Char setting
4. How can I divide the string into smaller sub strings? Should I do it by using a lot of search/split strings lineary? How can I store it? Use the Termation Char setting
5. After the parsing of a string, how can I store it in an array of strings and store the next string in the next index of the array? Build Array function.
I know it's too much but can you point me to an example or a tutorial?
Thanks a lot,
Vasileis.
02-28-2014 12:03 PM
I just noticed you had the Enable Termination Char set to FALSE.
Be sure to Enable Termination Char in the example that I posted above.
03-04-2014 01:19 AM
Hello Omar. I will test your solutions today and let you know.
Thanks for your help so far.
Vasilis.