Cloudy: bedtime reading tonight - Manual 2, "SetTimer" command!settimer off
settimer 65505 'Ticks in ms?
The command sequence is right. 100 forum members could tell you or you could work it out for yourself. At 8MHz, 1 minor tick = 32 uS.... The major tick will be set to.... and you will get interrupts every....Been studying that intensely! 65505 was the preload someone else posted on here for 1ms ticks at 8mhz... Is the settimer off not correct for "resetting?"
James
Good to hear. Yes, you're partly right. How will your program know when the (background) timer has expired if you don't use a timer interrupt?1 ms = 1000us 1000/32 = 31.25 therefore approx 31 minor ticks per ms.
Preload = 65535 - 31
Preload for 1ms ticks therefore = 65504 ?
I'm not looking to generate interupts, this code is already invoked by a pin high interrupt. Don't think I've just posted for the easy answer - I've spent the last 3 hours searching the forum and reading documentation but just can't get my head around it!
James
Thanks Martin,Very interesting doc - although I don't often "chase bytes" in programs it should be useful if I need to.
Might be worth picking the bones out of http://www.picaxeforum.co.uk/showthread.php?t=13262 and adding them at the end.
(and running a spell checker on the doc )
Yes, you could do that. It may be simpler to just have a loop counter and exit if you get an ADC ready within the right range or when the loopcounter expires.I was hoping to query the timer value during my goto loop - if the value is less than my preload then the timer must have major ticked and looped round - perhaps that's not a bombproof statement!
Basically all I want to do is check readadc for 200ms, if the adcvalue is a certain one then bail out of the 200ms loop early....
James