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.

For controlling the LED brightness with PWM

Status
Not open for further replies.

nck

Newbie level 6
Joined
May 5, 2007
Messages
13
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,646
hi;
:idea:I have got controlling the led brightness with PWM by using RB3 Pin in <PIC -16F628A> .That pin can be used capture/compare/pwm .But I have poor knowledge in pic,I don't really know how to control the other LED output for brightness.If i used all Port b pins to output execpt from RB3 ,how to control the other pins . The source code describes as follow:


InitPWM
bsf STATUS,RP0
movlw b'00000001'
movwf T2CON ; prescale:16 (3.2-usec ticks)
movlw d'40' ; 40 3.2-usec 'ticks'
movwf CCPR1L ; 80% duty cycle bsf STATUS,RP0 ; select bank 1
movlw d'200'-1 ; 200 3.2-usec 'ticks'
movwf PR2 ; Period:160-usecs (6.25 KHz) bcf TRISB,3 ; make RB3/CCP1 pin output
bcf STATUS,RP0 ; select bank 0
movlw b'00001100'
movwf CCP1CON ; put CCP module in PWM mode
bsf T2CON,TMR2ON ; turn on TMR2

Dec
call Delay
DECFSZ CCPR1L,1
goto Dec

Inc
call Delay
incf CCPR1L,1
xorwf CCPR1L,d'200'
skpz
goto Inc
goto Dec

So,anyone can help me! Please tell me source code and requirements for all.
Thanks for all,
 

You might consider modulating an NPN or NFET sinking driver transistor with the PWM signal. Connect your LED anodes to RB0 through RB7 (these would be "sourcing outputs") and connect all eight cathodes to the sinking driver transistor.
 

hi;
:cry:I don't know that RB 3(pin 9) is the one which produces pwm signal ,so we can use this pin to output.Please explain to me clearly know about that.The PIC which i used is 16F628A and the output PINs are RB0 ,RB1 ,RB2 ,RB4 ,RB5 ,RB6 ,RB7 .I tried to build it but i 'm not clearly about that .Please help me again.
Thanks for all

Added after 1 minutes:

hi;
:cry:I don't know that RB 3(pin 9) is the one which produces pwm signal ,so we can use this pin to output.Please explain to me clearly know about that.The PIC which i used is 16F628A and the output PINs are RB0 ,RB1 ,RB2 ,RB4 ,RB5 ,RB6 ,RB7 .I tried to build it but i 'm not clearly about that .Please help me again.
Thanks for all
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top