Variable LFO PWM 0.1 Hz

I need to generate a TTL Step pulse with a frequency of 0.1 Hz to 5.0 KHz Really I have 2 descrete speeds at the high end of 2 KHz and 5 KHz (fast return under no load) The lower end of the spectrum I need 100 Hz to 0.1 Hz. I need less than 1% error.

I am considering using a HCT4060 Binary Ripple Counter to get into my range. I am using a Pic to generate the PWM signal. The Pic (Picaxe) generates this PWM signal based on 255 descrete steps. I am conserned about have a PWM period calculation that is not a full step. For instance, If I need a 50Hz PWM and I use a Divider of 8192 that gives me a period for my PWM function of 1.44 and that would be either a 1 or 2 and I would have a 44% to 56% error.

How can I generate an accurate PWM with a resolution of 0.1 Hz?

Reply to
RG
Loading thread data ...

If the hardware attached, responds much slower than the PWM signals cycle period, you and bobble the number back and forth between values to make the average PWM be what you want.

Reply to
MooseFET

To get 0.1Hz resolution on a 100Hz signal, you need a 100KHz clock. Combined with a programmable divider capable of dividing by 2,000, that would satisfy your request, at least from 50Hz to 100Hz: 50.0Hz = 100KHz / 2000 50.1Hz = 100KHz / 1996 50.2Hz = 100KHz / 1992 : 99.8Hz = 100KHz / 1002 99.9Hz = 100KHz / 1001 100.0Hz = 100KHz / 1000 100.1Hz = 100KHz / 999

Getting 0.1Hz resolution at 5KHz would take a 5MHz clock. That's one way.

OTOH, you might be able to combine a programmable prescaler with the 8- bit PWM on your present setup and get a satisfactory combination.

If you need only to make certain frequencies, e.g. integer Hz values, simpler hardware might suffice.

And there are other ways. For example, a PIC programmed in assembly could easily implement a couple big programmable counters--one for period, one for pulse width--and do the whole thing on its own.

Your problem needs more definition. You have to tell us about your hardware. The PICaxe seems to have an 8-bit PWM, is that right? What's its input clock frequency? What kinds of outputs, frequencies, at what frequency steps / resolutions, and what resolution of PWM duty cycles do you seek? What do you really need?

Answer these questions, and you probably won't need our help!

Cheers, James Arthur

Reply to
James Arthur

James, thanks for your input. Yes the PICaxe has an 8-bit PWM and runs a 4 MHz although it can be overclocked to 4,8,16 Mhz and underclocked down to 0.031 MHz. with prescalers and has the option for crystals/oscillators.

I am thinking I can microstep somewhat to get the frequencies up higher but then my motor torque will be dropped.

Here are the microchip equivalents PICAXE-08 PIC12F629 =B7 PICAXE-08M PIC12F683 =B7 PICAXE-14M PIC16F684 =B7 PICAXE-18 PIC16F627(A) =B7 PICAXE-18A PIC16F819 =B7 PICAXE-18X PIC16F88 =B7 PICAXE-28A PIC16F872 Superseded by 28X1 =B7 PICAXE-28X PIC16F873A Superseded by 28X1 =B7 PICAXE-28X1 PIC16F886 =B7 PICAXE-40X PIC16F874A Superseded by 40X1 =B7 PICAXE-40X1 PIC16F887 =B7

I dont know how to program in assembly. The probelm with the 8 bit PWM is that I can not get every possible resolution.

What If I used a divider for 0.1, 1, 10, 100, 1000. and used a Then I could trigger the ones needed and add up the wave forms. I am not an EE so I am winging it here! Would this work?

Reply to
RG

Long Live Analogue +- 3dB

martin

Reply to
martin griffith

Sorry, I missed your reply.

Meanwhile...this is for a stepper motor? Why not just run the PWM as fast as it goes, and update the values at whatever rate you want to step your motor?

What is it exactly you're trying to do?

Best, James Arthur

Reply to
James Arthur

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.