int main() { // default peripheral freq. is CPUCoreFrequency / 2 (cf. system.c) #if defined(__32MX220F032D__)||defined(__32MX250F128B__)||defined(__32MX220F032B__) SystemConfig(40000000); // default clock frequency is 40Mhz #else SystemConfig(80000000); // default clock frequency is 80Mhz #endif IOsetSpecial(); IOsetDigital(); IOsetRemap(); #ifdef __ANALOG__ analog_init(); #endif #ifdef __MILLIS__ millis_init(); #endif #ifdef __PWM__ PWM_init(); #endif #ifdef __USBCDC CDC_init(); #endif #ifdef __RTCC__ RTCC_init(); #endif setup(); while (1) { #ifdef __USBCDC #if defined(__32MX220F032D__)||defined(__32MX250F128B__)||defined(__32MX220F032B__) USB_Service( ); #else CDCTxService(); #endif #endif loop(); } return(0); }
void pinguino_main(void) { #if defined(PIC18F26J50) // Enable the PLL and wait 2+ms until the PLL locks u16 pll_startup_counter = 600; OSCTUNEbits.PLLEN = 1; while(pll_startup_counter--); #endif PIE1 = 0; PIE2 = 0; IOsetSpecial(); IOsetDigital(); IOsetRemap(); #ifdef ON_EVENT // Enable General/Peripheral interrupts int_init(); // Disable all individual interrupts #endif #ifdef __USB__ PIE2bits.USBIE = 1; INTCONbits.PEIE = 1; INTCONbits.GIE = 1; #endif //setup(); //#ifdef ON_EVENT //int_start(); // Enable all defined timers interrupts //#endif #ifdef ANALOG analog_init(); #endif #ifdef __MILLIS__ // Use Timer 0 millis_init(); #endif #ifdef SERVOSLIBRARY servos_init(); #endif #ifdef __USBCDC CDC_init(); PIE2bits.USBIE = 1; INTCONbits.PEIE = 1; INTCONbits.GIE = 1; #endif #ifdef __USBBULK bulk_init(); PIE2bits.USBIE = 1; INTCONbits.PEIE = 1; INTCONbits.GIE = 1; #endif #ifdef __PS2KEYB__ keyboard_init() #endif #if defined(__SERIAL__) || defined(SERVOSLIBRARY) INTCONbits.PEIE = 1; INTCONbits.GIE = 1; #endif /* RB : millis.c/millis_init() did already the job #ifdef MILLIS INTCONbits.TMR0IE= 1; INTCONbits.GIE = 1; #endif */ setup(); #ifdef ON_EVENT int_start(); // Enable all defined timers interrupts #endif while (1) loop(); }