Hi again,
Im sorry... I just returned from work and checked the datasheet for the 'F84 and it doesn't have TMR1. It does, however have TMR0 and a prescaler that you may be able to use as long as you turn off the WDT.
If I where you I'd consider changing that 'F84 to something like the 'F628 if at all possible. If you NEED to run it on the 'F84 let us know...
Here's a quick non tested example of how you could use TMR1 on 'F628. It doesn't use interupts it only polls the TMR1 interupt flag to se if it has rolled over.
Hope that helps a bit more than my first suggestion.Code:Loop: If PortB.1 = 0 then Goto Loop 'Wait here until PortB.1 goes high. SetPulse: 'Preload TMR1 ((232*256) + 143 = 59535) TMR1H = 232 TMR1L = 143 High PortB.1 'Set the output. T1CON.0 = 1 'Start the tmr. WaitForTimeOut: If PIR1.0 = 1 then 'The time is up... Low PortB.0 'Turn off the output T1CON.0 = 0 'Stop TMR1 PIR1.0 = 0 'Reset the TMR1 Interupt Flag TMR1H = 232 'Reload TMR1 so it ready for the next pulse TMR1L = 143 Goto Loop Endif 'Do your other stuff here..... 'Don't use any time consuming pauses etc. Goto WaitForTimeOut
/Henrik Olsson.




Bookmarks