[time-nuts] A Simple PIC Divider
Chuck Harris
cfharris at erols.com
Mon Aug 7 12:15:33 UTC 2006
Hi Bill,
No, of course it isn't. But for a function as critical
as this, surely one would look at the assembly generated.
There will no doubt be need to adjust things a little bit.
It might end up being something more like:
while(1){
delay_us(4);
#asm
NOP
#endasm
output_toggle(PIN_A0);
}
On another note, there are PICs that have hardware divider
chains built in. The 12F629 is one of them.
-Chuck
Bill Hawkins wrote:
> Wait a second - are you saying that the compiler is
> smart enough to account for the 'while' and the
> 'output_toggle' instructions to make the total
> execution time for the loop be precisely 50 clock
> ticks?
>
>
> -----Original Message-----
> From: Chuck Harris
>
> If I wanted to divide a 10MHz clock down to 100KHz, I could do something
> like:
>
> while(1){
> delay_us(5);
> output_toggle(PIN_A0);
> }
>
>
> _______________________________________________
> time-nuts mailing list
> time-nuts at febo.com
> https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
>
More information about the Time-nuts_lists.febo.com
mailing list