setting counters with timers

Enhanced mid-range devices. PIC12F1xxx and PIC16F1xxx

setting counters with timers

Postby eagle1 » Thu Nov 20, 2014 5:16 am


how to set a counter to count times of processes

should i set TIMER0 as a counter when counting and as a timer when calling delays ?

i set a counter >> then decfsz to count no. of times and it did not work
Posts: 2
Joined: Wed Nov 19, 2014 12:24 pm

Re: setting counters with timers

Postby AussieSusan » Fri Nov 21, 2014 2:40 am

I must admit I'm not sure what you are trying to achieve or on what device - different devices have differing peripherals and differing ways of doing things.
If you are wanting to count the number of cycles between to events in your program, then I would initialise the timer to 0 and then start it (assuming it is one that counts up), do whatever needs timing and then stop the timer and look at the count.
If you want to count the time between 2 external events then the input compare peripheral may be better or a gated timer if such exist on your device.
Verified identity
Posts: 115
Joined: Mon Jun 16, 2014 4:45 am
PIC experience: Experienced Hobbyist

Re: setting counters with timers

Postby ric » Fri Nov 21, 2014 9:19 am

As always, if you tried something, and it didn't work as you expected, then SHOW THE CODE.
Just describing what you wanted to code to do doesn't help, we need to see the actual code.
Latest test project, an LED matrix display made from one reel of addressable LEDs. here
User avatar
Verified identity
Posts: 525
Joined: Sat May 24, 2014 2:35 pm
Location: Melbourne, Australia
PIC experience: Professional 5+ years with MCHP products

Return to 14-Bit Core (enhanced)

Who is online

Users browsing this forum: No registered users and 1 guest