nck
Newbie level 6
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,
: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,