.Several commands allow you to specify which User Selectable Bits are used by the command. The CY545 has at least six general purpose signals available, even if all hardware support options are used. More bits are available when some hardware support, such as the Hewlett Packard LED display, the CY233, or the parallel interface are not used. Each of these commands includes a parameter which specifies which bit or combination of bits to use with the command. The specific values are discussed with the relevant commands.
One command allows you to set or clear specified bits. It is:
B Bit Set or clear specified bits
When in the ASCII mode, this command also allows a special format, using a complement prefix to mean the inverted value of the specified bit parameter. The prefix is the “/” character, and is used as follows:
B 2<cr> Set User Selectable Bit 2 high /B 2<cr> ...Clear User Selectable Bit 2 low
The same function may be performed by the bit parameter value. When a “/” character is detected, it simply complements the fourth bit of the bit value parameter, so the same functions as above can be specified by:
B 02H<cr> Set Bit 2 B 12H<cr>.. Clear Bit 2
The “/” character is equivalent to performing an exclusive OR (XOR) of the bit number parameter and the value 10H (16 decimal).
The value of the Bit parameter will determine what action to take, as follows:
00H to 07H .....(
..0-7)....Set one of user bits 0 to
7
08H to 0FH .....( .8-15)...
Set one of data bus bits 0 to 7
10H to 17H .....( 16-23)....Clear
one of user bits 0 to 7
18H to 1FH .....( 24-31)....Clear
one of data bus bits 0 to 7
20H to 3FH .....( 32-63)..
.(Same as 00H to 1F)
40H to 7FH .....( 64-127)...Set
user bits 0 to 5 at one time
80H to 0BFH.....(128-191)...AND
user bits 0 to 5
0C0H to 0FFH....(192-255)...OR
user bits 0 to 5
As seen from the above values, the bit argument is composed of an “opcode” part and an “operand” part. The general coding of bit arguments is shown below:
![[Figure 6.1]](gif/545-13.gif)
The 00 opcode specifies that one bit is to be operated on. The three least significant bits identify the bit, while two other bits specify the bit group (user or data bus) and the operation (set or clear). One argument bit is not used in single bit operations.
If the opcode is non-00, then all six bits are operated on as a group, with the relevant opcodes shown below.
![[Figure 6.2]](gif/545-14.gif)
The actual application will constrain the number of User Selectable bits that are available. When all features of the CY545 are used, only User Selectable bits 0 to 5 are available for general purpose functions. If the CY233 is not used, or the parallel Hewlett Packard LED display is not used, bits 6 and/or 7 will also be available. Finally, if the parallel command interface is not used, and there is no local memory or HP LED display, the CY545 data bus lines will also be free, and can be addressed as bits 8 to F of the Bit command. These special function lines can only be tested or changed on an individual basis.
NOTE: Setting or clearing these Special Function bits when associated hardware is present could cause unwanted interactions between the CY545 and the hardware. Also, the CY545 will change the values on these signals as required for normal support of the hardware. Be sure to manipulate only those signals that are available to the application.
Since User Selectable bits 0 to 5 will always be available to the application, they can be treated as a group, rather than as individual signals. The most significant two bits of the Bit command parameter value indicate this selection. If any of these two bits is a 1, the lower 6 bits of the value are treated as a group to modify USRB0 to USRB5 all at once. Options are to set all six bits at once, as specified by the parameter value, to logical AND the parameter value with the six bits, and to logical OR the parameter value with the six bits.
Two CY545 commands use the bits for special testing functions. They are:
T Bit,Addr Jump to address until bit matches value
W Bit........ Wait for bit to match value
For these commands, the bit value parameter is treated as follows:
00H to 07H.. ..Test one of user bits 0 to 7 for 1
08H to 0FH.. ..Test one of data bus bits 0 to 7 for 1
10H to 17H... .Test one of user bits 0 to 7 for 0
18H to 1FH... .Test one of data bus bits 0 to 7 for 0
80H to 0BFH.. .Test user bits 0 to 5 for a group match
![]()
Both commands compare the value of the I/O signal to the value specified by the parameter. Note that USRB0 to USRB5 can be treated as a single group of six bits, with the value test comparing all six bits to the lower six bits of the parameter. Any other bits can only be tested on an individual basis.
The Til command will jump to the specified byte address until the signal(s) match the parameter value, either a low or high level. When there is a match in value, the Til command does not take the jump, and execution falls through to the command after the Til command.
The Til command is only used in an external memory program, since it will jump or fall through, depending on the bit value. The address of the jump is a single byte, limiting the jump to an address on the same 256 byte page as the command after the Til command. The TIL command may jump to itself.
The Wait command simply waits for a match of the bit(s) against the parameter value. When there is no match, the CY545 stays in the Wait command, and continually tests the signals until a match occurs. Once a match is detected, the CY545 will continue with the next command.
If you issue a new command either in parallel or serial format while the CY545 is stuck in a Wait command, the CY545 will abort the Wait function and act on the new command. This is a mechanism for breaking out of Wait commands that are stuck because the proper bit pattern does not occur.
The Wait command is normally used in an external memory program, to synchronize the CY545 with some external control or status signal. For example, move a part into place, activate some operation by changing a user bit, wait for a signal back from the operation indicating operation complete, then remove the part.
The following example illustrates the use of Wait and Til commands for the operation described above:
![[Figure 6.4]](gif/545-16.gif)
Finally, one command uses the bits to control special motions, and cause stepping during the bit testing. It is:
H Bit Step to Home, using specified signal
The values of the parameters for this command are treated the same as the Til and Wait commands. That is, for the Home command, the bits are tested for a match to the parameter value.
As the CY545 steps the motor for this command, it will run at a constant step rate, with no acceleration or deceleration. The desired step rate is chosen by the First Rate parameter, set by the F command. The actual step rate is a derivative of the rates in the CY545 Step Rate Table. For the Home command (and the Jog pin function), the CY545 will divide the selected rate by 20. When operating at 12 MHz, this gives a range of about 1 step per second to about 1000 steps per second for this command.
The Home command starts by testing the specified bit pattern for a match with the external signals. If there is a match, the CY545 will begin by stepping in the CCW direction, and will continue in this direction until there is no longer a match.
When there is no match between the bit parameter and the external signals, the CY545 steps in the CW direction. It will continue to step in this direction until the signals match the parameter value. At this point the CY545 stops, and sets the current position to zero.
Thus, the Home command steps the motor to seek the edge between a match and no match condition on the home signal. The CY545 then stops at the first step where a match occurs, and is always stepping in the CW direction looking for this match. This mechanism should always seek the same mechanical position, since any directional backlash is compensated by using the same CW step direction in seeking the final home position.
If the CY545 runs into one of the limits while looking for the home signal, it will abort the home command and stop stepping. The current position is not changed to zero in this case.
This special note applies only to the chip version prior to the CY545A.
The older CY545s drive the BUSY line low at the beginning of the Home command, then leave it low after the home position has been found. This means that the CY545 does not indicate ready for the next command on the parallel command interface.
There are two approaches to solving this problem. First, if the CY545 is displaying the position for every step that it takes, and the position display is going to the parallel interface, the BUSY signal will be driven to the ready state when the CY545 completes the home function. See the Mode command for details on position display during home.
The other approach is to issue the first character of the next command with a blind handshake, and wait for the CY545 to accept the character. With this approach, you should place the command character on the data bus, then drive IO_REQUEST low for 100 usec. Drive it high again after 100 usec, then wait for 500 usec. If the CY545 drives the BUSY signal high, it has accepted this first character, and is ready for the next character of the command. Otherwise, repeat the blind handshake until the CY545 drives the BUSY signal high.
While the CY545 is performing the home function, it will ignore the IO_REQUEST signal. However, when it finishes, and sees the blind handshake described above, it will accept the next command character, then drive the BUSY signal high again. At this point it will be ready for a normal handshake for the rest of the command sequence.
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