State1 movf Temp,W ;b'00000111' --keep posision
movwf PORTB
call PWM_Speed ;do PWM for a moment
btfss STATUS,Z ;//
goto State1
;
State2 rlf Temp,W ;b'00001110'--keep posision
movwf PORTB
call PWM_Speed ;do PWM for a moment
btfss STATUS,Z
goto State2
State3 movf Temp,W ;b'00011100'--keep posision
movwf Temp1
rlf Temp1,F
rlf Temp1,F
movwf PORTB
call PWM_Speed ;do PWM for a moment
btfss STATUS,Z
goto State3
You can see now LEDs brightness levels suddenly decrease from 100 to 10 in the state 2 & decrease brightness level from 250 to 100 in the state 2.Likewise when every state changing there is a big gap.This is a big gap when the circuit is running speed you can see that as a flickering.
When changing the state it must change in a linear way.Thats what I have to do.In the above codees it has a big gap between each state changing.Thats why it looks like flickering.
Hi,
What's the interrupt rate?
Here's my idea:
In ISR rotate Shadow register and send to PORTB. You can use another register to determine the number of rotation. So you can have other jobs in the main loop.
The clue: the shifting speed should not be the same as the PWM speed. Shifting speed should be slower. That's why you see it flickering.