LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

read serial port

Hi. I have two problems reading serial port. First, i cannot synchronize the reading with the writing of instructions. If i send, for example, open, close, i only can read "done" once, but i would have to read "done" twice, one for "open" and another one for "close".

Second problem is the number of bytes that i have to read from serial port.  How i can know it?. Robot sends "ok", "done" and i have to know the number of bytes. I send you the module.

Thanks.
0 Kudos
Message 1 of 10
(4,648 Views)
Hello ivan,
if you send "open" and the robot sends "done" back, this string will remain in the input buffer until you read it. If you send another "close" and it answers "done" without reading the first string, you should read get from the input buffer the string "donedone". But I suppose, the first string is  deleted by the "VISA Clear"- function or the robot didn't have the time to send the answer.

For the second problem I send you a picture of how to do the read.


Btw, you can synchronize your VIs very nice with the error- wires, use the "time delay"- express-VI, it has error-connectors too.
Dave

Message Edited by daveTW on 05-03-2006 05:15 PM

Greets, Dave
0 Kudos
Message 2 of 10
(4,641 Views)
Thanks daveTW. I can read the bytes from serial port, and now i read "open", "done", "close", "done". What can i do to read only the robot sends?

Thank you very much.
0 Kudos
Message 3 of 10
(4,634 Views)
Hi ivan,
how do you mean that? Do you only want to know, that the robot sends at all? Then you ju8st have to check, whether the "bytes at port"-property-node gives a number greater than zero back. Is that the right answer to your question?
Dave
Greets, Dave
0 Kudos
Message 4 of 10
(4,611 Views)
Hello Dave. I want to read only the answer of the robot, it is to say, if i send "OPEN", i want to read "Done", and now i read "OPEN", or "OPENDone", or "OPENCLOSE". do you understand my problem?

Thanks for you.

Ivan.
0 Kudos
Message 5 of 10
(4,601 Views)
Ivan,

Is it possible that the robot echos the command it receives before sending the "done" message? Some equipment does that and it would explain your results.

Lynn
0 Kudos
Message 6 of 10
(4,599 Views)
Hello johnsold. I think that when i receive "open" means that i'm reading the same that i'm sending, it is to say, if i send "OPEN", i receive "OPEN", but i don't understand why i receive "OPEN", "Done", or "OPEN","CLOSE". If i'm receiving the same tha i'm sending, it would have to be "OPEN","DONE", or "OPEN","Done", or "MOVE",Done".

Do you understand?

thanks.
0 Kudos
Message 7 of 10
(4,595 Views)
Ivan,

This is what I meant by "echo:"
Computer sends: "open"
Robot sends: "open" ... "done"
Computer sends: "close"
Robot sends: "close" ... "done"

When equipment echos a command it repeats the command before sending its response. The ... indicates that some time may elapse between echoing the command and sending the response. This is not a LabVIEW issue. It depends upon the software in the robot. Check with the manufacturer or read the manual for the robot carefully to see if it echos commands and whether this is an option that may be disabled.

Lynn
Message 8 of 10
(4,579 Views)
Hi johnsold. Are you sure that is an echo command?. I think that LabView is reading the same order that sends by the serial port, cause when i use the hyperterminal i don't read the echo, but the answer of the robot.
0 Kudos
Message 9 of 10
(4,552 Views)
I do not know. I was just suggesting that it sounded like an echo. The serial port transmit and receive lines are not connected together unless you have an external loop back cable (which you would not be using while connected to the robot), so I have no idea why the LV and hyperterminal responses are different.

Lynn
0 Kudos
Message 10 of 10
(4,548 Views)