|
|
View previous topic :: View next topic |
Author |
Message |
dossdev
Joined: 08 Jul 2009 Posts: 24
|
Pseudo Timer Interrupt with PIC16F506 |
Posted: Wed Aug 18, 2010 9:17 pm |
|
|
Hello all,
In the all mighty search for the least expensive PIC for the job, I've discovered the 16F506 which, unfortunately, does not have one single interrupt. I guess you get what you pay for. Anyway, all I really need is a way to spoof the little PIC into thinking there's a timer 0 interrupt. Not much of a chance for the real thing, but any clever ideas would be much appreciated.
Thanks in advance for your comments.
Dan |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19505
|
|
Posted: Thu Aug 19, 2010 3:57 am |
|
|
It depends massively on what you actually 'want'...
If you look back to the earliiest Windows multi-tasking, if code sat doing something like polling the keyboard, other programs didn't get called. This is the same situation you would have with any 'pseudo' interrupt. The point about the 'real' interrupt, is that it can interrupt code that is running. Any 'simulation', is not going to do this. What you can do, is have a 'test' routine, that you call wherever you can in your main code loop. In this, you read the timer, and compare it with the last reading. If the new reading is _less_ than the last reading, then the timer has 'wrapped' since the last call, and you can then call the code you want to execute.
You would obviously need to code all your routines in the 'main' loop, to call this regularly.
Seriously, 'reconsider', and switch to the 16F616. Pricing is basically the same (in fact in bulk this seems to be cheaper now), and you gain multiple timers, interrupt support, etc. etc..
Best Wishes |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|