I would read the port by using:
This will load the value between 0-15 in the byte sized variable pwm_value. If your running @ 4 MHz then you could use:Code:pwm_value.0 = portb.4 pwm_value.1 = portb.5 pwm_value.2 = portb.6 pwm_value.3 = portb.7
This would give you a 50% duty cycle for about 300ms out on portb.0. Or you can use the hardware PWM which is on portb.3.Code:pwm portb.0,127,60
Bookmarks