I have read the PWM listing that was posted earlier this month and have considered that in my code. I am trying to imitate the fading and slowly turning on effect using pbp using SOFTWARE PWM because the PIC that I am using does not have a HARDWARE PWM. I am running my PIC at 20Mhz. please help.. any advise is greatly appreciated... here is what I am doing....

==== program starts here====
include "modedefs.bas"
Duty VAR WORD
Cycle0 VAR BYTE
Cycle1 VAR BYTE
LED1 VAR PORTB.4
LED2 VAR PORTB.5
TRISB = %00000000

'How long it will take for the PWM to occur
Cycle0 = 10
Cycle1 = 10

'Turns Off the LEDS SLOWLY
For Duty = 255 to 0 Step -1 'going from ON to OFF state.
PWM LED1, Duty, Cycle4 'sends a string of pulses
PWM LED2, Duty, Cycle5 'sends a string of pulses
Next Duty
'Turns On the LEDS SLOWLY
For Duty = 0 to 255 'Going from OFF to ON STATE
PWM LED1, Duty, Cycle0 'sends a string of pulses
PWM LED2, Duty, Cycle1 'sends a string of pulses
Next Duty
GoTo start

==========program ends here=====

I am seeing the flickering of the LEDs instead of a smooth fading effect that I am suppose to see. I have read the manual and it says that the duty needs to be from 0 (0%) to 255(100%) I am not seeing the gradual fluctuation in the intensity of the light, but instead I see the LEDs flicker on and off very fast, with the same intensity when they are on. Any help with what I am doing wrong is greatly appreciated. Thanks in Advance

Srigopal