Interfacing with serial port on IRB6600
in RobotStudio
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?
ENDMODULE
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
0
Comments
-
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:56Thomas H. Johnston
PACs Application Engineer0
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 249 ScreenMaker
- 2.7K Robot Controller
- 310 IRC5
- 59 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 786 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings