RobotStudio event

Interfacing with serial port on IRB6600

Options
I've been having trouble interfacing with the serial port on my IRB6600 robot.  I have an ADC (http://www.omega.com/pptst/D1000.html)
with serial output that is hooked up to COM1.  The ADC requires a $1RD
command to request data from it, so I'm trying to send that string to
the serial port, and then read the data value that comes back.   When I
try and run this program, it hangs on the line that tries to read the
serial port.  Can anyone tell me what's wrong?

Code:
MODULE Controller
VAR iodev com_port1;
VAR string signal;
PROC GetSignal()
OPEN "COM1", com_port1BIN;
While True Do
WriteStrBin com_port1, "$1RD";
ReadStrBin com_port1, signal;
TPWrite signal;
EndWhile
CLOSE com_port1;
ENDPROC
ENDMODULE

Comments

  • Thomas J
    Options

    Try This:

    WriteStrBin com_port1, "$1RDD";

    Also, I Beleive "ReadStrBin" is a fucntion with a return value of the type string;, not an instruction as you show in your code. Please check the RAPID Reference Manual for examples on how to use the following:

    ReadStrBin function and/or ReadAnyBin instruction -

    You will want to figure out how to use the function to be able to determine when the EOF occurs by reading one character at a time.

    What version of baseware and/or RobotStudio are you using?

    It should have complained about your syntax...

    Thomas J2008-6-25 1:53:56
    Thomas H. Johnston
    PACs Application Engineer