文档介绍:POWERSUPPLY
Digital Benchtop
Power Supply (3)
part 3: the software
Design by R. Pagel
The digital benchtop power supply is controlled by a microcontroller
programmed in PIC BASIC, while a Visual BASIC program is responsible
for producing the control panel display on a PC.
Figure 1 shows the flowchart of the program
500 ms display
in the microcontroller. At start-up a brief ini- pause target value
tialisation sequence runs, which resets the start
set values to zero and configures some of the
microcontroller’s pins. The next step, the scan set target
buttons value again
measurement of the actual voltage and cur- initialisation
rent values, already forms part of the main
yes mark
program loop. All the remaining parts of the button 1
button
program follow sequentially in this loop. One measure voltage
no
branch that can occur is when the push-but- and current
tons are being read. The procedure for read- yes mark
button 2 button
ing the buttons is indeed as cumbersome as it format
measured no
(unavoidably) appears from the flowchart. values
The idea is to read each button in turn and, yes mark
button 3
button
when one is found that is pressed, the micro- display
controller stores the corresponding key code. measured no
values
Finally, under `button pressed?’ the micro- yes mark
button 4
controller checks whether any button was in button