Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


Share this Page URL
Help

Appendix E - Dizi690 Demo Board > E.4. Circuit Simulation - Pg. 402

402 Appendix E Alternatively, for this design, download the program shown as Program E.1, TEST1.ASM, place it in the application folder and attach it in the source file dialogue. In the source code, the processor is specified so that the assembler can check that the statements are suitable for that processor, for example, that only the available registers are used. The CONFIG code specifies the configuration bits in the MCU, including selection of the default internal clock speed, 4 MHz. Note that the oscillator selection bits also affect the function of RA4 and RA5 (which must be digital I/O). The include file P16F690.INC provides the special function register and bit labeling. This file is downloaded with the MPLAB IDE file set, and must be copied from the `Microchip/MPASM Suite' folder into the project folder. The PIC 16F690 must be initialized for most of the pins to operate as digital I/O, so the SFRs ANSEL and ANSELH are cleared initially, and then the analogue input RA0 is enabled by setting ANSEL,0. Note the bank selection syntax required to access the special function registers (SFRs), accessing them in descending order so that bank 0 remains selected for the main program. The analogue setup is described in more detail in Chapter 7, as applied to the LPC board. The data sheet for the 16F690 will need to be downloaded from www.microchip.com to support the program development. The main loop of the test program provides two main functions, selected via the push buttons: