Through
the two pins, A and B, of the I/O connector, quadrature or step and
direction signals can be fed into the SmartMotor at high speeds and be
followed by the motor itself. This feature brings about the following
capabilities:
1) Mode Follow
2) Mode Step and Direction
3) Mode Follow with ratio
4) Mode Step and Direction with ratio
5) Mode Cam
In
addition to the above embedded modes of operation, the internal counter
can be set to either count encoder signals or step signals and be
accessible to the internal program or a host through the CTR variable.
When
the SmartMotor is in one of the above five modes it may also run
internal programs and communicate with a host, all at the same time.
MF1,
MF2 and MF4 Mode Follow
Mode
Follow allows the SmartMotor to follow an external encoder. In addition
to being read in full scale (MF1), the incoming quadrature wave can be
read by the internal hardware in 2x (MF2) as well as 4x (MF4) resolution.
MF0,
MS0
The
MF0 and MS0 commands must not be issued during one of the other follow
modes. They are used for an entirely different purpose. If you do not
want to directly follow an incoming encoder or step signal, but rater
just want to track them and use the counter value within your own program
or from a host, then issuing MF0 or MS0 utilizes the maximum resolution
available and makes the value available through the CTR function. Issuing
MF0 or MS0 will zero that variable and incoming encoder or step signals
will increment or decrement the signed, 32-bit CTR function value.
MFDIV=expression Set
Ratio divisor
MFMUL=expression SetRatiomultiplier
where -256.0000 < Ratio < 256.0000
After
the appropriate MF# command is issued, or the MS command has been issued,
a floating point ratio can further be applied by the firmware. Since the
SmartMotor is an integer machine, that floating point ratio is
accomplished by dividing one number by another.
MFR Calculate
Mode Follow Ratio
MSR Calculate
Mode Step Ratio
Once
a numerator and denominator have been specified, and the appropriate
hardware mode is selected, the motor can be put into ratio mode with the
MFR or MSR commands (MSR for ratioing incoming step and direction
signals). The following example sets up a 10.5:1 relationship:
MF4 ‘Read in full res.
MFMUL=2 ‘10.5:1=21:2
MFDIV=21
D=0 ‘be sure D is zero
MFR ‘Invoke calculation
G ‘Start
Once
in a ratio mode the V=# and D=# commands will still work. They will
invoke a phase shift of length D at a relative rate determined by V. For
that reason, you must zero out D before issuing an MFR or MSR command or
you could find unexpected shifting taking place. In applications such as
a Web Press, this ability to phase shift can be very useful.
MC Mode Cam
A
cam is a basically round but irregular shape that rotates and causes a
follower to move up and down in a profile determined by the shape of the
cam's exterior.
Since
the beginning of industrialization, cams have been used to create
complex, reciprocating motion. Cams are most often carved out of steel
and changing them, or having them invoke motion a great distance away are
impractical. The SmartMotor provides an electronic alternative. Putting
an encoder on the rotating part of a machine, sending the signals to a
SmartMotor and programming the cam profile into the SmartMotor allows
for the same complex, repeating motions to be accomplished, without any
of the typical mechanical limitations.
BASE=expression Base length
Part
of defining a Cam relationship is specifying how many incoming encoder counts
there are for one full cam rotation. Simply set BASE equal to this number.
SIZE=expression Number of Cam data entries
The
upper variable array space holds the cam profile data. To instruct the
SmartMotor as to how many data points you have specified, set SIZE equal
to that number. The cam firmware looks at words (16 bit numbers). The
maximum number of words you can use is 100. The cam firmware will perform
linear interpolation between those entries, as well as between the last
and the first as the cam progresses through the table and back to the
beginning. The cam table entries occupy the same space as variables aa
through yyy. Set the values in the following way:
aw[0]=1234
aw[1]=3456
...etc.
MD50 Drive Mode
The
MD50 command causes the SmartMotor to emulate a traditional servo and
amplifier so it can be used with yet another controller sending a
standard +/-10Volt analog command signal. A small voltage divider is
necessary to convert the +/-10 volts into the 0 to 5 volt signal the
motor takes an additional device may be desired to take the single ended
encoder signals coming out of the SmartMotor and make them differential
for more noise immunity during their travel back to the external
controller.
The
following binary values can be tested by IF and WHILE control flow
expressions, or assigned to any variable. They may all be reported using
RB{bit} commands. Some may be reset using Z{bit} commands and some are
reset when accessed. The first 8 states are reported in combination by
the RS command. RW reports sixteen of these flags in combination.
By
writing your program to periodically test these bits, you can make your
SmartMotor application very smart" about its own inner-workings and
doings.
Bo Motor off
status bit 7
Bh Excessive temperature status
bit 6
Be Excessive position error status bit 5
Bw Wraparound occurred status
bit 4
Bi Index report available
status bit 3
Bm Real time negative limit
status bit 2
Bp Real time positive limit status bit
1
Bt Trajectory in progress
status bit 0
Ba Over current state occurred
Bb Parity error occurred
Bc Communication overflow occurred
Bd User math overflow occurred
Bf Communications framing error occurred
Bk Program check sum/EEPROM failure
Bl Historical left limit
Br Historical right limit
Bs Syntax error occurred
Bu User array index error occurred
Bx Hardware index input level
If
you do take action based on some of the error flags, you will need to
reset the flag in order to look out for the next occurence, or in some cases
depending on how your code is written, in order to keep from acting over
and over again, on the same occurence. The flags that need to be reset
are listed. Their letter designator is preceded by the letter Z.
Reset system state flags
Za Reset over current violation occurred
Zb Reset parity error occurred
Zc Reset com overflow error occurred
Zd Reset user math overflow occurred
Zf Reset communications framing error occurred
Zl Reset historical left limit occurred
Zr Reset historical right limit occurred
Zs Reset syntax error occurred
Zu Reset user array index error occurred
Zw Reset wraparound occurred
ZS Reset all Z{bit} state flags
The
TWAIT command pauses program execution until motion is complete. Instead
of using TWAIT, a routine could be written that does much more. To start
with, the following code example would perform the same function as TWAIT:
WHILE Bt ‘While trajectory
LOOP ‘Loop back
Alternatively,
the above routine could be augmented with code that took specific action
in the event of an index signal as is shown in the following example
WHILE Bt ‘While trajectory
IF
Bi ‘Check index
GOSUB500 ‘take care of it
ENDIF ‘end checking
LOOP ‘Loop back