User manual
Installation and Operation
© 2005 Microchip Technology Inc. DS51546B-page 17
2.4 FIRMWARE DESCRIPTION
The 000066_MCP402XEV.ASM source code was written using assembly language for
the PIC10F206 microcontroller. Refer to Appendix E. “00066_MCP402XEV.ASM
Source Code”. The firmware initializes its I/O so that it can poll the INCR and DECR
buttons every millisecond. If the button has been depressed for 40 out of 50 ms, it is
considered to be debounced and asserted. The button state is used to determine if a
new “Action State” is desired. This simple state machine then decodes the desired
action. Once the desired command has been determined, a subroutine that performs
the desired command is executed. The low-voltage commands are driven directly from
the PIC10F206 I/O, but the high-voltage commands require some additional hardware
to generate the required 8V signal.
When a high-voltage command is required, the PIC10F206’s unique OSCOUT feature
is utilized. The OSCOUT function allows the instruction clock to be driven on
GP2/OSCOUT under software control. A simple charge pump consisting of 2 – 0.01 µF
capacitors and a BAV99 dual diode is constructed as seen in Appendix
A.2 “Schematic”. When the OSCOUT is enabled, a 1 MHz clock drives the charge
pump that produces an 8.4V signal on the MCP401X/2X’s CS
pin (assuming
V
DD
= 5.0V). Utilizing such a charge pump requires special attention to the timing of the
CS
& U/D signals.
Refer to the comments in the 00066_MCP402XEV.ASM source code for more details
on the firmware’s operation. Refer to Appendix E. “00066_MCP402XEV.ASM Source
Code”.