??? 03/04/05 02:07 Read: times |
#89062 - Andy / Steve.. Responding to: ???'s previous message |
Well yes the problem is one of getting stuck at the four points as mentioned by me. I did try out a trick like this :
- Configure the Timer 2 for a 10mS time out. - Start the Timer2 first thing after the 100mS delay function. - Stop Timer2 as the last event before exiting the While(1) loop. - And inside Timer2 ISR, have a counter increment for every call. If the counter reaches 5 ( =50mS), reset the display to Zero. And also reset the Counter. //---------------------------------------------- /* Timer_2 is used as the timeout timer for the software multiplexed display. It is set to run at 10ms interval and if there is no pulse for this (duration x 5 = 50mS ) clear`the display..*/ void timer2_int(void) interrupt 5 { ++timeOut; TF2 = 0; if (timeOut == 5) { tmpResult = 0; sprintf(dispBuffer, "%04lu", tmpResult ); timeOut = 0; } } //----------------------------------------------- This logic works most times, but there is this occasional "0" reading even when the rpm is in the valid range. Maybe there is a flaw somewhere in the logic or implementation.. My minimum speed range is well above 100 rpm. Is there any other elegant way ? Thanks for your time. Raghu |
Topic | Author | Date |
Clearing the display... | 01/01/70 00:00 | |
Infinite loops | 01/01/70 00:00 | |
SLOWEST speed ? | 01/01/70 00:00 | |
Andy / Steve.. | 01/01/70 00:00 | |
But wait, there's more! | 01/01/70 00:00 | |
One method.. | 01/01/70 00:00 | |
A way to implement a simple ramp down![]() | 01/01/70 00:00 |