LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how do I display certain controls through several Labview Cases?

Solved!
Go to solution

Yes this is much better as the test button requests and displays the employee ID and serial number when the knob is set to all tests (state 0 ) but it doesn't write data to the serial port to request the test selected by the knob...

 

I like the fact that you have set it up where changing the knob will initialize a write to the serial port but I 

also would like the test button to not only request the employee ID & the serial number but to also write the knob

value (+1) to the serial port to start the test...

 

I hav ebeen playing around with what you sent but have not figured out how to start the test after the serial number 

and employee ID have been entered and are displayed...

 

thanks again for all your help with this.

0 Kudos
Message 11 of 24
(1,743 Views)

OK, it is very close.

Attached are a few modifications that I made.

 Not sur if this is the right way to do this but i added code to send a command after getting the 

serial number and amployee ID.

 

I also set the loop not to time out as it was not finishing.

 

It runs slow and not sure why yet but I also need to look at the device's code.

 

thanks

0 Kudos
Message 12 of 24
(1,741 Views)

You were trying to send command forever by placing code in main loop, it should be in event structure with test control.

VI attached.

Message 13 of 24
(1,677 Views)

I appreciate your help and your patience but something still isn't quite right...

 

When I start the application and press the test button, the used only has a couple of seconds to enter the serial # & employee ID before the serial port is read. Also ther eis an error on the serial prot read that shows up.

Attached are two screen shots of this vi executing.

lv-error.jpg  shows the vi executuin as the employee & serial# info is entered while lv-error1.jpg shows the error

as it happens and then the while loop ends.

 

When I connect a terminal program here is what I am seeing with this device:

 

When "1" is written the serial port (knob setting 0) the following data is sent by the device that I want to display in the Test status window:


POD1 attached
No Errors encountered... Aout, Bout, Cout, & Dout all pass high/low testing...
Errors encountered... Stim- on J1 is low and may be open...
Sminus[0] = 5.03 passes with the value of 5.03
Sminus[1] = 0.25 passes with the value of 0.25
Sminus[2] = 0.94 passes with the value of 0.94
Sminus[3] = 1.78 passes with the value of 1.78
Sminus[4] = 2.52 passes with the value of 2.52
Sminus[5] = 3.34 passes with the value of 3.34
Sminus[6] = 4.21 passes with the value of 4.21
Sminus[7] = 4.37 passes with the value of 4.37

 

 

When "2" is written the serial port (knob setting 1) the following data is sent by the device that I want to display in the Test status window:
-------------- case 50 --------------
No Errors encountered... Aout, Bout, Cout, & Dout all pass high/low testing...

 

When "3" is written the serial port (knob setting 2) the following data is sent by the device that I want to display in the Test status window:
-------------- case 51 --------------
Errors encountered... Stim- on J1 is low and may be open...

 

 

When "4" is written the serial port (knob setting 3) the following data is sent by the device that I want to display in the Test status window:
-------------- case 52 --------------
Sminus[0] = 3.46 fails with the value of 3.46
Sminus[1] = 3.50 fails with the value of 3.50
Sminus[2] = 3.49 fails with the value of 3.49
Sminus[3] = 3.52 fails with the value of 3.52
Sminus[4] = 3.49 fails with the value of 3.49
Sminus[5] = 3.52 passes with the value of 3.52
Sminus[6] = 3.51 fails with the value of 3.51
Sminus[7] = 3.54 fails with the value of 3.54

Download All
0 Kudos
Message 14 of 24
(1,672 Views)

I have been playing around with this and it executes like I want it to now but I still get that error and not sure why yet,,,

labview error ERR (-1073807339)

 

0 Kudos
Message 15 of 24
(1,660 Views)

That's a VISA timeout error.  That means you didn't get your data in time.

 

How is your VISA configured?  Do you have the termination character enabled?  I don't see any serial port configuration occurring inside your code.

 

Don't open the VISA port on every execution of that while loop.  You should have the VISA open outside the while loop just like the VISA close is.  You also don't need to flush the port after just opening it up.

0 Kudos
Message 16 of 24
(1,658 Views)

Thanks for the tip...  I added an instrument control to read how many bytes are in the serial buffer and then I set that as the size of the read buffer. This seems to take care of the problem.

 

I have reworked my code (and I am learning as I go  so not sure if there is a better way of doing this or not...) but not quite there yet. Because the device I'm writing to dump strings of data down the serial port, I am attempting to display all of this in the test status indicator. But I can only get one line to be displayed...

 

I am trying to figure out how to display all the data. I have attached my code and a screen shot of the area that doesn't allow me to read and display all of the data (inside the green rectangle)

 

Any helpful suggestions are appreciated...

 

thanks

Download All
0 Kudos
Message 17 of 24
(1,644 Views)

I am trying to get all of the data from the serial port to be displayed into the test status string indicator but 

out of the 580 bytes available, only 18 are being displayed,,,

 

 

The code (also attached)  appears to make only 1 pass and writes a "1" to the serial port  which causes

the device to send the following data to the serial port: (as verified with a terminal program)

 

POD1 attached
No Errors encountered... Aout, Bout, Cout, & Dout all pass high/low testing...
Errors encountered... Stim- on J1 is low and may be open...
Sminus[0] = 5.03 passes with the value of 5.03
Sminus[1] = 0.25 passes with the value of 0.25
Sminus[2] = 0.94 passes with the value of 0.94
Sminus[3] = 1.78 passes with the value of 1.78
Sminus[4] = 2.52 passes with the value of 2.52
Sminus[5] = 3.34 passes with the value of 3.34
Sminus[6] = 4.21 passes with the value of 4.21
Sminus[7] = 4.37 passes with the value of 4.37

 

the test status string indicator is then set to display:


POD1 attached 

 

and then it just sits there ...

 

I am not sure if I need a loop to do this or if the CRLF are causing the data sent to the is to happen or not but truncated...

 

Any ideas?

 

 

untitled.JPG

0 Kudos
Message 18 of 24
(1,634 Views)

Your inner while loop won't iterate again until you do something to make it get past that inner event structure.  The only thing defined there is the quit button.  So you can't read anymore data in that loop until you hit the quit button.

 

Overall, the multiple event structures and multiple while loops creates a mish-mash of code.  I think you need to take a step back and create a flow chart of how your code should execute.

 

Also, you don't have the serial configure in the code.  I don't know what the default settings would be and whether that wuoild have the termination charactere enabled or not.  Clearly configure your serial port in  your VI, otherwise it will default to your MAX settings whatever they might be.

Message 19 of 24
(1,627 Views)

@Japper wrote:

the test status string indicator is then set to display:


POD1 attached 

 

and then it just sits there ...


Your code is deadlocked due to complete misunderstandings of dataflow and event structures. Your first iteration of the inner loop cannot complete until quit is pressed. That inner event structure needs to go. There are other hair raising mistakes, for example the visa session needs to be wired across the false case too, else it becomes invalid. What's the purpose of the pink shift regsiters? you never even look at the previous value so why are they there?

 

All you need is one outer loop and a single event structure. If the serial read is reasonably fast, place the inner while loop into the "test" event case. Create a second event case to quit.

 

Keep it simple! Why is the diagram so cramped? Are you programing this on a netbook?

Message 20 of 24
(1,619 Views)