> while (TRUE) > { > if (DO_IT_NOW) > pid_calculations(); > code_a(); > code_b(); > code_c(); > code_d(); > } Sorry, I did not look at your code long enough. The standard 'fixed interval loop' looks more like this: while( TRUE ){ while( ! DO_IT_NOW ){} pid_calculations(); code_a(); code_b(); code_c(); code_d(); } Of course the total excution time must be less than the timer interval. If not read my previous post. Wouter van Ooijen -- ------------------------------------------- Van Ooijen Technische Informatica: www.voti.nl consultancy, development, PICmicro products docent Hogeschool van Utrecht: www.voti.nl/hvu -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist