CY545
[Logo]

Chapter 13
Thumbwheel Switch Support


Thumbwheel Switch Support

A very important feature for stand-alone control is the ability to define variable parameters for the control functions. In many applications, the basic function is similar for a whole set of operations, but the exact numbers will vary with the particular operation being selected. For example, a machine could be designed that takes raw stock, such as lumber, and cuts it to specified lengths.

As a CY545 program, such an application is fairly simple. If the stepper motor controls the feeding of the stock, you must simply move the motor a specific number of steps that correspond to the desired length, then activate a cutting mechanism. This function then repeats as long as stock is available, or for the number of final pieces desired.

If you now wish to cut stock of another length, the same command structure as before could be used, with only a change to the number of steps to move.

A number of options exist for implementing such a system. First, a host computer could be used to enter the desired function, and the computer program could generate the proper command sequence for the CY545. While this approach is quite practical, the host computer may be too expensive to justify for such a simple task.

Next, the external memory support of the CY545 could be used to hold several programs, one for each of the desired lengths needed by the application. Some mechanical selection process could then choose which program the CY545 would run, based on the desired length. This approach is also practical, so long as you can define all the required lengths within the memory contents. If a new length is desired, a program for that length must first be defined in the memory before it can be run. This requires the machine to be stopped, while a programmer enters the proper commands to the CY545.

Finally, it would be nice if only one program were required, since the basic function is always the same. This requires the CY545 to accept variable parameters, fixed at the time the program is run. This would allow any length stock to be selected, with a resolution of one step from one length to the next, without using a host computer or additional programs in external memory.

The CY545 provides such a function, using external thumbwheel switches to specify the parameter values. All examples shown so far have used fixed parameters as numeric arguments to the CY545 commands, such as Rate and Number. For example:

When such commands are read by the CY545, either from the command interfaces or from the external memory, the parameter value is fixed by the numeric argument, and is a constant for that command.

However, the CY545 will also accept another form of parameter for the arguments of the commands. This form replaces the numeric argument with a “#” character, and it means to read the actual parameter value from an external source, normally implemented as thumbwheel switches. Only the first parameter of a command with multiple parameters may be read this way, but this is not a severe restriction, since the second parameter is usually a branch address, and could be fixed anyway. Programs may repeat things a variable number of times, but usually go to the same place in the loop. Examples of this new format are shown below:

In all cases, the format for the command is identical to that with the numeric arguments, except that the numbers are replaced by the “#” character. Note that this format only works in the ASCII command mode, since the “#” character cannot be distinguished from a valid parameter byte value in the Binary command mode. All other characters of the command stay intact, including the space after the command letter, comma or space between arguments, and carriage return at the end of the command.

When these commands are written to external memory, the “#” character is included in the memory contents. Recall that the external memory contents are identical to the characters sent in the direct command mode. The CY545 will act on the character, and read the parameter value every time the program is run, and a command containing the “#” character is read.

When the “#” character is processed by the CY545, it generates a special read sequence to get the value of the parameter from the external switches. Each parameter consists of 3, 5 or 8 digits, depending on whether the parameter is a byte or two byte size. Each parameter is assigned an address range of 3, 5, or 8 addresses, generated on the lower byte of the two address latches, controlled by the ALE signal.

In order to read a specific digit, the CY545 generates the digit address, latched into the lower address byte latch. It then generates a RD strobe, with the SW_SEL line low. This should enable the data from the addressed switch onto the CY545 data bus. All switches are positive BCD encoded. The CY545 reads the switch value from the lower four bits of the data bus, then converts the value into an ASCII decimal digit. The hex format is not supported for externally read parameter values.

To read an entire parameter, the digit read process is repeated three, five, or eight times, depending on the size of the parameter. The CY545 starts by reading the most significant digit, then the next, until it finally reads the least significant digit. This is the same order that digits are read from a command with numeric arguments.

[Figure 13.1]

The various CY545 commands have been split into three groups for parameter addressing purposes. This organization minimizes the address decoding logic needed to access the external switches.

The applications schematic includes an example interface to three different parameters, the Number parameter with 5 digits, and the Rate and First rate parameters, each with 3 digits.

Each group of 8 parameters is selected by a 74LS138 decoder, which generates an enable signal for the selected command parameter. Each digit of the enabled parameter is uniquely enabled by a signal from a 74LS156 decoder. Digits are enabled in address sequence, with the least significant digit selected by the Y0 output selection from the 74LS156.

For 5 and 8 digit parameters, one 74LS156 must be used to address the parameter. It can generate up to 8 enable signals, but 3 will not be used in the 5 digit cases. The Delay parameter would be an example of this.

For 3 digit parameters, one 74LS156 can be used to address two different parameters. Each half of the 74LS156 can select 3 digits, with one line not used. The Rate and First rate parameters illustrate this example.

To allow every parameter to be specified by a thumbwheel switch selection would require three 74LS138s, plus one or one half 74LS156 per parameter. It also would take one thumbwheel switch per parameter digit. This could be a significant amount of hardware if all parameters are externally controlled. However, we expect that in real applications, only a few parameters will need this feature, and hardware complexity will not be that bad.

The thumbwheel switches used for each digit should be BCD encoded, and must have isolation diodes between the digit lines. Some switches have these diodes built in, but most do not. The diodes have been shown on the example schematic. Also, with the parts shown, the switches must have a complemented common signal to generate the proper values at the CY545 data bus. By using an inverting buffer to the CY545 data bus, a non-complemented common signal switch could also be used. Pull-up resistors provide a high signal for those digit lines not connected to the common for a particular digit value.

The following section gives the address values for each parameter the CY545 can read from external switches. The lowest number of the range corresponds to the least significant digit of the parameter, and is read last by the CY545. The highest number is the most significant digit address, and is read first.

CY545 Thumbwheel Switch Parameter Addresses

.......Addresses...................Parameter
Group 1
.......87H - 80H ...........N command number of steps, ...8 digits
.......8FH - 88H ...........P command target position, . .8 digits
.......97H - 90H ...........A command at position, .......8 digits
.......9CH - 98H ...........D command delay value, .......5 digits
.......A2H - A0H ...........R command step rate, .........3 digits
.......AAH - A8H ...........S command acceleration slope, 3 digits
.......B2H - B0H ...........F command first rate, ....... 3 digits
.......BCH - B8H ...........Y command memory address, ... 5 digits
Group 2
.......42H - 40H ...........B command bit number, ....... 3 digits
       4AH - 48H            H command bit number,         3 digits
.......52H - 50H ...........T command bit number, ....... 3 digits
.......62H - 60H ...........W command bit number, ....... 3 digits
.......6AH - 68H ...........J command byte address, ..... 3 digits
.......72H - 70H ...........L command repeat count, ..... 3 digits
     ..7CH - 78H ...........Z command repeat count, ..... 5 digits
Group 3
.......C2H - C0H ...........O command mode value, ....... 3 digits
.......CAH - C8H ...........? command query letter code, .3 digits


Each parameter has been assigned a potential range of 8 addresses, to make the address decoding easier. Only the addresses shown are actually used to read digit values. The CY545 will not generate the unused address values.

Any parameter that will not be read from switches does not require the 74LS156 or switches for that parameter. Any group of parameters that will not be read from switches does not require the 74LS138 decoder either.

CY545 Thumbwheel Circuit Diagram

[Thumbwheel]

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