First there is no RB8, there is a RB7 though which is the 8th bit.
Are you reading a DIP switch or something?
First there is no RB8, there is a RB7 though which is the 8th bit.
Are you reading a DIP switch or something?
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
Hi
Thanks for help.
Those 4 bits I get from PC parallel port.
I would like to know how to use HPWM?
Milan
I think about the only thing you have to do is:
The first line starts the PWM at whatever value is stored in the pwm_variable at 32.767kHz. It then pauses for 300ms then turns off the HPWM.Code:hpwm 0,pwm_value,32767 pause 300 CCP1CON = 0
Bookmarks