Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /******************************************************************************/
- /* Files to Include */
- /******************************************************************************/
- #if defined(__XC)
- #include <xc.h> /* XC8 General Include File */
- #elif defined(HI_TECH_C)
- #include <htc.h> //HiTech General Include File
- #endif
- #include <stdint.h> //For uint8_t definition
- #include <stdbool.h> //For true/false definition
- #include "system.h" //System funct/params, like osc/peripheral config
- #include "user.h" //User funct/params, such as InitApp
- /******************************************************************************/
- /* User Global Variable Declaration */
- /******************************************************************************/
- /******************************************************************************/
- /* Main Program */
- /******************************************************************************/
- void main(void)
- {
- /* Configure the oscillator for the device */
- ConfigureOscillator();
- /* Initialize I/O and Peripherals for application */
- InitApp();
- //may not be necessary
- OPTION_REG = 0b00000000;
- //main loop
- for(;;)
- {
- //wait for return from ADC int
- while(GO_DONE==1);
- //40 NOPs = 20 us @ 2 MIPs (19.72 us required at room temperature 77F/25C)
- asm("NOP"); //0
- asm("NOP");
- asm("NOP");
- asm("NOP");
- asm("NOP");
- asm("NOP");
- asm("NOP");
- asm("NOP");
- asm("NOP");
- asm("NOP"); //10
- asm("NOP"); //11
- asm("NOP");
- asm("NOP");
- asm("NOP");
- asm("NOP");
- asm("NOP");
- asm("NOP");
- asm("NOP");
- asm("NOP");
- asm("NOP"); //20
- asm("NOP"); //21
- asm("NOP");
- asm("NOP");
- asm("NOP");
- asm("NOP");
- asm("NOP");
- asm("NOP");
- asm("NOP");
- asm("NOP");
- asm("NOP"); //30
- asm("NOP"); //31
- asm("NOP");
- asm("NOP");
- asm("NOP");
- asm("NOP");
- asm("NOP");
- asm("NOP");
- asm("NOP");
- asm("NOP");
- asm("NOP"); //40
- //AN0 pin has had time to acquire voltage
- GO_DONE = 1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment