mbed ArchPro lpc1768

Questions about the BASICtools and MakeItC
basicchip
Posts: 1090
Joined: Fri Oct 19, 2012 2:39 am
Location: Weeki Watchee, FL
Contact:

Re: mbed ArchPro lpc1768

Post by basicchip »

Bit banged PWM is a leftover from the Parallax days, trying to emulate some of their routines. How valuable is it?? Who knows.

TIMER use to use one of the 4 timers (a valuable resource for PWM, capture or other things). On all the Cortex parts TIMER will be implemented with SysTick, which is only a 24 bit counter. It is set to count up to 65 msec and then interrupt and increment a variable. That variable and the 24 bit counter are combined to generate the 32 bit TIMER value. SysTick was not being used for anything else, and IS common to most Cortex parts, so it is easier for us on the firmware side and frees up a timer. Both good things. The down side is for longer times (>65 msec), interrupts must be enabled.

The bit banged PWM was turning off interrupts for a long period, actually probably a NOT very good practice.

So what to do--
Turn on one of the timers for a long period time
Figure out how long 1 loop takes, and then use a loop count for a rough period of time (that's all you would get only checking TIMER at the end of the loop)
Do PWMs with counters, you now have more available.



Post Reply