07-15-2011 10:36 AM
Hello,
I just started programming in Labview 2010 and am having some trouble with serial read.
Attached is two VIs with the same read code after writing "pw?\r" to the port and waiting 50ms before reading. However DyeLaser.vi code returns nothing, while DyeLaserTest.vi is able to return the full string. I cannot figure out why. Help with this would be greatly appreciated.
Background info:
This program is made to control a Coherent CR-599 Dye Laser using a Oriel Model 18011 Encoder Mike Controller (that controls an encoder mike that rotates a birefringence filter) and then reading the power output with a Coherent FieldMaster GS with LM -02 Silicon Detector. I am having problems with reading the power from the fieldmaster after sending the pw? query.
Other issues:
I cannot get Wait on Event to work properly. Oriel echoes your keystrokes so I tried to discard all those events while waiting for "READY" to be
outputted by the Oriel after the GX command where X is a number.
Also I don't think my "wv" command for the fieldmaster is working correctly in the program though the command works find in HyperTerminal.
Also I realize my code is properly really clunky, so any other suggestions on how to improve my code is welcomed.
Thank you for your help.
07-15-2011 02:26 PM
Hi
Why so complex?
The first thing never to do is having a lot of code in an event structure!
Serial is so slow LabVIEW can handle it without events.
Anyhow this asks for an instrument driver approach.
make subvi's that issue a command and read the answer if necessary and make a subvi that reads until an endcharacter.
Then start again using these vi's
Use the event structure to call code (outside the event structure on a keypress and in timeout eventually check number of byutes received.
Also check the producer consumer template in new....///// from template