SCX11 programming: displaying cycle count + sense motor stop

User avatar
om_tech_support_JT
Posts: 1057
Joined: Fri Mar 12, 2010 2:59 pm
Location: Torrance, CA
Contact:

SCX11 programming: displaying cycle count + sense motor stop

Postby om_tech_support_JT » Wed Oct 23, 2013 3:28 pm

Q: I'm using your SCX11 motion controller + your AR series closed-loop stepper motors for a life cycle test fixture I'm building. I'm in the stage of programming and I need some assistance since the information doesn't seem to be available in your literature. I'm using my own terminal software to communicate to the SCX11 via RS232 and sending ASCII from my terminal. For my application, I'm doing a 0 to 180 deg move, then back to 0 deg. I need to keep a count of # of cycles I'm doing since I intend to reach 1 million cycles for my test. I will need to query for the # of cycles from time to time, but more critically, if the motor stops for any reason, I need to know the # of cycles that it stopped at. So I need the SCX11 to output some ASCII when the motor stops for any reason. Can you point me in the right direction as far as how to do this?

FYI: I know that I can track the encoder pulses from the ASG/BSG outputs from the AR driver with a pulse counter of some sort, but I am trying to avoid buying this extra part to do the cycle count and conversion. I would prefer to see the cycle count from my terminal if possible.

A: Before we start writing the program, pleaes make sure to set up all system configuration parameters properly to match your motor/driver settings (such as motor resolution, user unit, sensor settings, driver alarm enable/disable, driver I/O settings....etc.). It does take some creativity to write this program since we may not state exactly how to do this in our literature.

The only way the SCX11 can tell if the motor stops is by connecting the alarm output signal from the driver to the SCX11. The AR motor will stop when any alarm conditions happen (there are many types). However, the normal method of connecting the alarm output (according to the manual) does not allow this to happen, so you'll have to connect that signal to one of the SCX11's general inputs (I/O connector instead of driver connector), then use a WHILE statement to display the # of cycles if the motor stops because of an alarm. However, with this method, our Immediate Motion Creator GUI software will not be able to sense the driver alarm, but it may not be necessary since you're using your terminal software; not our software. FYI the driver alarm output signal is normally closed. In order for the program example below to work properly, you also must wire the alarm output from the AR driver (pins 9 and 10) to the SCX11's IN1 (pins 9 and 1 on I/O connector). I picked IN1 by random. You can use any general input that's not being used or dedicated for a certain function. See SCX11 manual for general I/O wiring diagram and specific controller-driver wiring diagrams. Make sure you set the 24/5V, SINK/SOURCE switch correctly for the driver I/O. The general I/O can use either 5/24VDC and sink/source.

To keep a count within the SCX11, you'll need to set a variable. This can be a pre-defined variable from A to Z, or it can be a user-defined variable. For the example below, I will use A as the variable to keep the cycle count. You will need to use the LOOP command to begin a LOOP of 1 million cycles. Use MEND command to make sure the motion is finished before moving to the next line of program. Then I use a WHILE statement to check if the driver is alarming, and a SAS command to send ASCII from our SCX11 communication port to your terminal software.

Here's an EXAMPLE program that would maintain the cycle count with the "A" variable, and would send an ASCII string containing the count value to your terminal if the motor stops because of an alarm.

( 1) PC=0
( 2) VS=1000
( 3) VR=13888
( 4) TA=.1
( 5) TD=.1
( 6) A=0
( 7) LOOP 1000000
( 8) DIS=-500
( 9) MI
( 10) MEND
( 11) DIS=500
( 12) MI
( 13) MEND
( 14) WHILE (IN1!=1)
( 15) SAS NUMBER OF CYCLES:
( 16) A
( 17) ABORT
( 18) WEND
( 19) A=A+1
( 20) ENDL
( 21) END

You may have to make your alarm conditions more "sensitive" if you want more accuracy on the cycle count (or if you want the alarm to generate quicker). To do this, you can use an OPX-2A hand-held module or MEXE02 data setting software with the AR driver.

EXACT PROMPTS WHEN YOU RUN THE PROGRAM FROM A TERMINAL AND MANUALLY STALL THE MOTOR:
>RUN ARCHDAY
>NUMBER OF CYCLES:
>23

NOTE: It may be easier to test a program on our Immediate Motion Creator GUI software (which we provide with the SCX11), then use your terminal software once you confirm that the program works properly. The software has many functions which are useful during testing such as syntax check, easy upload/download features, pull-down menus, teach/jog functions, real-time I/O status, alarm history, encoder count, position count, and a TERMINAL tab which would simulate a terminal environment.

Let us know if you have any questions.

Return to “Stepping Motors & Controls”

Who is online

Users browsing this forum: No registered users and 2 guests