LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to load serial strings one at a time via loop?

Hi,
I am new to LV and programming in general.  I am using a VI to communicate with an uP app that sends commands to my DUT to make it enter certain test modes.  The app uses Hyperterminal and simple keyboard commands to access menus.
The VI is basically working, but I want the serial string write procedure to have a "load" button, so I can enter the string, then click "load" or something like that.  After this works I can expand from there, eventually creating a prompt-style app for each test mode.
Is there an example of this (or something applicable) I can study? I am trying to use a while loop, but am getting lost as to what to do next.
Thanks, Don

0 Kudos
Message 1 of 10
(9,531 Views)
See attached vi.  Type in a string, then click Load.  The string you just typed will be sent to the string indicator for one second.  If sending to a CPU or another device, you can lower the timer delay value from 1000 to 100.  I used 1000 so that you could see the string indicator output for one second.
 
- tbob

Inventor of the WORM Global
0 Kudos
Message 2 of 10
(9,529 Views)
Thank You for the quick reply!
The VI you sent showed me exactly how to do it, and my app is beginning to work.
Don

0 Kudos
Message 3 of 10
(9,520 Views)

Don;

Here's another take on your problem. It doesn't have a load button because it "transmits" the data when you press enter. In addition, I added a window that lets you maintain a record of the commands and responses that have gone back and forth. When you run the VI type something into the command area and press enter. The command and the internally-generated "response" will appear in the window to the right.

If you look at the diagram you will see that it was built using event-driven progrmming. In the event for handling changes in the command string, you'll see the place where I have my demo serial io vi. Replace that VI with one that really sends commands to the external device and reads the response and you have a nice interactive interface for the device.

Note I have also added some error handling (always very important). Basically the little green icon to the left of the loop creates a user event for errors. The little bitty green icon at the right side of the loop looks at the error cluster coming out of the event structure after each execution. If it detects an error it fires the error user event to display the error to you. The green icon to the right of the loop is deinitialization.

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 4 of 10
(9,516 Views)
Hey Mike
 
I am interested looking at some of the ways that you are describing could you post your vi's in 7.0 so that I can have a look. 



Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 5 of 10
(9,503 Views)

yes, but it will have to be tonight...

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 6 of 10
(9,498 Views)
Sure thats OK



Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 7 of 10
(9,492 Views)
Thanks mike for getting that for me, I really like the way you did the error handling, would it be OK for me to add those vi's to my collection.



Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 9 of 10
(9,463 Views)
That's why they are there. Enjoy...
 
Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 10 of 10
(9,458 Views)