void main(void) { initialize(); init_usb(); slosyn_setup(); while(1) { INTCON = 0; usb_sleep(); dispatch_usb_event(); slosyn_schedule(); } }
void main(void) { init_boot(); init_usb(); while(1) { usb_sleep(); dispatch_usb_event(); if((application_data.invalid == 0) && (GET_ACTIVE_CONFIGURATION() > FLASH_CONFIGURATION)) { application_data.main(); INTCON = 0; // Forbid interrupts } } }
void application_main(void) { unsigned char toto[2][4]={{0x05,0x01,0x00,0xf0}, // 00000101, 00000001, 00000000, 11110000 {0x0A,0x02,0x00,0xf0}};// 00001010, 00000010, 00000000, 11110000 // Reset the Timer0 value TMR0H = 0; TMR0L = 1; setalim(); init_motors(); setup_adconversion(); init_servos(); init_digitals_in(); init_debug(); init_fdc(); set_fdc((unsigned char *)toto,2); SET_DEVICE_STATUS(REMOTE_WAKEUP_DIS); // Interruptions PIE2bits.USBIE = 0; // Interrupt USB off : on ne touche pas a la gestion de l'USB !! INTCONbits.PEIE = 1; // Interrupts peripheriques (usb, timer 1...) INTCONbits.GIE = 1; // Interrupts global while(usb_active_cfg > 2) { usb_sleep(); dispatch_usb_event(); } cutalim(); PINDEBUG = 0; verif_fdc(0); // clear_device_remote_wakeup(); }