From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Packet Inspection: How to find 5 different packets?

Solved!
Go to solution

Hi,

 

I want to inspect I2C traffic. In my traffic are 5 different packets. I want to detect them and if all are detected I want to leave the VI with a TRUE. If not, I want a timeout and a FALSE as return.

 

Everything works, except the evaluation. Basically my VI should do the following:

 

Inspect DATA

{

     If Condition 1 found, set bit 1

     If Condition 2 found, set bit 2

     If Condition 3 found, set bit 3

     If Condition 4 found, set bit 4

     If Condition 5 found, set bit 5

     ++ repetitions

}

 

If bit1 AND bit2 AND bit3 AND bit4 AND bit5: return TRUE

If repetitions > 100: return FALSE

 

repeat

 

My problem is: How can I set a bit and keep it set? Let's say, I find Condition 1 and set it. In the next iteration I find condition 2 and set bit 2. But, in the same iteration, Condition 1 is not to be found and so bit 1 is cleared again. So I never achieve, that all bits are set.

 

I hope I could make myself clear and would be happy about any solutions. I am on labview base, so no access to events.

 

kind regards,

Christian

0 Kudos
Message 1 of 4
(2,243 Views)
Solution
Accepted by topic author Exle

Hi Exle,

 

how do you forward data from one iteration of a loop to the next?

The buzzword here is "shift register"!

 

So you would store your conditions with

IF (condition1 is found) OR (condition1-flag) THEN (set condition1-flag to TRUE)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 4
(2,241 Views)

Hi,

 

thanks, it's working. But it is really complicated compared to a simple "if (condition) bit0 = 1".

 

What are kudos for?

 

Christian

0 Kudos
Message 3 of 4
(2,216 Views)

Hi Christian,

 

it's just a little bit more complicated than "if condition =1" because your term is "if condition = 1 OR condition has been TRUE before"...

 

There are easier ways to check your 5 conditions:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 4
(2,209 Views)