LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

problems with shift register

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

Message Edited by ANKU on 04-07-2010 08:30 AM
0 Kudos
Message 21 of 33
(1,590 Views)

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. 

0 Kudos
Message 22 of 33
(1,589 Views)

Hi ANKU

 

Maybe this can help (w/o counting).

 

Regards, Vt

0 Kudos
Message 23 of 33
(1,562 Views)

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 ?

0 Kudos
Message 24 of 33
(1,546 Views)

Hi ANKU

 

Maybe you have to split the input array...

 

Regards, Vt

0 Kudos
Message 25 of 33
(1,538 Views)

Hi VT,

 

I am using labview 8.0. Can you resend me the code in verison 8.0 ?

 

Thank you.

 

0 Kudos
Message 26 of 33
(1,531 Views)

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

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 27 of 33
(1,523 Views)

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.

 

 

0 Kudos
Message 28 of 33
(1,516 Views)

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

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 29 of 33
(1,506 Views)

Attached is an array attemt, it's quick and might be bug ridden and not work at all, but it's an idea. 😉

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 30 of 33
(1,501 Views)