Daisy-chain RS232 -...
 
Notifications
Clear all

Daisy-chain RS232 - Motor 1 not receiving commands from Motor 2

10 Posts
1 Users
0 Reactions
22.6 K Views
(@Solidified3d)
Posts: 3
New Member Guest
Topic starter
 

Hello all,

I'm using 2 motors (SM23165DT and SM23165D as Motor 1 and Motor 2, respectively) over an RS-232 daisy-chain. There's one analog input being fed into the 15-pin D-sub on Motor 2. Right now I'm just running everything through the SMI Terminal. It's a very simple X- and Z-axis table, with a down-right-up-left movement repeated for a predetermined number of cycles. The motors never need to move at the same time, so I have separate programs in each motor that just use the RS-232 line to start the next motor moving when they're finished (using something like PRINT(#130,"GOTO23",#13), for instance).

My issue is that Motor 2 is happy to respond to those commands from Motor 1, but when it sends out commands, they show up in the SMI Terminal, but Motor 1 does not respond to them. When I type those same commands into the terminal, Motor 1 will respond. I'm guessing that they're not being echoed from the computer to Motor 1, but both motors and SMI have ECHO turned on. Any suggestions, short of using some other program on the computer that will control both motors?

Apologies for any gross or obvious errors in this setup; both servos and serial communication are newer topics to me.

Thanks in advance.

-J

 
Posted : 07/03/2014 6:01 am
(@csearcy)
Posts: 316
Reputable Member Guest
 

What you are seeing is normal for the RS232 daisy chain. Motor1 can send commands to Motor2, but Motor2 cannot send commands to Motor1. This is due to the way the daisy chain is wired.

Here's what you can do. On the 15-pin connectors, connect pin-5 to pin-5, pin-6 to pin-6 and pin-13 to pin-13. Open the secondary RS485 port in each motor with the following command...

OCHN(RS4,1,N,9600,1,8,C) 'Open ports 4 and 5 as RS485 channel 1.

Now.. change your PRINT commands to PRINT1. RS485 will allow commands in both directions.
ex. PRINT1(#130,"GOTO23",#13)

 
Posted : 07/03/2014 11:12 am
(@Solidified3d)
Posts: 3
New Member Guest
Topic starter
 

What you are seeing is normal for the RS232 daisy chain. Motor1 can send commands to Motor2, but Motor2 cannot send commands to Motor1. This is due to the way the daisy chain is wired.

Here's what you can do. On the 15-pin connectors, connect pin-5 to pin-5, pin-6 to pin-6 and pin-13 to pin-13. Open the secondary RS485 port in each motor with the following command...

OCHN(RS4,1,N,9600,1,8,C) 'Open ports 4 and 5 as RS485 channel 1.

Now.. change your PRINT commands to PRINT1. RS485 will allow commands in both directions.
ex. PRINT1(#130,"GOTO23",#13)

OK, I thought that may be the case with the daisy chain. I will give the RS485 a shot. Thanks for the help.

 
Posted : 10/03/2014 4:14 am
(@Solidified3d)
Posts: 3
New Member Guest
Topic starter
 

Everything works wonderful with the RS-485. Thanks again for your help, csearcy.

 
Posted : 13/03/2014 10:25 am
(@UHVmotion)
Posts: 2
New Member Guest
 

Hi.
I had a similar problem using RS232 comms between two SM23165D motors and followed your advice, re wiring pins 5,6 & 13. I then wrote a little bit of test code to try out the comms using the 'OCHN(RS4,1,N,9600,1,8,C)' command at the beginning of each motors code. My comms were not successful...
Can any-one post a very simple program that I can use to check my motor comms please?

Also, what is the best way to hold the program in motor 2 until it is called by motor 1. Can I use a while loop and jump over it with a GOTO command from motor 1?

Cheers.

 
Posted : 07/08/2014 1:11 am
(@csearcy)
Posts: 0
New Member Guest
 

If you have two motors connected via RS232 and can connect to them with the SMI software, you can test the RS485 connection in the Terminal Window of SMI.. if you have the two motors connected like you said(pins 5,6 and 13). You should first download a program to each motor that opens their RS485 port with the OCHN command as you specified. You should also give the motor an address.

'Ex. Motor1
SADDR1
OCHN(RS4,1,N,9600,1,8,C)
END

'Ex. Motor2
SADDR2
OCHN(RS4,1,N,9600,1,8,C)
END

Using the SMI software Terminal Window, type a command from Motor1 to Motor2 via RS485...

1PRINT1(#130,"a=123",#13)

Then check the variable "a" in Motor2...

2Ra

You should get 123 back.

As for program flow control between two motors via RS485... Have the program in Motor2 loop until Motor1 changes a variable...

C10
a=0 'Clear out a handshake variable.. which can be set to 123 using the PRINT1 example above

'Do something... and wait for Motor1 to let me move on

WHILE a!=123 LOOP
PRINT1(#129,"a=123",#13) 'Set variable a in Motor1 to 123 as a handshake
RETURN

 
Posted : 07/08/2014 8:47 pm
(@UHVmotion)
Posts: 2
New Member Guest
 

Hi.
Thanks for that.
I double checked the wiring of the motors as detailed and used your little program in both motors.
When I send the command you suggested in the terminal window 2Ra returned 0, not 123. I also checked the comms the other way sending 2PRINT1(#129,"a=123",#13). 1Ra returned 0 also.

I am seeing something a bit weird going on with my I/O on pins 5 and 6. They are constantly held at 1 and 0 respectively no matter what I do with them. I can try and force their values using OR & OS commands but they do not change.

Have you seen this before? Is there anything I can try?

N

 
Posted : 07/08/2014 11:46 pm
(@csearcy)
Posts: 0
New Member Guest
 

Try clearing the EEPROM, then try to turn the I/O off and on. It could be that pins 5 and 6 are damaged. Try others to see if they exhibit the same problem.

 
Posted : 08/08/2014 10:32 am
(@Antoine)
Posts: 6
Active Member Guest
 

Hi,

If I have more than 2 motors in my RS232 chain, how can I do?
Do I simply have to connect all pins 5, 6 and 16 of all motors?

Thanks

 
Posted : 31/10/2014 6:20 am
(@csearcy)
Posts: 0
New Member Guest
 

Connect pins 5 to 5, 6 to 6, and 13 to 13 on all motors and add the following command to each motors program to open the RS485 ports. Then you can use the PRINT1 commands to exchange data between motors.

OCHN(RS4,1,N,9600,1,8,C) 'Open RS485 port at 9600

Note: Make sure not to use any commands that affect I/O 4 and 5 (pins 5 and 6)... such as any of the following.

EIGN(4)
EIGN(5)
OR(4) or OS(4)
OR(5) or OS(5)

 
Posted : 31/10/2014 9:30 am
Share: