Hi,
I have motors connected in RS232 chain.
When I try to retrieve variables from motor 2, I type for exemple x=a:2 (if I want to get variable a from motor 2 in variable x from motor 1), but nothings happens: x remains at 0 value.
Is there a way to get variables easily?
Thanks
Antoine
The commands like x:2=a are only available with the -C and -DN options that add a CANbus port to the motor. The RS232 commands can only go from Motor1 to Motor2, not from Motor2 to Motor1.
The workaround you may want to use is to open the RS485 ports on each motor. You will need to wire pins 5 to 5, 6 to 6, and 13 to 13 for this to work, and add the following instruction to each motor program.
OCHN(RS4,1,N,9600,1,8,C) 'Open RS485 port at 9600
Example of motor1 sending commands to motor2...
PRINT1(#130,"GOSUB(10)",#13) 'run subroutine 10 in motor2
Example of motor2 sending commands to motor1...
PRINT1(#129,"GOSUB(10)",#13) 'run subroutine 10 in motor1
PRINT1(#129,"a=",x,#13) 'set motor1's variable a equal to motor2's variable x
Hi,
Thanks for this reply!
I wired everything and entered the command to open port on each motor programm but I am unable to send any command from one motor to the other (PRINT1...).
I tried to put ECHO1, Echo_OFF1, turn off channel 0...
At the end of each programm, I re close the channel 1 to be able to use PC interface to check if commands to change variables were well recieved.
Do you have an idea?
Thanks
Can you paste your program here, so I can see the commands you are using?
Hi,
Here is one of tatest things I tried:
Here I tried to close port 0 and then reopen at the end to able to check variables from terminal
Thanks for your help
RUN?
EIGN(2)
EIGN(3)
ZS
MP
ADDR=1
CCHN(RS2,0)
OCHN(RS4,1,N,9600,1,8,C) 'Ouverture port RS485
ECHO1 'tester echo off et on pour voir effet, tester ecritures de variables sans interruptions
C1
PRINT1(#130,"kk=",a,#13)
WAIT=1000
CCHN(RS4,1)
OCHN(RS2,0,N,9600,1,8,C)
PAUSE
Hi,
The code looks ok, though I would remove the ECHO1, as it's not really supported on RS485. You don't need to close the RS232 port. You can have both RS232 and RS485 open at the same time.
What you may want to try is adding a 470ohm resistor between pin6 and pin13 on one of the 15pin D-Sub connectors. I have had to add this resistor in the past to properly bias the RS485 network.
I hope this helps!
-Chuck