Home
Prox / RFID
Verichips
Ladder Logic
[interfacing] †
Tube Joints
Key Code From Photo
SolveSpace (3d CAD)
SketchFlat (2d CAD)
Photographs
Miscellany
Resume / Consulting
Contact Me

LDmicro Forum - PWM characteristics

(you are viewing a thread; or go back to list of threads)

PWM characteristics (by Ziggy)
I am using the PWM output with a duty cycle of 50 to drive an electromechanical buzzer.
In order to get the sound going i simply enable the PWM finction with an internal relay contact.
Sound comes on.
However when the relay contact is open the PWM module does not turn off.
In simulation mode the enable path is clearly deenergised, however the module still outputs a tone.
I then altered the approach to controlling the output by changing the dutycycle value for the PWM module.
Duty cycle value changes from 0 to 50 and indeed the tone comes on loudly and turns off.
But it does not turn off fully. There is still an artefact a very narrow pulse at the PWM frequency coming through.

Is a setting of 0 supposed to extinguish any output from the PWM module.
Thu Dec 8 2016, 20:27:20
(no subject) (by Ihor Nehrutsa)
Fragment of LDmicro manual.txt
...
If the input condition to this instruction is true, then the duty cycle of the PWM peripheral is set to the value of the variable duty_cycle.
...

LDmicro use Fast PWM Mode. In this mode zero PWM duty not feasible.

"the output will be a narrow spike" in datasheet.

Fragment of ATmega8A [DATASHEET] at page 87
...
The extreme values for the OCR1x Register represents special cases when generating a PWM waveform output in
the fast PWM mode. If the OCR1x is set equal to BOTTOM (0x0000) the output will be a narrow spike for each
TOP+1 timer clock cycle. Setting the OCR1x equal to TOP will result in a constant high or low output (depending
on the polarity of the output set by the COM1x1:0 bits.)
...

The solution is to apply a new additional PWM_OFF element in LDmicto or use a Phase Correct PWM Mode.
Fri Dec 9 2016, 04:22:06
(no subject) (by MGP)
I think that this is only so with ATmel.

I use pics and as you kan see, 0 pwm = no spikes
Fri Dec 9 2016, 07:32:19, download attachment P1020067.JPG
(no subject) (by Ihor Nehrutsa)
to MGP
You are right, PIC has no this problem.
Sat Dec 10 2016, 06:08:54
Post a reply to this comment:
Your Name:
Your Email:
Subject:
(no HTML tags; use plain text, and hit Enter for a line break)
Attached file (if you want, 5 MB max):