Hi,
Now that doesn't make sense...
Which PIC are you using and what clock frequency?
I don't think I've seen the individual bitnames being predefined like that...which version of PBP are you using?
/Henrik.
Hi,
Now that doesn't make sense...
Which PIC are you using and what clock frequency?
I don't think I've seen the individual bitnames being predefined like that...which version of PBP are you using?
/Henrik.
Hi H,
I'm using an 18F2431 PIC in Oshonsoft simulator.
I just tried the 'time = time + 1' option, and also didn't get proper result, so perhaps I didn't get it correct!
Can you confirm that if those bits are correct and they are set to 1 which should make 1:265, instead of the previous 1:2. Should it now be slower?
C.
Hi,
Yes, TMR0CON = %10001111 should be TMR0 enabled, prescaler assigned to it with ratio 1:256. If I where you I'd try it on real hardware, I'm willing to bet it's a simulator issue...
You do realise though that this forum is for MeLabs PBP compiler which is not the same as the Oshonsoft compiler, right? They're both BASIC, they're both for PIC but they are not the same.
/Henrik.
Correction. The simulator doesn't support [I]fully[I] what I'm doing.
Hi,
Bit 3 of TMR0CON needs to be 0 in order to assign the prescaler to TMR0 - I got that backwards in my previous post, you had it correct in your original code.The above have been tested on an 18F4431 (actual hardware) and it does work.Code:TMR0CON = %10000111
/Henrik.
Hi H,
Thanks very much for re-checking. I spend many hours chasing small errors like that. In fact, I couldn't get TMR0 to work because I removed the TIME = 1 with INTCON.TMR0IF = 1, and as the TMR0 is count down not up, this was also backwards. TMR0 is now working.
Thanks, C.
Bookmarks