Advertisement
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 "user.h"
- /******************************************************************************/
- /* User Functions */
- /******************************************************************************/
- /* <Initialize variables in user.h and insert code for user algorithms.> */
- void InitApp(void)
- {
- ADCON1 = 0b00000000; //all analog mode, no AD timer scaling, reference voltage is Vdd, Vss
- ADCON0 = 0b00000000; //channel 0 selected, AD off initially, godone unset
- TMR1ON = 0; //turn off TIMER1
- TMR2ON = 0; //turn off TIMER2
- INTCON = 0b00000000; //turn off all interupts
- CCP1CON = 0x00; //turn off CCP
- SSPCON = 0x00; //turn off SSP
- PEIE = 1; //turn off periph ints
- ADIE = 1; //set AD ints
- GIE = 1; //set general ints
- ADON = 1; //turn on AD now
- RB0 = 1; //turn just the one B port on
- ADIF = 0; //clear flag
- TRISA = 0xFF; //porta as inputs
- TRISB = 0x00; //portb as outputs
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement