edurant.com > MSOE > SEED > Design > Contents > Design Procedures

[previous: Design of Supply Blocks] [next: Simulation]


Design Procedures

Control Blocks

The power supply is controlled by a Motorola HC12 microprocessor. The processor will take user input from a keypad subsystem and relay this information to the supply systems as well as to the LCD panel display. Information will also be taken from the supply systems and output to the LCD panel display. The processor will be watched by a computer operating properly (COP) circuit which will be able to reset the processor and power down the supplies via a solid state relay. The processor will also control an alarm subsystem which will provide both an audio and a visual alarm to the user. Each subsystem is designed and built as a separate unit so as to ease integration.

Processor Hardware

Since the processor must be able to control a maximum variable supply of 50V in 50mV increments, at least [eqn] data bits are required. Allowing room for expansion, 12 data bits are reserved for both the control data to the supplies and for the current and voltage values read from the supplies.

Table 1: I/O Pin Requirements
Description Type Pins
Supply Select O 3
Supply Polarity O 1
Supply I/V O 1
Data to Supply O 12
Data to Supply Latch O 1
Data from Supply I 12
Data to Display O 8
Control Signals to Display O 1
Data from Keypad Controller I 5
Keypad Interrupt I 1
Keypad Acknowledge O 1
COP Keep Alive Signal O 1
Buzzer/Light Control O 1
Cut-Off O 1
Total Output 33
Input 18

Table 1 shows the required input and output pins. Although this number could be reduced through multiplexing, it was decided that avoiding multiplexing would greatly simplify the design and debugging of the prototype.

