Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

Fanuc R-30iA controller send data from Notebook

Status
Not open for further replies.

ruspi

Mechanical
Dec 14, 2015
2
0
0
PL
Hi All,
I'm having problems with sending data to Fanuc M-10iA robot with R-30iA controller. I'm trying to use RS232 interface. I don't have COM port in my notebook and I'm trying to use USB RS232 adapter (cheap one, Prolific chipset).

I made a following cable:

ROBOT
PC​
25 pin male connector
9 pin female connector​

2 >--------------------------------------------------------------------------------------------------------------< 2

3 >--------------------------------------------------------------------------------------------------------------< 3

7 >--------------------------------------------------------------------------------------------------------------< 5

6 >--
|
8 >--
|
20 >--

4 >--
|
5 >--

I wrote following program in Karel, compiled using Roboguide and put it through FTP on Robot:

PROGRAM read_rs

VAR
RS232 :FILE
file_status :INTEGER
xs :STRING[1]
x :INTEGER
stat :INTEGER

BEGIN

--set transmission parameters
stat = SET_PORT_ATR(PORT_2, ATR_BAUD, BAUD_4800)
stat = SET_PORT_ATR(PORT_2, ATR_PARITY, PARITY_NONE)
stat = SET_PORT_ATR(PORT_2, ATR_SBITS, SBITS_1)
stat = SET_PORT_ATR(PORT_2, ATR_DBITS, DBITS_8)
-- set transmission without handshaking
stat = SET_PORT_ATR(PORT_2, ATR_MODEM, MD_NOUSE_DSR) --turn off DSR
stat = SET_PORT_ATR(PORT_2, ATR_MODEM, MD_NOUSE_DTR) --turn off DTR
stat = SET_PORT_ATR(PORT_2, ATR_MODEM, MD_NOUSE_RTS) --turn off RTS

CLOSE FILE RS232
OPEN FILE RS232 ('RW', 'P2:')

file_status = IO_STATUS(RS232)
IF (file_status<>0) THEN
WRITE TPDISPLAY('Failed to open the file = ',file_status, CR)
ENDIF

READ RS232(xs)
CNV_STR_INT(xs, x)
WRITE TPDISPLAY('x=',x,CR)

CLOSE FILE RS232

END read_rs

Finally I am using HyperTerminal for sending data from notebook. When I run my read_rs program from teach pendant it stops executing on line with command READ RS232(xs). I mean it not stops it is still runing but I can wait for ages and no data is coming onto TPDISPLAY. Occasionally I am getting error "DSR off when transmission..."

I can't figure out what can be wrong. Any help appreciated. Thanks in advance!

 
Replies continue below

Recommended for you

ruspi;

I think you may be lacking some signals the Fanuc is demanding. Often industrial controllers use the handshake lines.

Check this link for detailed explanation of the various signals:
Signal descriptions

And this link for the correct handshake connections:
Cable schedule

There is also a distinct possibility that your USB to RS-232 adapter doesn't work. I have had EXACTLY 50/50 odds on them working correctly. So much so that the last 232 related job I did I went to Fry's and picked two (they're cheap) different ones, brought them back and sure-enough one didn't cut it and the other worked flawlessly.

So at the least you need to confirm yours is working right by looping it back to itself to see if characters are leaving and being received. Or use a scope to confirm it. A scope can also help to make sure your baud rate is what it should be.

Lastly download MTTTY and use it instead of the hopelessly crappy POS hyperterminal.
MTTTY.zip a better Terminal program


Keith Cress
kcress -
 
Also use a scope, right on the wires, to check the signal voltages.
A lot of PC 232 ports (and I'm guessing USB adapters) assert signals to +5V and -5V, or even +5V and 0V, which is not really compliant with the standard's +12V and -12V.
I.e., it's possible that your robot is (correctly IMHO) more fussy about RS232 conformance than is your average PC designer.

You might also want to use an isolating RS232 interface (see blackbox.com for a selection), because industrial controls sometimes have a different 'ground' voltage than a PC does. I have seen machine tool controller grounds driven at 120VAC relative to a building ground, so you were okay if you plugged your printer into the orange receptacle on the machine, but if you plugged it in anywhere else, your printer smoked. So I always use an isolator to protect the PC.



Mike Halloran
Pembroke Pines, FL, USA
 
Thanks for replies. I downloaded MTTTY terminal and hooked up a scope. Here is a picture of what I got when I was sending "5" constantly from MTTTY.

oscyloskop_1_fos9u3.jpg


As you can see the peak voltages are approx. 10V and - 10V I think that such voltages should be acceptable for robot controller. I also made a loopback on my cable and got back in the terminal every char that I sent. However I still can't manage to receive data on Fanuc Teach Pendant. Sometimes I get error "DSR off when transmission" but sometimes program just wait for ages at the line READ RS232(xs). Can anyone take a look at my code? Is it ok?

To check what is going on with this "DSR" errors I measured voltage on pin 20 in DB25 male connector (that is on Robot side). There is a about 0.8V there. As far as I know there should be some significant voltage supplying bridged 6 and 8 pins with proper signal. Maybe I should use a full, null modem cable with handshaking instead?
 
The best character for viewing on the wire is a lowercase 'u', which is all edges.

One of Keith's points was that you may have to actually implement the full handshake(s) instead of using arbitrarily bridged null modem cables. I agree; you need to fully read the interface specs of all involved devices in order to figure out what to do.


Mike Halloran
Pembroke Pines, FL, USA
 
Off hand I don't see anything wrong with your code though I'm not a Karel writer.

I would expect that Fanuc to require ALL handshake lines. Use a full modem cable NOT a null modem cable. I gave you a link already, showing the handshake lines you likely need. This all fits with your port appearing to transmit and loop back but waiting forever for a response.

Keith Cress
kcress -
 
Status
Not open for further replies.
Back
Top