c - How do you make a timer for PIC18? -
for life of me can't make timer pic18 or precisely pic18f87j11. want have counter increments every 1 second. want monitor how long pic18 been running in terms of seconds.
most of tutorials out there pic16 , in assembly. trying using c programming. beginner understand better if see examples, without examples can't progress.
please show me example, thank you!
to begin understanding timers need have @ documentation. suggest searching manufacturers website. there 5 timer available. if use timer0 either 8 bit or 16bit timer. need set correct configuration t0con. need have correct interrupt settings (intconbits), event can generated interrupt service routine once timer expired.
you need calculate prescale value require correct timing, in case 1 second. depend on fosc: here tutorial here example of c code using mplab , 1 based on mplab , hi-tech compiler. not same chip, based on pic18f family.
it's been awhile since have visited pic18f, if correction required, please so.
Comments
Post a Comment