I have seen something like this before, my timer worked fine then suddenly = it would go berserk and shoot off into hyperspace, after trying everything = we could think of I noticed a hair-line solder bridge between two outputs, = so when one turned on it tried to drag the other one up and the PIC didn't = like it at all, but crucially didn't totally stop working either. It wasn't visible with the naked eye, and we only saw it when we got the = board under a microscope, it's worth considering, we got too stuck on the = software and didn't consider a hardware problem could possibly cause an = apparent software problem :{ Good luck ! Jonathan Starr R&D Technician Electronix Limited Tel +44 (0)1993 700510 Fax +44 (0)1993 700511 e-mail jonathans@electronix.co.uk=20 web www.electronix.co.uk=20 This e-mail has been sent to you by Electronix Ltd. This communication is intended for the addressee only, is private and=20 confidential, and is subject to the applicable terms and conditions. If you are not the intended recipient, any disclosure, copying or distribution of this information is strictly prohibited. -- >Hi Peter. >I just did an MPLAB sim on your asm version. It works as you would = expect. >I also ran it as a 16C73 on my trusty old PICmaster emulator (won't do >877s) and it works the same as the sim. TMR0 increments by ones and >twos = as >advertised depending on the instruction type. BTW, your equates need to = >be >moved up to 0x20 or higher. Right now, they are in the middle of the = SFRs. > >Now for the real question -- is your program really working and your >emulator just isn't showing you or is there really something wrong? What >you should do is calculate your TMR0 interrupt rate and toggle an output >pin. Monitor the pin with a scope to see if it happens at the right = rate. >If it does, at least you can keep developing with some degree of = confidence >until we can sort out why TMR0 doesn't look like it works. If not, might >be time to call your emulator manufacturer and talk to him. > >Bill > >At 08:08 AM 06/10/2002 +0100, you wrote: > http://www.piclist.com/postbot.asp?id=3Dpiclist\2002\06\07\153942a=20 > >Thanks for the reply and yes I hadn't assigned the Prescaler in that example,BUT this is not the real problem. > >I have written other code to select the prescaler for the TMR0 but is not that the PIC isn't counting/timing at the correct rate it's more drastic...= . > >*** the TMR0 register is just RANDOMLY changing **** >I can see no sequence in the numbers at all. They appear to just change = at will on every instruction. > >When I run this in the simulator all is well and I get the TMR0 register changing as expected. >So why NOT on the real hardware??? > >I have now written it in assembler and still I must be missing something obvious... > >; Use PIC16F84 and set radix system to decimal > LIST P=3D16F877, R=3DDEC > code snipped... -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu=20 -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu