Welcome, Guest
Username Password: Remember me

TOPIC: Serial Commands to address and run the program in smart motors via RS232

Serial Commands to address and run the program in smart motors via RS232 4 years, 7 months ago #417

  • gwood24
  • OFFLINE
  • Posts: 15
  • Karma: 1
Hi,

I have 2 SM23156DT motors (drive enabled). I am using a Red Lion G306 HMI connected to the motors via 2 separate RS232 ports (not daisy chain). I would like to know the commands to send to the motor in order to address the motors individually (I'll arbitrarily assign the numbers) as well as run the program inside the motors.

I need to do this whenever the motor is powered on. Ideally, I'll have the HMI send raw serial commands to the motor. Question is:

What is the command to address the motor? Once that is complete, I'm assuming I can just send a "RUN" command to the motor via the RS232 connection?

Thank you in advance for your help. Much appreciated.
Last Edit: 4 years, 7 months ago by gwood24.

Re: Serial Commands to address and run the program in smart motors via RS232 4 years, 7 months ago #420

  • csearcy
  • OFFLINE
  • Posts: 480
  • Karma: 23
The program in the motor will RUN when power is applied, unless the program has the RUN? command.

The command to set the address of the motor is SADDRx.

You can combine the two if you want the motor addressed, but you don't want the program to run yet.

Example:

SADDR2 'Set motor address
RUN? 'Wait for RUN command to be issued from host.
MP 'Set motor to position mode
.
.
END

Re: Serial Commands to address and run the program in smart motors via RS232 4 years, 7 months ago #422

  • gwood24
  • OFFLINE
  • Posts: 15
  • Karma: 1
Ok, I could essentially put that code at the beginning of my program to address the motor on startup. However, since I have two motors and they run exactly the same program, I'd rather not hard code the motor address directly in the program.

Is there a way based on I/O wired connection to the motor, to determine what the address should be based on connections wired directly to the motor's I/O?

Example, I have two motors, one with pins 7 and 8 connected... this would get address x. If the motor was to have its wiring changed, to pins 9 an 10 that would constitute address 2?

Reason for doing this is so that I can have a hot spare motor that could be put into our machine with either an address of 1 or 2 depending on how we wire them? This assumes SM23165DT (drive enabled) motor with DB-15 D-Sub connector
Last Edit: 4 years, 7 months ago by gwood24.

Re: Serial Commands to address and run the program in smart motors via RS232 4 years, 7 months ago #423

  • csearcy
  • OFFLINE
  • Posts: 480
  • Karma: 23
The I/O ports on your motor are pin1-pin7. Pin13 is GND.
1. Connect pin1 to pin13 on Motor1's 15pin connector.
2. Connect pin2 to pin13 on Motor2's 15pin connector.

Here is the code that will set the address...

IF IN(0)==0 SADDR1 ENDIF
IF IN(1)==0 SADDR2 ENDIF
The following user(s) said Thank You: gwood24

Re: Serial Commands to address and run the program in smart motors via RS232 4 years, 7 months ago #424

  • gwood24
  • OFFLINE
  • Posts: 15
  • Karma: 1
Thank you for the quick reply. I'll try that.

Re: Serial Commands to address and run the program in smart motors via RS232 4 years, 7 months ago #425

  • gwood24
  • OFFLINE
  • Posts: 15
  • Karma: 1
I've proven that the motor program is running and is addressing the motor correctly, however, the Red Lion HMI cannot communicate with the motor after a power cycle unless we disconnect the motor from the HMI and connect the motor to the computer and run the communication wizard to establish comms between the motor and the PC. After we establish comms between the PC and the motor, we can then disconnect the motor from the PC and then reconnect the motor to the HMI and instantly the HMI sees and communicates with the HMI.

So, the question is, what bit is the SMI software's communications wizard, changing in the motor. This software HAS to be changing something in the motor to enable comms between the motor and the HMI. If I knew what bit, I could have that included in my motor program to eliminate the need to connect to the PC before comms can be established with the motor and the HMI.
Last Edit: 4 years, 7 months ago by gwood24.
Moderators: hsummer, csearcy
Time to create page: 0.56 seconds