04-11-2011 10:27 AM
I am reading CAN data and every now and then i get corrupted data. Is there a way to trigger my boolean "DROP" indicators every other message? The corrupted data happens just once and then the real data comes thru. So maybe if 2 messages in a row matched it would pass it thru. Then it would disregard the bad message since it doesnt match the one before or after?? Any thoughts would be helpful. I attached the VI to take a look
04-11-2011 11:47 AM
Hi chris12345,
Without going too much into detail, I have a couple suggestions for you.
First, you may consider adding a bit more structure to your code. If you're reading data sequentially, you could create a little state machine which looks at the incoming read data and proceeds to one of two states based on if the data was "corrupted" or otherwise. This might offer you the opportunity to "trigger" your drop indicators, which I'm interpreting as turning them on
Second, I did peak at your code, and noticed you were using local variables where it appeared you might be better served by dataflow (wiring values under an appropriate architecture for your code). For example, you're performing your VISA config and read operation "in parallel" with your subsequent computational routines. There's no guarantee in LabVIEW (for the right reason - sometimes one wants to keep code "in parallel") that your code on the left will execute before your code on the right without a data dependency or using a structure to control code flow. In your case, you perhaps intend for a more serial order of operations.
There are a couple videos here on this
I know this is fairly general commentary, but hopefully this helps at first glance!
Best,
JLSx
VI High - LabVIEW Programming Video Blog
04-11-2011 12:22 PM - edited 04-11-2011 12:25 PM
Hi again chris12345,
I submitted the above accidentally and when I returned could not edit it.
What I meant to add there were a couple links for you on short videos covering dataflow - I think this might help you solve your problem per some of the notes in my previous post:
Dataflow: http://blog.sixclear.com/post/3510548005/labview-dataflow-programming
Dataflow control with the error cluster: http://blog.sixclear.com/post/3791100719/labview-dataflow-error-cluster
Hope this helps!