Although PIC processors (along with Parallax's BASIC Stamp interface) were considered, the large number of required I/O points strongly encouraged the use of a Motorola 6800 series microcontroller. The following processor families (with the noted number of I, O, and I/O points) were considered:

It turns out that even if the data were multiplexed that the HC11 does not have enough I/O points, even in single chip mode. Both the HC12 and HC16, however, support the required I/O comfortably and without multiplexing.

The HC16 is a viable choice due to its true 16-bit arithmetic operations, digital signal processing capabilities and availability of an integrated 10-bit A/D. These features would ease the required arithmetic operations and eliminate the need for an external A/D. However, external A/Ds allow for a completely digital (and hence more modular) interface to the supply modules. Therefore, the A/D was not a deciding factor.

The much newer HC12 was chosen because of its more organized physical I/O layout. Additionally, except for a few opcodes that are not needed for this application, the HC12 uses the same instruction set as the HC11. Since all I/O is memory mapped, this means cheap, readily available HC11 development tools may be used for the HC12. More information on the MC68HC12 is contained in Appendix C.

Processor Software

In addition to a control loop and several utility loops (display updating, for example), the software consists of two main routines: the supply control routine and the interrupt service routine for the keypad. Main Software Loop
Figure 6: Main Software Loop

First, consider the control loop shown in Figure 6. Initialization is performed when the system starts up. Since there are only three supplies in the prototype, only one of which is settable, and negative and positive channels will not be separately controllable, several of the system state variables will be constant or non-applicable.

The routine to update the display will not need to query the supply modules; it will simply look at values left in specific memory locations to determine what data to output.

The time between successive passes of node A will be on the order of 10ms. This represents a balance between allowing the supplies enough time to settle given an unknown external circuit and providing a quick response.

The supply control loop is detailed in Figure 7. The loop iterates over each supply, comparing a 16-bit moving average of its output (current or voltage as specified by the user) to the set value. If the error is above a pre-assigned noise threshold, the 10-bit supply voltage control word is corrected by a certain proportion of the error, as specified by a pre-assigned inertia value. If the calculated control word is within bounds, the system proceeds to the next supply.

If the calculated control word is not within bounds, though, an error has occurred. This is most likely a short circuit. When an error occurs, the supplies are immediately disconnected via a relay, and the external alarm circuit is activated. Then the supply control loop exits so that the display routine can explain the error to the user. Software Supply Control
Figure 7: Supply Control Subroutine

When the user presses a key, an interrupt is generated. The processor handles this interrupt as quickly as possible, updating its state as necessary. The details of the interrupt service routine are shown in Figure 8 below. Keypad ISR
Figure 8: Keypad ISR

LCD

The display will be an Optrex DMC-40401 40 character by 4 line LCD panel (see specifications in Appendix D). The display knows how to generate characters and has several features which will minimize the work required of the processor. Some of these include maintaining a cursor and being able to reset itself.

The display has eight data lines and four control lines. Three of these control lines are not required since they are used for reading data from the display. The remaining control line is an instruction start signal.

The display format used is shown in Figure 2: Display Format.

Keypad and Controller

The keypad subsystem is the user input device for the power supply. The keypad is used to input the desired output levels of the system, as well as to turn the supplies on or off. The subsystem is composed of a 20 button matrix keypad, a keypad encoder, an edge triggered D-flip-flop, and two capacitors to determine the scan rate of the encoder and the debounce time. The schematic for this system is shown in Appendix E, along with the parts list and relevant specification sheets. The system outputs six lines to the processor: five data lines and a data available line which will be used as an interrupt. The subsystem needs one line from the processor to acknowledge the data and to reset the data available line. This reset line will be active low. The debounce capacitor should be 1mF to allow a debounce time of about 10 ms, as recommended by the keypad manufacturer. The scan rate capacitor should be 0.1mF to create a key scan frequency of 600 Hz. This means that the overall frequency of all 20 keys will be 30 Hz. Since the data is not latched, this means that the processor will need to be able to read the input keystroke within 1.67 ms in the worst case. This should not be a concern due to the clock speed and interrupt routine of the processor.

COP

COP to Processor Interface

To monitor the processor for failures, a COP system is used. To account for the minuscule possibility that the on board COP packaged with the HC12 could fail, an external COP circuit is used. A series of watchdog chips by Maxim were chosen because of their flexibility in timing and input/output possibilities (see Appendix G). The circuit will take an output from the processor and ensure that this line is toggling at a preset interval. This interval will be determined in the software, but the Maxim 691 allows a number of different timings. In external mode, the timing can be set between 1 024 or 4 096 cycles. In internal mode, the timing can be set at 0.1 or 1.6s. The schematic circuit shown in Appendix G is set to use the COP's internal clock, and requires a toggle every 100 ms. If this toggle is not received, among other actions to be discussed shortly, a reset signal is sent to the processor. The watchdog circuit then waits 1.6s to receive the toggle from the microprocessor, and if it does things return to normal.

Relay Interface

As seen from the schematic diagram, the COP circuit has the ability, along with the processor, to shut down the power to the output supplies via a solid state normally open relay. The COP circuit will shut the supplies down if the toggle is not received for 100 ms. As soon as this watchdog input resumes toggling, the Maxim chip applies power to the relay which restores the output supplies. The relay is driven directly by the gate shown because of the high input resistance of the solid state relay.

Alarm

The alarm subsystem consists of a piezoelectric buzzer, a red LED, and the circuitry to turn them on and off. In the event of an alarm, the processor will strobe the error input of the alarm circuit low. This will cause the buzzer to sound for approximately 1.5s, and will latch the LED on. The alarm system will reset when the processor strobes the reset input of the alarm circuit low. This subsystem provides no feedback to the processor. Appendix F has the schematic diagram, parts list, and relevant specification sheets for the alarm subsystem.

The piezoelectric circuit consists of a 555 timer IC, a 4.4 kHz buzzer, and the resistors and capacitors needed to run the timer. The timer chip requires active low pulses on the trigger and reset pins, so the output from the processor will be active low. The timer is set to be active from the strobe of the trigger pin until either 1.5s elapses or the reset pin is strobed.

The LED section of the subsystem is a D-flip-flop used as a latch to drive a red LED on. The LED is in series with a resistor to provide the proper current through the LED at 5V. The D-flip-flop is triggered by the error input, which goes to its clock pin while the D pin is held high, and is reset by the reset input on its asynchronous reset pin.

Thermal Monitor

To manage the heat given off by the many supplies, a combination of passive and active cooling approaches is to be used. The regulators themselves must be connected to a heat sink. For Push-Button Power, this will likely be one large heat sink as opposed to several smaller units. These regulators have the advantage of an internal thermal overload cut-out circuit.

The transformers will simply be attached to the case of the supply where they will benefit from a small amount of conduction as well as natural convection. The power supply will also feature a cooling fan. This fan will be placed to perform two functions. The main function will be to remove heat from the entire case through mass transfer, and the auxiliary purpose will be to provide some forced convection on the heat sink for the output regulators. The fan's actual output will be in the range of 50 cubic feet per minute, but this specification can be increased for additional unforeseen cooling needs. Another important specification of the fan is its loudness, because any noise added to the laboratory setting is undesirable. A maximum noise level of 40 dB is chosen.