LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read from Serial Port

So you can move it but the in position query doesn't work. It looks like you're sending the same termination character in both VIs so I don't think that's a problem. You shouldn't have to do another VISA Configure Serial Port in the VI that checks in position but I don't think that's a problem either. One thing I saw in the manual was that the R command was either buffered or immediate and the manual says that:

"Immediate or buffered commands are immediate unless command execution is being

delayed or command queuing is enabled whilst moving, in which case the command is

buffered."

Is it possible that you have queuing on and the device is buffering the command and it's telling you that? Can you issue the command after the stage has finished moving?

0 Kudos
Message 21 of 27
(2,062 Views)
Got it working (somewhat). I can run the program on its own no problem.

But now when I tried using it as a sub-VI in my main program I'm getting a time-out error. Smiley Mad

It seems that the program is reading the buffer fine the 1st time around but the 2nd time around it causes a time-out error.

What's going on? Smiley Sad
0 Kudos
Message 22 of 27
(2,060 Views)
It would help if we could see the top level program but one possible problem is that you're closing the VISA session in your subVI. What you should be doing is in the main, open VISA once (i.e. before the main while loop starts) along with a single VISA Configure Serial Port. Then you pass the VISA resource name to the subVI. When the main VI is done, then you do a VISA Close.
0 Kudos
Message 23 of 27
(2,056 Views)
Thanx for the helps. I seemed to got everything working now.


0 Kudos
Message 24 of 27
(2,054 Views)
What was the problem with receiving the same characters that were sent?  Inquiring minds want to know.
- tbob

Inventor of the WORM Global
Message 25 of 27
(2,051 Views)
What do you mean tbob?

I'm not too sure what's the difference between your code and my code. They both look pretty similar. I basically used the move 2D table.vi and changed the input commands and added the "read serial" part from your code.

The timeout error seemed to be caused from these while loops I was using in the main program. I then changed them so instead calling the "In position.vi" many times in the main program I implemented the while loop in "In position.vi."
0 Kudos
Message 26 of 27
(2,041 Views)
Hi honeywell,

                     I guess you are using" \r " for a carriage return command. Why dont you try using the inbuilt Carriage return string function in the string pallete. I guess since your controller does not recieve a valid command , it loop backs the original sent data, to you!
                      Also place atleast 100 - 200 ms. delay between the 2 sequences.It is required. Do you set the no. of bytes at the port manually?? You can even use the VISA bytes at port property node if u are not sure about the no. of bytes at port.....!!!!
0 Kudos
Message 27 of 27
(2,170 Views)