![[Logo]](gif/logo.gif)
Suppose we want a row of equally spaced holes punched into some raw stock, which is fed into our machine in continuous strips. The spacing of the holes and the number of holes should be variable for any run of pieces. The stock should be cut into strips with a length that depends on the number of holes and spacing, and the operation should be repeated until the CY545 is signaled to stop.
The capabilities of the CY545 make this problem fairly easy to solve. The command sequence shown below can be used to implement all the functions required. The command sequence can be located in external memory, where the CY545 can directly read and execute the program. The variable information, for the number of holes and spacing between them, can be read from thumbwheel switch inputs. The user selectable function bits act as control and test signals to guide the program. When the operation is complete, the CY545 will stop the program and wait for more commands.
In the following command sequence, memory addresses have been shown for your convenience. They are not sent to the CY545 or recorded in the memory. Counting the bytes as the commands are written makes it easier to determine the addresses for program jumps.
The example program consists of several sections. First, the stepping performance parameters are set, and the current position is cleared to zero. This position could also be found by a Home command, if the application requires a move to a known reference position.
Next, the CY545 waits for a signal that indicates stock is available. This is tested on User Bit 3. When stock is available, the CY545 moves the motor 200 steps from the initial position. Notice that this move is fixed by the command in the program. Here the first move is always 200 steps.
Now the CY545 reads the external thumbwheel switches for the number of steps to move between punching holes. This number replaces the 200 in the Number of Steps Register.
At this point, the CY545 punches the first hole, signaled by User Bit 1. When the bit goes low, the punch is activated, and when it goes high, the punch retracts. Delays are placed around the activation and deactivation to allow for settling time and time to perform the punching operation.
The CY545 continues by moving to the next hole position, as previously set by the N #<cr> command. It then executes the Loop command, which reads the repeat count from external thumbwheel switches, and jumps back to the Delay instruction at the start of the hole punch sequence. This sequence is repeated until the count is exhausted, and the specified number of holes has been punched.
Y 100<cr>.............Select
external memory or location
E<cr>.................Write the following
commands to memory
100.....R 175<cr>..........Commands
will start at address 100
106.....F 12<cr>...........First
set up stepping parameters
111.....S 200<cr>
117.....A 0<cr>............Declare
current position as zero
121.....W 3<cr>............Wait
for Bit 3 high, stock is available
125.....N 200<cr>
131.....+<cr>
133.....G<cr>..............Move
200 steps before first hole punch
135.....N #<cr>............Read
hole spacing from external switches
139.....D 250<cr>..........Delay
250 msec, let stock settle into place
145...../B 1<cr>...........Activate
punch with Bit 1 low
150.....D 1000<cr>.........Delay
1 sec to punch hole
157.....B 1<cr>............Turn
off punch
161.....D 100<cr>..........Wait
for punch to clear work stock
167.....G<cr>..............Move
to next hole position
169.....L #,139<cr>........Repeat
punches as set by external switches
177.....D 250<cr>..........Delay
250 msec, let stock settle into place
183...../B 1<cr>...........Activate
punch for last hole in piece
188.....D 1000<cr>.........Delay
1 sec to punch hole
195.....B 1<cr>............Turn
off punch
199.....D 100<cr>..........Wait
for punch to clear work stock
205.....N 200<cr>
211.....G<cr>..............Move
200 steps after last hole punch
213.....D 250<cr>..........Delay
250 msec, let stock settle into place
219...../B 2<cr>...........Cut
stock off with Bit 2 low
224.....D 1500<cr>.........Delay
1.5 sec to cut stock
231.....B 2<cr>............Turn
off cutter
235.....D 150<cr>..........Wait
for cutter to clear work stock
241.....P 0<cr>............Return
to starting location
245.....T 4,121<cr>........Repeat
operation until Bit 4 is high
253.....0<cr>..............Stop
running program now
Q<cr>.................Quit saving commands to memory
Y 100<cr>.............Reset
memory address to start of program
X<cr>.................Execute the above
program
![[Command Sequence and Memory Addresses - 2]](gif/545-74.gif)
Notice that every character of a command takes one memory location, and all characters must be counted to compute the target address for the Loop command.
The program then punches a hole at the last position, moves an additional 200 steps, and activates the User Bit 2 signal to cut the strip.
Now the CY545 returns the motor to the starting position. It then tests User Bit 4, and if the signal is low, the program repeats from the Wait instruction. If the signal is high, the program stops with the Zero command, and the CY545 returns to the command mode.
The CY545 provides the timing and logical signals necessary to control a stepper motor. However, to make a complete system, a driver circuit must be added to the CY545. This circuit will take the logical signals generated by the CY545 and translate them into the high-power signals needed to run the motor.
The user has two choices in the selection of driver circuits. Existing designs, usually in the form of pulse-to-step translators, may be used, or special designs may be created. Translators usually require a pulse and direction input, or two pulse streams, one for CW stepping and one for CCW stepping. The translator takes the pulse inputs and generates the proper four-phase outputs for the motor. Note that it is also possible to drive motors with this scheme which are not four-phase designs. Since the translator generates the actual motor driver signals, it only requires the pulse timing and direction information generated by the CY545 PULSE and CCW signals. This allows the CY545 to control three and five-phase motors as well as the standard four-phase designs.
![[Translator Driver connections]](gif/545-75.gif)
If the user opts for his own driver design, the PULSE and CCW lines may be used to drive a counter circuit, which counts up or down once for each pulse, based on the level of the CCW signal. The counter output then drives the address lines of a memory device, such as a PROM, EPROM, or EEPROM, with data outputs that generate the desired motor phase patterns as the counter address steps through the PROM locations. This design is shown here.
![[Motor Phase Generation Circuit]](gif/545-76.gif)
The data outputs from the PROM are then connected to the power driver circuit itself, generating the proper phase patterns for the motor. Note that such a design not only handles motors of various phases, but can also implement stepping schemes such as half-step or quad-step, as well as the standard full-step pattern.
The following paragraphs are meant as a guide to various types of driver circuits, but should not be used as final driver designs. Detailed switching characteristics, transient suppression, and circuit protection logic have been omitted for clarity and simplicity.
Unipolar designs are the simplest drivers, and are generally useful when running at less than 600 steps per second. These designs require motors with six or eight leads, since the power supply is connected to the middle of each winding. The end of each winding is pulled to ground through a transistor controlled by one of the phase output lines from the data PROM.
Motor performance may be improved by adding a dropping resistor between the power supply output and the center tap of each winding. This decreases the field decay time constant of the motor, giving faster step response. The performance increase is paid for by a higher voltage power supply and heat losses through the dropping resistors. This type of circuit is know as an L/xR circuit, where the x represents the resistor value relative to the winding resistance. An L/R circuit would not have any external resistors, while an L/4R circuit would use a resistor of three times the value of the motor winding resistance. Note that the power supply could be four times the nominal motor value with this circuit. Also note that this circuit requires only a single voltage and one transistor per phase.
![[Unipolar driving circuits]](gif/545-77.gif)
The second basic type of driver circuit is the bipolar design. In this case, the motor is driven only from the ends of each winding, with switching logic used to control the direction of current through the winding. These circuits may be implemented with a four lead motor, since only the ends of each winding are needed.
Bipolar designs are more efficient in driving the motor, and result in higher performance than the unipolar designs. There is also some gain in torque, since the entire winding is always driven, unlike the unipolar design, in which only half of a winding is used at a time.
Two methods of switching the direction of current may be used. With a single voltage power supply, eight transistors are used, two per phase. Transistors are turned on in alternate pairs across each winding to control the current. The second alternative uses only four transistors, but requires a dual voltage power supply. In this case, one side of each winding is connected to ground, and the other side is switched between the positive and negative power supplies. In both designs it is very important to insure that both transistors on one side of the winding are not on at the same time, as this would short the power supply through the transistors, generally destroying the transistors in the process. Protection logic is usually included to insure that one transistor is off before the other is allowed to turn on.
![[Bipolar designs]](gif/545-78.gif)
The most advanced driver designs are variations on the unipolar or bipolar types, although they are generally implemented using the bipolar approach. These drivers are capable of the highest step rates attainable. They work by switching current or voltage through the motor at much higher than the rated value. This is done for only a short period of time, causing the magnetic field in the motor to change very quickly, without exceeding the maximum power dissipation of the motor. As long as the average dissipation does not exceed the motor rating, the motor will perform without problems. Once the maximum limit is reached, the motor may overheat and self destruct.
One technique for increasing motor performance would simply apply a high voltage to the motor at the beginning of each step. This makes the motor react very quickly to the change in phase signals. After a short period of time, the voltage is switched to a lower value, allowing the motor to continue it’s step without overheating.
A second approach, known as a constant current design, senses the amount of current flowing through the winding, and adjusts the voltage applied to the motor to maintain the current at its maximum rated value. At the beginning of a motion, the voltage would be low, with a constant adjustment to a higher value as the motor speed increases, and back EMF decreases the current draw for a fixed voltage level.
Another technique, known as chopping, may also be applied to these driver designs. This approach applies a voltage much higher than the rated value for a short period of time. The voltage is then turned off for another time period. This occurs many times per step, with the frequency of switching known as the chopping frequency. This frequency may be controlled by time, switching at a given rate, or it may be controlled by sensing the current flow through the motor, switching at a variable rate. This switching technique controls the power dissipation of the motor, keeping it at maximum torque for any step rate, by adjusting the average applied power. The highest performance drivers are usually designed as bipolar chopper circuits.
The user should consult design guides available from the various motor manufacturers and driver circuit designers for additional information.
In the example shown in Figure 19.9 below, the CY545 is operating in the parallel ASCII input mode. In this mode, bit 7 is always zero and b7 line of the CY545 data bus may be tied to ground. Since the user will normally transfer bytes of data from memory to the output port, the most significant bit of the data byte may be used to generate the IO_REQUEST strobe, thus allowing only one 8 bit output port to suffice. Of course, a separate port line may be used to generate IO_REQUEST, if desired. If the CY545 is operated in the parallel BINARY mode, all 8 data bus lines are used, and a separate IO_REQUEST line is required. Note that in the example shown, use is made of the fact that the data and the IO_REQUEST signal may be applied simultaneously in parallel operation. If query commands are to be used, all 8 bits of the data bus must be free to operate bidirectionally. In this case, it is generally best to make IO_REQUEST a separate line from the data ports.
![[Interface to CY545 using 8255 PIO]](gif/545-79.gif)
In systems where multiple CY545s are to be controlled by a host computer it is possible to use one eight-bit port to establish a common data bus for sending instructions to the CY545s. Each of the separate BUSY lines (pin 15 of each CY545 must be monitored individually and each IO_REQUEST line (pin 13) must be activated separately. This technique effectively uses the IO_REQUEST line as a chip select (CS). A CY545 will ignore all bus information if its IO_REQUEST line is inactive.
![[Sharing common data bus]](gif/545-80.gif)
Two
CY545s, executing similar programs from external memory, may be synchronized
as shown in the figure below (Synchronization of two CY545s). The master
controller can control a USERBIT line of the slave CY545 via the Bit command,
to set or clear a user bit. The slave CY545 is started first, with an Execute
command, and executes a Wait command and waits until the USERBIT line is
driven low by the Bit command executed by the master CY545, when it receives
the (second) Execute command. Both CY545s then proceed to the next instruction
and are synchronized as shown in the timing diagram, to within several
tens of microseconds. Note that when the two programs are not identical,
the master can also use a Wait command, while the slave executes its own
Bit instruction, to achieve a more general synchronization.
![[Hardware Synchronization]](gif/545-82.gif)
![[Software Synchronization]](gif/545-83.gif)
Multiple CY545s may be synchronized to each other by use of the programmable User Bits, the Wait commands, Til commands, and time delays. These may also be combined with other signals, such as CCW, SLEW, or STOPPED, used to select the point in the motion when the signal is presented to the waiting controller. Consider a general parts handling function in which the part must be handed off between two controllers. The geometry of the parts and the arms used to carry the parts requires that the hand off be carefully synchronized between the two controllers. The one to receive the part waits at the receiving position until the CY545 which has the part signals that it has arrived. The two arms then move together in a coordinated motion, reaching a point at which the distance between them is a minimum. The part is exchanged and the arms move apart, again in a coordinated motion. Once a certain position is reached, the arms are free to move independently, and continue with their assigned programs. If the motion is repetitious, both controllers can work with the same program, always being resynchronized at the hand off. The following program illustrates such a motion.
![[Program]](gif/545-84.gif)
The use of the “loop TIL” instruction is illustrated in the following example. The program loops until the USERBIT 1 line (pin #22) goes high, then fetches the next instruction. The effect of the INHIBIT_ABORT input on the STOPPED output is also shown.
![[Looping]](gif/545-85.gif)
PRESET:
.....B 16<cr> ........clear
USER BIT O Line
.....R 90<cr>.........set
RATE = 90
.....S 200<cr>
.......set SLOPE = 200
.....F 10<cr>.........set
FIRSTRATE = 10
.....N 3<cr> .........set
NUMBER steps = 3
.....Y 100<cr>........set
memory address
ENTER PROG:
..........E<cr>
..........B 0<cr> ..........set
USER BIT 0
PROGRAM...+<CR>.............set
CW direction
CODE......G<cr>.............GO,
begin stepping
..........B 16<cr>..........clear
output line
..........-<cr>.............set
CCW direction
..........G<cr>.............GO,
begin stepping
..........T 1,100<cr>.....
.repeat above prog Til USER BIT 1 = HI
..........B 0<cr>...........set
USER BIT 0 line
..........B 16<cr>..........clear
USER BIT 0 line
..........0<cr>.............stop
run mode, enter command mode
QUIT: ....Q<cr>
EXECUTE: .Y 100<cr>.........reset
pointer
..........X<cr>.............EXECUTE
The following command sequence illustrates a simple motion with trigger signals. First we toggle USER BIT 0, then we set the stepping parameters, and finally take five steps. In the ASCII command mode, the command sequence is as follows:
B 16<cr> .......USER BIT 0
low
B 0<cr> ........USER BIT 0 high
R 100<cr> ......set Rate
S 240<cr> ......set Slope
F 15<cr> .......set First Rate
N 5<cr> ........set Number of steps
G<cr> ..........take five steps
If the same sequence is issued in the Binary command mode, the command letters are the same, but the data values are given to the CY545 in binary form, not as ASCII decimal values. In the Binary command mode, the equivalent sequence is:
42 01 10 .......USER BIT 0 low
42 01 00 .......USER BIT 0 high
52 01 64 .......set Rate 100
53 01 F0 .......set Slope 240
46 01 0F .......set First Rate 15
4E 03 05 00 00 .set Number of steps 5
47 00 ..........take five steps
All values are listed as their hexadecimal equivalents, but are sent to the CY545 as single 8-bit data values. Command letters have the same codes as in ASCII, but parameters require a count, followed by the binary parameter value. Notice that multi-byte parameters are sent least significant byte first.
The resulting waveforms are shown below. The CY545 behavior is the same in both ASCII and Binary modes, but the number of data bytes sent to achieve the results is different. Also, Binary mode commands will execute somewhat faster, since the CY545 converts ASCII parameter values into a binary format internally, taking additional command execution time.
![[Motion waveforms]](gif/545-86.gif)
00 Contents ..|..
01 Intro ..|..
02 Pins & Packages ..|..
03 Cmd Interfaces ..|..
04 Commands..|..
05 Motor Cmds
06 Bit Cmds..|..
07 Memory Cmds..|..
08 Prog Branch Cmds..|..
09 Mode Cmds ..|..
10 Misc Cmds
11 Circuits ..|..
12 External Memory ..|..
13 Thumbwheel Switch
..|.. 14 Output
Display ..|..
15 Proto Boards
16 Timing & Control
..|.. 17 Rate
Tables ..|..
18 Electrical Specs ..|..
19 Examples ..|..
20 Up & Running
Back to CY545 Data Sheet
© 1988 - 1999 Cybernetic Micro Systems, Inc.
All rights reserved.
CY545 Manual 22MAR99