![]() | ![]() | ![]() |
| | |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
| | LinkBack | Thread Tools | Display Modes |
| | (permalink) |
| You can avoid using interrupts by periodically polling the interrupt flag instead of allowing it to trigger an interrupt. If the flag is set, clear the flag, execute the timer routine and then resume other tasks. You only have to poll at a rate faster than 10msec to ensure you don't miss a beat. To a PIC16F876A running at even 4Mhz, 10msec is a long time. In 10msec, the PIC can execute 10,000 instruction steps. That's greater than the F876's program space.
__________________ "Having to do with Motion Control" | |
| |
| | (permalink) |
| That is exactly what the on interrupt command does...... But say you are in a pause statement...... Pause 60000... that is 60 seconds.... your interrupt will not ocurr until 1 minute has passed.... not a real interrupt. Just something to have in mind... how to manage and how important is to interrupt. Ivancho | |
| |
| | (permalink) |
| I have got a lot of good information now. I am going to sit down now i try to get it working. Thanks! | |
| |
| | (permalink) |
| what triggers your laptimer..??? i want also to build one that works whit radio freq.. on a small range.. TKS | |
| |
| | (permalink) |
| Just how much precision do you need? You can work from any clock you want. Say you have 20MHz crystal, 5 MHz instruction cycle: Set TMR0 to 8 bit mode with a 4x prescalar. So you've got 1024 instruction clks, 0.2048 mS per interrupt. So keep a 16 bit counter in addition to the mS count. On TMR0 interrupt: counter16=counter16+2048; if(counter16>=10000){ mSCount=mSCount+1; counter16=counter16-10000; } At worst case, you're 48 instruction clocks off. | |
| |
| | (permalink) |
| Can anyone design me a circuit that when a button is pressed at intervals the device displays on a LED what the beats per second were? And change as the rate of pressings change. Thus if the button is pressed with 1 second intervals the LED display would show "60". Range up to 60 beats/sec only and small enough to fit inside a hand held stopwatch sized enclosure. Accuracy is not important - within 5%. | |
| |
| | (permalink) |
| I wrote a tutorial on 4 different method to create RTC quality timings from a PIC using interrupts. Here is a tutorial and 4 examples of the approach: http://www.sfcompiler.co.uk/wiki/pmw...shUser.SoftRTC With the correct oscillator you can maintain a 10ms interrupt without a problem. USART is not affected by interrupts (just don't overflow the buffer) and the LCD is synchronous, so it should be fine also. | |
| |
| | (permalink) |
| I am new on this site so forgive my clumsinesses in replying - I believe this will go to the people who responded. My Beat Timer will be triggered by pressing a button such as on a hand held stop watch. The whole thing must be small enough to fit inside an enclosure the size of a hand held stop watch including battery. It only needs a three figure LED display so up to 99.9 beats per minutes (I might have said "per second" before but it is PER MINUTE) display is fine (actually above 70 beats per minute id redundant). It must switch itself off after a short period. If anyone can do this then would you email me at barrie@look.ca | |
| |
| | (permalink) |
| Did you consider the size of the LED display for a box that size? Kind of reminds me of the old handheld calculators with the magnifier bubbles over the LED digits... maybe they're still around. | |
| |
| | (permalink) |
| Stop brining up old threads! Create your own! | |
| |