??? 10/18/06 01:08 Read: times |
#126621 - I'll try this! Responding to: ???'s previous message |
Look at my codes (not all), the stepper must move one step at each interrupt.
/////////////////////////////////////////////////////////// uint8 t = 0; main() { Initialization(); Timer0Init(); while(1) { if(t > 1) // of course I freeze the Timer before reading { // we missed (t-1) steps, wrong! } else if (t == 1) { t = 0; //move one step; } // RS232 processing // other stuff.. } //should not be here! } Timer0ISR { t++; // <- Very simple ISR, isn't it? } //////////////////////////////////////////////////////// sometimes I got missed one step error! That's why I want to check the CPU usage. RS232 is not critical, the master can repeat the last mssage if it does not get a response within a preset time period. I know where I should set the pin 1 and clear it. Thank you Russ. |