4 Channel Timer/Counter

Post details of your projects here.
danlee58
Posts: 210
Joined: Thu Jan 17, 2013 2:29 am

Re: 4 Channel Timer/Counter

Post by danlee58 » Wed Oct 14, 2015 10:11 am

I have code for a Coridium SuperPro board from a previous project. I used the SuperPro on that project because I needed a DAC output. I could save some money, by using a ProPlus on this project. Will my setup code be different from the SuperPro? It may be worth the extra money, if I can reuse some code.



olzeke51
Posts: 317
Joined: Sat May 17, 2014 4:22 pm
Location: South Carolina
Contact:

Re: 4 Channel Timer/Counter

Post by olzeke51 » Wed Oct 14, 2015 2:09 pm

Hi, - what code size are you anticipating ??
Super has - 128k user code space (10,000 Instructions)
16k user data
Plus has - 20k user code space (1600 Instructions)
5k user data
*
Plus has no +5v available
Plus has no DAC
*
no apparent special files in Basiclib, no #ifdef for the different chips in LPC17xx.bas
pin assignments are the same (an issue I had between two different chipset namings - NXP improvement)
?
Same amount of Timers ?? I didn't look at the spec sheets!
*
Looks like a go from here -- Olzeke51

danlee58
Posts: 210
Joined: Thu Jan 17, 2013 2:29 am

Re: 4 Channel Timer/Counter

Post by danlee58 » Thu Oct 15, 2015 11:28 am

I'll stick with the SuperPro. The money savings for the ProPlus is not worth the risk that I'll need something that isn't available with the ProPlus for a single quantity. If I ever have a market for this, I can look at the ProPlus again.

danlee58
Posts: 210
Joined: Thu Jan 17, 2013 2:29 am

Re: 4 Channel Timer/Counter

Post by danlee58 » Sat Oct 24, 2015 11:23 am

I need 4 Match Pins. P1.28 is Mat0.0, P1.25 is Mat1.0, P0.10 is Mat 3.0, but there is no Arduino compatible pin for Match2 Register.

How can I get 4 Match Register output pins?

danlee58
Posts: 210
Joined: Thu Jan 17, 2013 2:29 am

Re: 4 Channel Timer/Counter

Post by danlee58 » Sat Oct 24, 2015 4:49 pm

I'm only going to use 2 Match pins. I'll use P1.28, and P0.10. I'll multiplex the outputs and double the duty cycle of MR0.0, and MR3.0.

I need to use Timer1 as a Capture Timer. I want to start Timer1 on the falling edge of P1.18, and capture TC1 on the rising edge of P1.18. Should I just poll & clear TC on the falling edge, then Interrupt on the rising edge & reset?

Can I poll P1.18, when it's used as a Capture pin?

basicchip
Posts: 853
Joined: Fri Oct 19, 2012 2:39 am
Location: Lake Tahoe, CA
Contact:

Re: 4 Channel Timer/Counter

Post by basicchip » Sun Oct 25, 2015 10:28 pm

You can always read the state of an input even if it is used as special purpose pin.

You should be able to use the capture hardware to reset the timer or do it on an interrupt.

basicchip
Posts: 853
Joined: Fri Oct 19, 2012 2:39 am
Location: Lake Tahoe, CA
Contact:

Re: 4 Channel Timer/Counter

Post by basicchip » Sun Oct 25, 2015 10:29 pm

There are many more match pins, you can jumper over to them to connect to Arduino pins for a shield.

danlee58
Posts: 210
Joined: Thu Jan 17, 2013 2:29 am

Re: 4 Channel Timer/Counter

Post by danlee58 » Mon Oct 26, 2015 2:38 pm

I need a Low True output on Match 0.0 (P1.28), and Match 3.0, (P0.10).
How can I make the External Match Outputs Low true?

How long does the Match Pin stay true?

Should I set Tx_MCR to 0x040 to stop the timer, until I start it again, so the Match Pin stays True?

basicchip
Posts: 853
Joined: Fri Oct 19, 2012 2:39 am
Location: Lake Tahoe, CA
Contact:

Re: 4 Channel Timer/Counter

Post by basicchip » Mon Oct 26, 2015 3:20 pm

I don't really know what you are trying to do, but most of the time I reset the counter on a match, if you need to change the next match time then you should generate an interrupt on match as well and reprogram the registers.

As for the match output pin, you can use the match to set the pin high or low or to toggle or do nothing. It will stay in that state until the next match.

danlee58
Posts: 210
Joined: Thu Jan 17, 2013 2:29 am

Re: 4 Channel Timer/Counter

Post by danlee58 » Tue Oct 27, 2015 2:10 am

I generate an Interrupt on Match & set Tx_MCR to 0x40 to stop the timer. The external match pin should stay True until I reset the timer elsewhere in the program.

I'm still not sure how to get the External Match pin to go Low True on a match. Do I have to output a Zero in my interrupt routine?

Post Reply