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.

How to ajust light of LEDs using PIC16F877 PWM (HiTech C)

Status
Not open for further replies.

Rksk

Newbie level 2
Joined
Aug 31, 2011
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,293
Please help me on the topic "How to ajust light of LEDs using PIC16F877 PWM (HiTech C)".
 

Book: PIC Microcontrollers - Programming in C
.............4.8 EXAMPLE 6.............

**broken link removed**
 
  • Like
Reactions: Rksk

    Rksk

    Points: 2
    Helpful Answer Positive Rating
this is the PWM initialization code which I used for audio out. Any way, you just read the PWM part in the datasheet and then try to understand the below code.
Code:
void pwm_init()
     {
      TRISC1=0;
      T2CKPS1=0;
      T2CKPS0=0;
      PR2=0x50;
      CCPR2L=0x17;
      TMR2ON=1;
      CCP2CON=0b00001100;
      }

void pwm_disable()
	{
	CCP2CON=0b00000000;
	}

void pwm_enable()
	{
	CCP2CON=0b00001100;
	}
----------------------------------------------------------------------------------------

Now update the value in CCPR2L register to change the dutycycle.
 
Last edited:
I don't know even basics of PMW.
Can anyone help me to learn it?

---------- Post added at 11:41 ---------- Previous post was at 11:40 ----------

I don't know even basics of PMW.
Can anyone help me to learn it?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top