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: 

QMH with DAQ and Serial I/O with Shift Register or TypeDef

Solved!
Go to solution

Hello Together,

for some time I was trying and searching the forum but first I don't get it and second I don't understand why.

 

my task:

I'm building up a Test controlled by serial and I/O Commands, NI Hardware is PCIe-8430 and PCIe-6323 with an QMH, Labview 2015.

I have an Event Loop, a Message handling Loop and a "Working Loop"

 

within the working loop I'd like to send the commands and read the I/O's / serial.

 

on the first run I initiated the serial Visa and the DAQ I/O's in a case in the Working loop and tried to store the names in a shift register:

WWolf78_0-1588844644986.png

 

when I try to Read/write the Serial (as well as the I/O's) in another Case within the Working loop I get an Error.

 

to keep this still simple, I tried to store the Names in an TypeDefCluster:

 

WWolf78_4-1588845420245.png

 

 

WWolf78_1-1588844753408.png

and read from those:

 

WWolf78_2-1588844884573.png

 

I get an Error as well.

 

the only thing that work, is initiating them BEFORE the "working Loop":

(which I'd like to avoid)

 

WWolf78_3-1588844976454.png

 

 

How can I initiate the Serial and I/O's within one Case in a While Loop an access them in another Case within the same While Loop?

 

 

Thanks in Advance!

0 Kudos
Message 1 of 4
(2,055 Views)

Well, since you only included pictures of part of your code it's hard to tell. However, it looks like you have not passed the data across all cases of your case structure in your first picture. This means that you are probably putting the data in the case structure but in a subsequent case you are replacing it with default (invalid) data. This is just a guess, though, without seeing the code.

0 Kudos
Message 2 of 4
(2,027 Views)
Solution
Accepted by topic author WWolf78

@WWolf78 wrote:

WWolf78_0-1588844644986.png


I see a fatal flaw in this snippet.  If you look closely at the output tunnels of your case structure, they look hollow.  This tells me they are set to "Use Default If Unwired".  So if you did not wire the reference through a case that was ran, you will lose your reference.  You NEED to wire those wires through all of your cases.  Luckily, LabVIEW has a nice little feature that has been out for a long time (since LabVIEW 8.6).  Right-click on the output tunnel and there is an option to "Link Input Tunnel".  There is an option to have LabVIEW automatically wire any currently non-connected output tunnels to the linked input tunnel.  And once the tunnels are linked, the reference will automatically be wired through for any new cases you make.

 

Without knowing what else is happening in your program, I would recommend you make a separate loop for each of your serial ports and another one for the DAQ task.  With them separated, they are no longer interfering with each other in regards to timing.  It also makes your code more modular, and therefore reusable.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 4
(2,025 Views)

Hi Crossrulz,

 

thanks for the Tip and the solution. Now I understood, why I'm "Loosing" the name I got an Error.

 

in a first Test run it works.

 

additionally: I do initiate the Serial and the I/O's in separate loops, just for finding and logging any error which occurs thereby..

 

inital I wondered, why this does not work with the type def, but it's due to the same reason

I had the typedef tunnel set to "use default if unwired"

0 Kudos
Message 4 of 4
(2,010 Views)