Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Pwm frequency of pic12f1501

Status
Not open for further replies.

anjalimidhuna

Member level 3
Member level 3
Joined
Jan 4, 2014
Messages
62
Helped
2
Reputation
4
Reaction score
2
Trophy points
8
Location
india
Visit site
Activity points
358
Hi,
My project is a simple light dimmer.I connected a port to AN1. adc values are given to pwm1.I am getting only half of the expected frequcy. pic12f1501 is my controller.following is the code that i used.

Code:
void main() {

    TRISA2=0;           
    TRISA3=1;
    OSCCON=0xF3;
    OSCSTAT=0x10;
    adc_init();
    T2CON=0x04;      
    while(TMR2IF==0);
    TMR2IF=0;
    PR2=0xC7;
    PWM1CON=0xE0;
   while(1)
    {
      while(ADGO==1);
      ADGO=1;             
      PWM1DCH=ADRESH;     
      PWM1DCL=ADRESL;     
    }
}
 
Last edited:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top