void main(void) { // Set up the scheduler SCH_Init_T2(); // Set up the display BARGRAPH_Init(); // Set up the switch pin SWITCH_MS_Init(); // Add a 'SWITCH_MS_Update' task, every ~200 ms // - timings are in ticks (50 ms tick interval - see Sch 'init' function) SCH_Add_Task(SWITCH_MS_Update, 0, 4); // Add a 'COUNTER_Update' task every ~1000 ms SCH_Add_Task(COUNTER_Update, 0, 20); SCH_Start(); while(1) { SCH_Dispatch_Tasks(); } }
/* ............................................................... */ void main(void) { // Initialisation can be problematic with some display / supply // combinations. You may get away with calling this function // twice (or once) but - for maximum reliability under a very wide range // of conditions - it is called three times here. LCD_Init(0); LCD_Init(0); LCD_Init(1); // Prepare the elapsed time library Elapsed_Time_LCD_Init(); // Prepare the scheduler SCH_Init_T2(); // Add tasks to the scheduler // // Update the time every second (*** 1ms sched ticks ***) SCH_Add_Task(Elapsed_Time_LCD_Update, 100, 1000); // Update the whole display ~ every second // - do this by updating a character once every 24 ms // (assumes a 40 character display) SCH_Add_Task(LCD_Update, 1000, 24); // All tasks added: start running the scheduler SCH_Start(); while(1) { SCH_Dispatch_Tasks(); } }
void main(void) { // setup microcontroller PLLCON = 0x00; P0 = 0x00; P1 &= ~(1<<6); P1 &= ~(1<<7); // Set up the scheduler SCH_Init_T2(); // init tasks init_statemachine(); // - timings are in ticks (~1 ms tick interval) SCH_Add_Task(statemachine, 0, 10); SCH_Add_Task(switchStateMachine, 5, 20); // Start the scheduler SCH_Start(); while(1) { SCH_Dispatch_Tasks(); } }
int main( void ) { WDTCTL = WDTPW + WDTHOLD; // Stop WDT BCSCTL1=0x00; //&= ~XT2OFF; // XT2= HF XTAL do{ IFG1 &= ~OFIFG; // Clear OSCFault flag for (int i = 0xFF; i > 0; i--); // Time for flag to set }while ((IFG1 & OFIFG)); // OSCFault flag still set? BCSCTL2 |= SELM_2+SELS; // MCLK=SMCLK=XT2 (safe) //Init System Service InitialPort(); InitFileSystem(); Init_Pipe(); InitTB(); //Init Device InitialRTC(); Init_UART(); InitADC(); Creat_Command_Task(); //After the bluetooth has beed connected SCH_Init(); SCH_Start(); // SCH_Add_Task(Task_UART_Send,0,5); //creat a task for sending data via uart,after bluetooth connect // SCH_Add_Task(Acquire_ECG,0,4); //32768/4*32 = 256hz // CommandSwitchList(1); while(1){ SCH_Dispatch_Task(); } }
void main() { cli(); // disable INT. during peripheral setting Peripheral_Init(); SCH_Init_T2_1ms(); //初始化systick为1ms sei(); // enable INT. SCH_Add_Task(UART0_TX,0,10); SCH_Start(); // TODO: add your main code here while(1) { SCH_Dispatch_Tasks(); } }
void main(){ SCH_Init_T2(); led_init(); SCH_Add_Task(draw1,0,2); SCH_Add_Task(draw2,1,2); SCH_Add_Task(draw,0,34); SCH_Start(); while(1){ SCH_Dispatch_Tasks(); button(); if(350==count++){ count=0; move(); } } }
void main(void) { // Set up the scheduler SCH_Init_T0(); // Prepare for the 'Flash_LED' task LED_Flash_Init(); // Add the 'Flash LED' task (on for ~1000 ms, off for ~1000 ms) // - timings are in ticks (5 ms tick interval) // (Max interval / delay is 65535 ticks) SCH_Add_Task(LED_Flash_Update, 0, 200); // Start the scheduler SCH_Start(); while(1) { SCH_Dispatch_Tasks(); } }
void main(void) { // Set up the scheduler SCH_Init_T2(); // Set baud rate to 9600, using internal baud rate generator // Generic 8051 version PC_LINK_IO_Init_Internal(9600); // We have to schedule this task (10x a second is enough here) // - this checks if a character has been received by the USART // - if so, responds appropriately. // // TIMING IS IN TICKS NOT MILLISECONDS (1 ms tick interval) SCH_Add_Task(MENU_Command_Processor,100,100); SCH_Start(); while(1) { SCH_Dispatch_Tasks(); } }
void main(void) { // Set up the scheduler SCH_Init_T2(); // Add the 'Time Update' task (once per second) // - timings are in ticks (1 ms tick interval) // (Max interval / delay is 65535 ticks) SCH_Add_Task(CLOCK_LED_Time_Update,100,10); // Add the 'Display Update' task (once per second) // Need to update a 4-segment display every 3 ms (approx) // Need to update a 2-segment display every 6 ms (approx) SCH_Add_Task(LED_MX4_Display_Update,0,3); // Start the scheduler SCH_Start(); while(1) { SCH_Dispatch_Tasks(); } }