LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Function input and output out of sync

Solved!
Go to solution

Hello everyone!

 

I have made a DES (Data Encryption Standard) VI for work.

 

The problem with it currently is that the input and output are out-of-sync by a loop.

 

When the VI is started, after the first iteration, the DES output to the last iteration of the previous run is output. After the second iteration, the output to the first iteration is displayed and written to a text file.

 

When you run the subVI, names "des_combined", the output matches as it should. Only when run inside of main is it an issue and I can't find any data flow issues that'd cause it.

 

Any help with this would be greatly appreciated, and any feedback on my programming style would also be appreciated.

 

Here are 2 easy inputs to the DES algorithm for testing and reference, given a key of ABCDEF0123456789:

 

Input: FFFF FFFF FFFF FFFF

Output: 6A79 C5FB 6164 2008

 

Input: 0000 0000 0000 0000

Output: 7229 F9D3 0656 652A

 

I am using LabVIEW 2018.

 

WARNING:

This VI writes a txt file to the subfolder "Data". The txt file will be named "Radio_In_x.txt", where x is 1, 2, 3, 4, ...

0 Kudos
Message 1 of 5
(1,914 Views)

Can you tell us the typical values for all controls and how you are using your toplevel VI. Who write the DES code?

 

I have no idea how the boolean array is formed in the following code:

 

altenbach_0-1591292674054.png

 

What is the "frequency"? What is changing the "test input" control while the loop is running? Seems all so unpredictable.

 

0 Kudos
Message 2 of 5
(1,896 Views)
Solution
Accepted by topic author ChrisM11

OK, you are tapping into the delayed output of the feedback node for the message output. Change your code inside the toplevel DES routine as folllows:

 

altenbach_0-1591293325122.png

 

Message 3 of 5
(1,892 Views)

The frequency is the input frequency coming into the VI. In the current setup, the user inputs the message coming in via the "Test Input" control. This is only for testing purposes, the final version will be driven by a radio attached to a DAQ.

 

The boolean array is being created by sampling the input "Test Input" at a rate determined by "Frequency". It's a 64-bit message that comes into the DES algorithm, this loop allows me to create the 64-bit message exactly how the radio will.

0 Kudos
Message 4 of 5
(1,887 Views)

Dang. Thank you so much. I've spent the last day or so staring at this. Works like a charm now!

0 Kudos
Message 5 of 5
(1,882 Views)