Log in

View Full Version : Timer 0/Serial Communications?


steven114
13-02-2005, 20:21
I'm trying to appropriate TMR0 on the PIC for my own use, but when I do so the RC starts scrambling all my printf() calls.
T0CONbits.T08BIT = 1;
causes this:
joyx = 127,joyy = 126
joyx = 127,joyy = 126
joyx = 127,joyy = 125
joyx = 127,joyy = 126
joyx = 127,joyy = 125
joyx = 127,joyy = 125
joyx = 127,joyy = 126
joyx = 127,joyy = 125

to look like this:
joyx = 1536,joyy = 17185
joyx = 127,joyy = 155
joyx = 127,joyy = 1565
ocessor Initialized ...
joyx = 36,joyy = 17185
joyx = 1536,joyy 17575
ocessor Initialized..
joyx = 127,joyy = 155
joyx = ,joyy = 153685
joyx = 127,joyy = 1557185
joyx = 1536,joyy = 17185
joyx = 1536,joyy =7185
printf("joyx = %d,joyy = % d\r\n",(int)DRIVEX,(int)DRIVEY);
is the only printf() called.

I've isolated it to that single instruction - if I remove that line, everything works great, except I can't use the timer. I seem to remember a sheet saying exactly what the code itself uses (in terms of processor resources) but I don't remember any of the timers being listed there and I can't find it again (after extensively searching the IFI site - does anyone else find it difficult to find stuff on it?)

Any ideas/pointers to where that information is? Thanks!

Tom Bottiglieri
13-02-2005, 20:26
I'm trying to appropriate TMR0 on the PIC for my own use, but when I do so the RC starts scrambling all my printf() calls.
T0CONbits.T08BIT = 1;
causes this:

to look like this:


is the only printf() called.

I've isolated it to that single instruction - if I remove that line, everything works great, except I can't use the timer. I seem to remember a sheet saying exactly what the code itself uses (in terms of processor resources) but I don't remember any of the timers being listed there and I can't find it again (after extensively searching the IFI site - does anyone else find it difficult to find stuff on it?)

Any ideas/pointers to where that information is? Thanks!

Timer 0 is used for internal processes. Try using timer 2 or 4, they are both easy to use.

steven114
13-02-2005, 20:50
Ah, that explains that. Thanks.