08-30-2012 10:34 AM
Good to see the problem has been solved.
In any case, for future reference:
I'm using Eltima Serial Port Monitor, that lets you monitor a serial port used by an other application.
If I'm not mistaken there is a free version downloadable.
Regards,
Marco
08-30-2012 11:40 AM
I'm having a difficult time figuring out how to correctly send commands to the instrument.
It should be very simple. According to the manual, I just send a single carriage return and it will reply with:
" Hello. Press ? for Help. "
Then I send the string "X" and it returns an array of data like so:
"LC1123101742,2012,243,1233,15,3.16,24.66,-5511.213,-999999.0,-999999.0,-999999.0,-999999.0,-999999.0,-999999.0,-999999.0,-999999.0,-999999.0,-999999.0,-999999.0,-999999.0,-999999.0,-999999.0,-999999.0,23.3,-99.0,-99.0,-99.0,-99.0,-99.0,-99.0,-99.0,-99.0,-99.0,-99.0,-99.0,-99.0,-99.0,-99.0,-99.0"
When I do this in Hyperterminal, it works perfectly.
I tried the same thing in LabVIEW using the Serial Write function, but I must be doing something incorrectly.
When I send the correct command in Hyperterminal, I can audibly hear the instrument making a clicking noise so I know it is working.
Then moments later I get the data array in Hyperterminal.
When I send the command in LabVIEW, I do not hear anything from the instrument, and I do not get any data back from it.
I attached a simple version of the code I threw together in LabVIEW. Would someone mind taking a look at how I am sending the commands.
Perhaps I am missing some termination characters or something like that.
08-30-2012 11:47 AM
You need to append the carriage return to your string before sending it out. Hyperterminal does this automatically.
08-30-2012 11:59 AM - edited 08-30-2012 12:01 PM
When I append a carriage return to the string, I am just getting blank lines returned back every iteration.
Here's a really weird behavior. When I run the code in "Highlight Execution" mode, it works intermittently. But not normally.
What could be causing that?
08-30-2012 12:09 PM
I would guess that you need a wait after you write the command. You need to wait for the instrument to take its measurements and then send them back to you afterall.
08-30-2012 12:15 PM
Can you save the vi for 2010? I'm a little behind on versions.
08-30-2012 12:28 PM
Here is the most up to date version of the VI in 2010.
Basically, here's what I think I am doing (or would like to be doing).
1) Configure the port
2) Write a carriage return to get the introduction line
3) Write the command "X"
4) Wait 15 seconds for it to take and send measurements
5) Read whatever is in the buffer
6) Append this data to an array for later use
7) Repeat 3-6 until "Stop" is pressed
😎 Housekeeping
Step 3 must not be working correctly because I very rarely hear any clicking noise. If I run the VI maybe 20 times, I will hear the clicking once or twice, even if I let the while loop run for 10 minutes or so.
08-30-2012 12:34 PM
I thought manual said to send 2 carriage returns to wake it up?
08-30-2012 12:42 PM
Check that the default configuration of the VISA Configure are compatible with the current configuration of your device.
08-30-2012 12:45 PM - edited 08-30-2012 12:46 PM
I think I figured out what the issue was. The instrument needs a bit of time between commands, as Crossrulz said.
This was more apparent manually typing commands using Hyperterminal.
Between the first carriage return and the first X, I had to put a 5 second wait.
This was the case for all of my Serial Writes, they cannot be back-to-back, they needed waits between them.