-
signal integrity
Hi, I was wondering if anyone cna help me with this piece of code that I am trying to generate, I am trying to do this in software but not getting the output that I really want. I am using the PIC16F777 as the pic of choice. and trying to generate a constant 120Hz PWM but it seems to not work. any help with this would be greatly appreciated. Thank you....
'========================'
here is the code that I have :
LOOP1:
duty = duty + 1
A = duty * 79
PortC.5 = 0
Pauseus 10033 - A
PortC.5 = 1
Pauseus A
if(duty < 127) then goto LOOP1
if(duty >= 127) then return
'======================='
-
Ohh I forgot.. the code that I have above only lasts for like 1 or 2 seconds. how do I make it so that it will lasts for like 4-5 seconds. thankss
-
PAUSEUS 10033 is an invalid task IMO
As i understand you want to generate a constant PWM and change duty while it's running?!? Like a 5 sec fade-in or fade-out ??
There's certainely more than one method to do it. Can you provide the crystal frequency you're using ???
-
I am using 20 MHz ... for the crystal.
I have included
DEFINE OSC 20 on top of my code.
-
the PwM should go from 0 to 100% duty with 120Hz constant frequency ... in lets say it takes 5 seconds to ramp up ...