void main() { TRISB=0x00; TRISA=0x00; TRISDbits.TRISD7=0; // chan dieu khien coi bao a=0; index=0x03; Init_UART(); Init_Tran_UART(); Init_Rec_UART(); Osc(); Pwm_init(); VITRI=VITRI_3; //putrsUSART ((const far rom char*)"\r\nNguy hiem muc 3\r\n"); while(1) { LATAbits.LATA0= (index );// lay 4 bit chua gia tri cua index truyen sang 7447, tranh chan ngat int0 LATBbits.LATB1= (index >>1); LATBbits.LATB2= (index >>2); LATBbits.LATB3= (index >>3); LATDbits.LATD7= a; SetDCPWM2(VITRI); } while(1); }
void TimedPort::Run(int offset, int ontime, int offtime, bool status) { // Start with our normal schedule Osc(offset, ontime, offtime, status); // If we're not paused if (activestatus) { if (now()<timer) { // A timer has been triggered if (started) { On(); } if (stopped) { Off(); } } else { // Timer is over so let's reset the flags if (started) { started = false; } if (stopped) { stopped = false; } } } }
void TimedPort::Osc() { Osc(Offset, Time, Repeat-Time, true); }