void main() { DDRC=0xff; DDRE&=~((1<<4)|(1<<5)|(1<<6)); // External Interrupt Enable PORTE|=(1<<4)|(1<<5)|(1<<6); lcd_init(); DDRC=0xff; DDRG|=(1<<0)|(1<<4); DDRD&=~(1<<6); PORTD=(1<<6); PORTG&=~(1<<0); sei(); ext_timer_init(); unsigned char data; motor_execute(); while(1) { /* // data=eeprom_read_byte(25); lcd_gotoxy2(9); lcd_num(eeprom_read_byte(25)); */ } }
task main() { system_state current_state = system_1; motor_control motor_tasks[TASK_SIZE]; byte head_motor = -1; byte start_motor = 0; //move_robot(127,1000,motor_tasks,&head_motor,&start_motor,system_1); //turn_robot(127,1000,motor_tasks,&head_motor,&start_motor,system_1); while (current_state != system_critical_failure) //Main Loop { switch (current_state) //Switch states { case system_1: break; case system_2: break; default: current_state = system_critical_failure; break; } if (head_motor > -1) //Run motors motor_execute(motor_tasks,&head_motor,&start_motor,¤t_state); } }