guys....i need your help me to programming the coding to generated the PWM signal using PIC18F4550....
i already build the test board using 8mHz crystal...but no idea how to coding the pic to generated the PWM signal....
what i want to do with my circuit is.....PIC will compare the input voltage from my sensing circuit and will stop the PWM signal if the input voltage is higher than the reference voltage.
for example....3V as reference voltage....if the sensing circuit give the higher input voltage than 3V to pic....pic will stop generate the PWM signal until the voltage is back to 3V....
Umm... Don't you mean section 15.0 - CAPTURE/COMPARE/PWM (CCP) MODULES?
Read it all, but look especially at the PWM section, 15.4. The step-by-step setup instructions are at 15.4.4 - SETUP FOR PWM OPERATION.
15.4.4 SETUP FOR PWM OPERATION
The following steps should be taken when configuring the CCP module for PWM operation:
1. Set the PWM period by writing to the PR2 register.
2. Set the PWM duty cycle by writing to the CCPRxL register and CCPxCON<5:4> bits.
3. Make the CCPx pin an output by clearing the appropriate TRIS bit.
4. Set the TMR2 prescale value, then enable Timer2 by writing to T2CON.
5. Configure the CCPx module for PWM operation.
As you write code for each step, refer to section 15.0 for the register values you need to set, and 13.0 for setting up Timer2.
That's pretty much all there is to it. To change the PWM duty cycle for your selected pin, just write to CCPRxL if you only need 8-bits resolution (256 PWM levels), leaving the two Lsb bits set to 0, and if you need the full 10-bits (1024 PWM levels), also write to the 1 and 0 Lsb's at CCPxCON<5:4>.
thanks for help me....can your guys give me the coding can i use for this project...i just have 1 week now to finish it....very2 blur now....i using picbasic pro.....
please help me guys...i'm very2 new in this PIC prog.....