Re: Timing pulses



BobS wrote:
On Aug 18, 11:55 am, Joerg <inva...@xxxxxxxxxxxxxxx> wrote:
BobS wrote:
On Aug 16, 5:01 pm, Joerg <inva...@xxxxxxxxxxxxxxx> wrote:
BobS wrote:
On Aug 14, 12:14 am, Nobody <nob...@xxxxxxxxxxx> wrote:
On Thu, 13 Aug 2009 08:40:16 +0100, Martin Brown wrote:
8 bit accuracy is adequate. A micro has not been selected pending
arriving at a scheme for this task, preferably the smallest micro
possible for cost and space. The micro does have to manage a 25 Hz
PWM out in addition to the input pulses.
8 bit resolution of a 12.5ms period is 50us steps? That is huge - almost
anything should be able to do that adequately. Most of the discussion so
far has been about obtaining sub us timing precision with a micro. You
might even manage 16bit accuracy with a free running 5MHz clocked timer
register that you read whenever an edge triggered event occurs.
The cheapest PIC with a dedicated PWM output would be my choice.
At 25Hz PWM frequency, I wouldn't even bother with the "dedicated PWM"
bit. A PIC10F200 would be more than adequate, and I'm not sure I'd even
bother using the timer.
From just the external I/O stand point the PIC10 series is appealing,
since could handle this as a digital task. Since there is a dearth of
internal peripherals, the initial thought for firmware is a single
loop continuously cycling through input, calculation, and output
code. The loop time would be the time base, and would be empirically
determined with constants and variables set accordingly. Is there a
possibility this would work? What else should be considered?
I wouldn't use loop times as time bases. Can blow you out of the water
if something happens in the background, like a WDT handler. Take a look
at the one I suggested in anotehr post in this thread. Contains a nice
timer plus a PWM.
--
Regards, Joerg
http://www.analogconsultants.com/
"gmail" domain blocked because of excessive spam.
Use another domain or send PM.- Hide quoted text -
- Show quoted text -
Thanks Joerg, Would you consider running with the WDT disabled?
Absolutamente no, I would not disable that. The WDT just runs in the
background. As long as you ping it regularly it'll be happy and if it
missed a few pings it (usually correctly) assumes that the uC or the
code froze up.

Also, it appears that the PIC's mentioned above, and others, can not
run a PWM out at 25Hz. with common settings. How can 25Hz PWM be
obtained without running the clock insanely slow?
AFAIU you can hang a prescaler up front on the PIC12F683 timer, via
firmware commands. No soldering required :-)

But you'd have to study this for yourself, starts around page 75:

http://ww1.microchip.com/downloads/en/DeviceDoc/41211D.pdf

--
Regards, Joerg

http://www.analogconsultants.com/

"gmail" domain blocked because of excessive spam.
Use another domain or send PM.- Hide quoted text -

- Show quoted text -

Joerg and others, thanks for the suggestions.
I studied over the 583 data *** PWM section, and could not see how
to get a PWM frequency within an order of magnitude of 25 Hz with a
4mHz clock. This is per Equation 11-1. Am I missing something?
Also, in the Capture mode, how is the timer reset to ‘0’ for the first
pulse? Does it have to be loaded to 0 or use a reset?


I am not at all a uC guys but just as an idea:

AFAIU most PICs aren't very flexible with CC registers. What if you'd let timer 2 just count at, say, 9.8kHz (4MHz master, prescale 4, PR2 at 0x65) and then software counts that out. 25Hz would be 392 slots where you can set an output high for a fixed number of those 392 time slots and this would become your PWM.

I think the clear command would be CRLF but mayeb we have a PIC expert here in the group. Yo, Jan?

--
Regards, Joerg

http://www.analogconsultants.com/

"gmail" domain blocked because of excessive spam.
Use another domain or send PM.
.


Quantcast