??? 01/19/10 06:55 Read: times |
#172583 - I haven't understood the table lookup concept very well... Responding to: ???'s previous message |
Mr. Ferlemann,
I haven't used a lookup table before..so I really couldn't understand the code you provided some days ago... Frieder Ferlemann said:
If P1 (or whatever port you connected the servos to) is free to use, you can also use a table lookup.
Thus you have no performance penalty within the IRQ for connecting up to 8 servos:) #include <8052.h> static unsigned char ms_tenth_countdown; // dynamically setup table. // Indexed top down. // setup glitchlessly! unsigned char __pdata table_P1_over_time[180 + 1]; void Timer0_ISR (void) interrupt 1 { // assuming P1 is only used for servos. P1 = table_P1_over_time [ ms_tenth_countdown ]; TF0 = 0; if (!--ms_tenth_countdown) ms_tenth_countdown = 180; } void main(void){} How are we trying to achieve different pulse widths here? Could you please explain just the concept behind this code, I'll look up the syntax! Thanks a lot! |