06-24-2019 05:30 AM
Hi,
I'm new to LabVIEW and trying to use the serial port to search for header data to synchronise with.
I can't get the program to run without an overrun error.
Any ideas? The program should run through three states, wait for header, size and receive data.
Many thanks.
Solved! Go to Solution.
06-24-2019 07:27 AM
I haven't managed to get 2019 installed yet. Could you please do a File->Save For Previous? I do have 2018 installed, but 2016 in currently my preferred version (due to the programs I am working).
06-24-2019 07:48 AM
Wow -- you really need to learn some LabVIEW! Here are some important things to learn and fix:
Here's what you want to do:
You should not need a Queue for any of this. You don't appear to have any understanding of how Queues work and when you should use them. Learn Basic LabVIEW first, then get fancy.
Bob Schor
06-24-2019 08:52 AM
Here you go, I have saved as version 16.
06-24-2019 12:09 PM - edited 06-24-2019 12:10 PM
Well, at least you are better off than many of the serial port help requests I see around here. You at least know you have a binary format for your data and you know the format of the message. How often does your device send out data? Or do you have to request it in order to get a response?
So the first thing you did right was turn OFF the Termination Character. However, it all goes down hill from there. You need to be reading inside of the loop. What I do in this situation is read 1 byte and see if it matches your sync byte. If it does, then you can read the length byte(s) and use that value to read the rest of the message. No real need for a state machine here.
If you want to take this further, you really should be using a queue to pass the data from this loop to another loop running in parallel for processing. Keep this loop strictly to the instrument IO.
06-25-2019 05:04 AM
Thanks, that seems a much simpler solution, now I get the following error:
Error 74 occurred at Unflatten From String.
Any ideas why this would happen?
06-25-2019 06:31 PM
@lafox24 wrote:
Thanks, that seems a much simpler solution, now I get the following error:
Error 74 occurred at Unflatten From String.
Possible reason(s):LabVIEW: (Hex 0x4A) Memory or data structure corrupt.
Any ideas why this would happen?
Did you change that numeric constant to a U8? If you left it as an I32 (the default), you will get that error since it expects 4 bytes instead of 1.