04-07-2010 08:22 AM - edited 04-07-2010 08:30 AM
Hi Ray,
My code is used to collect data from a lin network. I get the output from the LIN networks slave unit and i should check if the output from the slave is correct. The right order of ouput is shown below. The ouput is a cluster of different data types ( as you can see in data3, the input to the check code)
byte0 byte 1 byte 2
00 00X10 00
00 00 00X01
00 00 00X01
00 00X40 00
If i get this order of data from the slave unit in the LIN network i get a pass cycle. So what i am doing is checking to see if i get a 00X10 first then a 00X40 from the data byte 1 (element 1 of the array). I should also get two 00X01 from the data byte 2 (element 2 of the array). So if i have these two condition then i get a pass. So i used SR to count up the numbers and then add them to give me the number of pass cycles. I am not sure if this is the simplest method, but this is what i could come up with. If i initialize the data valvue to 0 also the SR for the number 01 starts from 1.
I hope I have given you a clearer picture now abt why i need to do this check. Maybe now you can help me more.
Thank you
04-07-2010 08:25 AM
Hi,
I tried making the default value 0, it still doesnt work. It counts up from 1. I cannot initialize the SR to 0, as they would start from 0 for every new data element. I need to figure out another solution to this problem.
I cannot understand why only this SR starts from 1. All the other SR starts counting up from 0. This is really weird.
04-07-2010 10:03 AM
Hi ANKU
Maybe this can help (w/o counting).
Regards, Vt
04-08-2010 01:55 AM
Hi VT,
Thank you for your help. The concept is working, but i need to count the number of times i get the number 00X10, 00X40,00X01. I need to display this on the front panel of the main code.
Can you help me with a counter ?
04-08-2010 02:29 AM
Hi ANKU
Maybe you have to split the input array...
Regards, Vt
04-08-2010 02:53 AM
Hi VT,
I am using labview 8.0. Can you resend me the code in verison 8.0 ?
Thank you.
04-08-2010 03:29 AM
ANKU wrote:Hi Ray,
My code is used to collect data from a lin network. I get the output from the LIN networks slave unit and i should check if the output from the slave is correct. The right order of ouput is shown below. The ouput is a cluster of different data types ( as you can see in data3, the input to the check code)
byte0 byte 1 byte 2
00 00X10 00
00 00 00X01
00 00 00X01
00 00X40 00
Message Edited by ANKU on 04-07-2010 08:30 AM
Why dont you build an array/list of the 4 last messages and check it all at once? Next message = shift the oldest out.
/Y
04-08-2010 04:02 AM
Hi Yamaeda,
I don't think i can do that because its not necesarry that the last 4 messages have to be in that order. Sometimes i get 00 in between. This is cause there is some delay. I need to check when i get the output i get it in this order... first 00X10, then twice 00X01 and then 00X40. It can have 00 also in between. So storring the data is not possible cos the pass result needs to change as the LIN output data also changes.
So i used SR to keep count of the numbers and then if i get the numbers in that order, then increament the pass by 1 and display on front panel.
04-08-2010 04:31 AM
Then the array should still work, just dont add the last data to the array if it's 00. 😉
Or you'll implement it like a state machine where each state is the byte to check for, and the last state gives Pass as result. The state would go to next if the byte is valid, ignore 00 and reset on any other byte.
/Y
04-08-2010 04:58 AM
Attached is an array attemt, it's quick and might be bug ridden and not work at all, but it's an idea. 😉
/Y