LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Controlling ESP 300 motion controller via Labview

Hi all,

It's for the first time I try to communicate with other devices using Labview. I made a VI (07_rs232.vi) to send commands to ESP 300 motion controller via RS232. This VI should make zig-zig move using two axis (2 and 3). When I'm running this VI slowly (Highlighted execution) or with smaller count of iterations (4x4) everything works fine. But when iteration count is higher error on the device occurs ("command does not exist"). Does it have connection with the memory of the ESP 300? Am I writing too many commands to its memory? I have no experience with this. I appreciate any kind of help.

Message Edited by ceties on 09-18-2006 09:34 AM

LV 2011, Win7
0 Kudos
Message 1 of 11
(6,552 Views)
Hello,

I think the ESP300 returns an error because you are sending a command before the previous one has finished.
I think you should do like this :
 1. send a command,
 2. periodicaly read the status until it says the command is over
 3. then only send the next command

hope this helps 😉


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

Message 2 of 11
(6,537 Views)
A whilw ago, I made this VI that will wait for an axis to be in idle state 😉



We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

Message 3 of 11
(6,540 Views)
Thanks TiTou,
but one SubVi in your example is missing. It is "AC_1338_VIS_FGV_esp300.vi"

I have a couple of questions:

1) symbol "\r" tells the RS232 that this is end of the command? I realized that it doesn't work without it but still don't know purpose of these characters.

2) I suppose that it is not possible to communicate with ESP 300 via RS232 using GPIB library that is provided by newport
I think about it because there is no library for RS232 and on this page in comment it seems that Greg is using modified library for RS232 communication but maybe I didn't understand clear.

Thanks
LV 2011, Win7
0 Kudos
Message 4 of 11
(6,522 Views)
Hi,

For some reason, the link you gave doesn't work Smiley Indifferent...

Sory I forgot the subVIs... here is the dll with everything. I didn't use the VIs from NewPort because the code was quite poor.
You can use th subVIs to :
 - read axis position or informations
 - send command to be executed
 - send "question" and read the "answer"

It's quite easy to use because the VISA session will be help in the FGV (blue VI), use it to open the session at the beginning of your process, use it for controlling your axis and use it also at the end to close the VISA session.

Hope thi help

BTW : aboute the "\r" well yes it is required as an end of message character 😉



We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 5 of 11
(6,518 Views)
Hi TiTou,
thank you very much.

I read in manual that:
"To prevent buffer overflow when data is transferred to the ESP controller input buffer, a CTS/RTS hardware handshake protocol is implemented. The host terminal can control transmission of characters from the ESP by enabling the Request To Send (RTS) signal once the controller’s Clear To Send (CTS) signal is ready. Before sending any further characters, the ESP will wait for a CTS from the host. As soon as its command buffer is full, the controller de-asserts CTS. Then, as memory becomes available because the controller reads and executes commands in its buffer, it re-asserts the CTS signal to the host terminal."
So I changed the flow control parameter in "VISA Configure Serial Port" to RTS/CTS and now everything works fine. But I don't understand properly what is happening. Means it that Labview sends commnads to ESP300 until its buffer is full then wait and after buffer is empty starts sending other and so on? Or it means that is always sent one command and then other and other....

Message Edited by ceties on 09-19-2006 08:11 AM

LV 2011, Win7
0 Kudos
Message 6 of 11
(6,485 Views)
Hello everything goes OK but I have in some cases timeout problem. If I understood correctly with RTS/CTS it's sending commands until the buffer is full (512B). In this case it waits and after buffer is empty starts sending again. Generally there are two kinds of commands I'm sending:

1) Move axis
2) After motion done wait XXX ms on this position (In this wait-time is done measurement)

Everything works OK when wait-time is 1-500ms but when it's around 1000ms serial timeouts. I think that it's because buffer is full. And because wait-time is long it takes more than 10sec (my timeout) to go through all commands in buffer and write following command that waits to be written to the buffer.

Is there any way how avoid this behavior without rising timeout value (with higher timeout value in case of some other problems for example with cable it will take long time to find it/timeout)? Or at least how to compute ideal timeout?

I hope I described clearly my problem

I appreciate any advices
Thanks

Message Edited by ceties on 09-26-2006 04:27 AM

LV 2011, Win7
0 Kudos
Message 7 of 11
(6,449 Views)
I missed a word...

...with BROKEN cable it will take long time to find it...
LV 2011, Win7
0 Kudos
Message 8 of 11
(6,435 Views)
Hello,
 
In LabVIEW there is a function that you can use to set the number of bytes in the buffer (VISA Set I/O Buffer Size.vi).  The default is 4,096 bytes.  An example of using this function can be found in the NI Example Finder (Help>>Find Examples).  The example is the Advanced Serial Write and Read.vi
 
Daryl E
National Instruments
Applications Engineer
0 Kudos
Message 9 of 11
(6,421 Views)
Hello Daryl,

I know about this function, but don't know how it can help me. I need to know when the buffer is almost empty to send other commands. 😞
LV 2011, Win7
0 Kudos
Message 10 of 11
(6,410 Views)