I sure will. Providing I come to a conclusion.
I'll keep at it.
Well,
Here is how I got it to count 4 pulses and stop "Hmtr". This works perfect every time although I'm sure there is a way that I could be able to just change a single number from say 4 to 5 in order to change the count, I just haven't figured it out yet.
But, if the last pulse doesn't occur at (While DATAPLS=0) the motor continues to run. Of course.
Can I use Timer1 ETC. to set a maximum motor run time of say 10 sec. ?
Thanks, I appreciate any help.
Code:High Hmtr Pause 10 While DATAPLS=0 Wend Low Hmtr Pause 50 High Hmtr Pause 10 While DATAPLS=0 Wend Low Hmtr Pause 50 High Hmtr Pause 10 While DATAPLS=0 Wend Low Hmtr Pause 50 High Hmtr Pause 10 While DATAPLS=0 Wend Low Hmtr Pause 50 GoTo Startloop
franko,
yes, you can use TIMER1 module. provided that you initialized it properly and then poll a counter if it reached a 10s mark. I've been using TIMER1 register for some time. A advice you set the prescaler to 1:8 setting since you have a way to long to wait.
I could have just gave you some of ideas since it will be more satisfying if you find it yourself.
have a nice day!
regards,
yettie
We should learn "KISS" - Keep It Simple Stupid...
Will the timer run independently from the main code ? Like "in the background" ?
I ask this since the main program will be stuck at the (While) statement.
Thanks
franko,
yes. once the initialization process of TIMER1 interrupt is complete and activating the start of counter, the timer will run in background as you work on your main code. it will only then be entering the interrupt service routine once it reached the overflow anytime and anywhere while you are working on your main routine.
regards,
yettie
We should learn "KISS" - Keep It Simple Stupid...
I read about the timer(s) running in the background in Melanie's Olympic timer.
I've looked through the data sheets. How does one learn more about how to use the timer functions ? Proper way to write the code ? Reccomended books ?
Thanks,
Franko
franko,
good day! i had not read any reading materials except for the microchip datasheet. you can have a guide there of what bits you will manipulate. for TIMER1, such bits are T1CON, PIE1.1, PIR1.1, and for interrupts INTCON. you would want to experiment it and discover what you can do. I bet it will be more satisfying. Melanie's olympic timer example is your best guide. I'm sure you can do it.
regards,
yettie
We should learn "KISS" - Keep It Simple Stupid...
Bookmarks