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 = 0b01000000; //all analog mode, AD speed again reduced by 2x, no AD timer scaling, reference voltage is Vdd, Vss
- ADCON0 = 0b00000000; //channel 0 selected, FOSC/4 , AD off initially, go_done unset
- PEIE = 1; //turn on periph ints
- ADIE = 1; //set AD ints
- GIE = 1; //set general ints
- INTE = 0; //RB external interrupts off
- RBIE = 0; //RB port change functionality off
- ADIF = 0; //clear flag
- ADON = 1; //turn on AD now
- TRISA = 0xFF; //porta as inputs
- TRISB = 0x00; //portb as outputs
- PORTB = 0xFF; //port b set high
- PORTA = 0x00; //drive port a low
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement