Johan
- 16th October 2007, 16:50
Hello,
I just made an experiment with 18F4431 again.
The blinky program works, and now I want to have multiple / simultanous HPWM
My code did not work, How to setup so the RB0,1,2,3 become PWM PORT ? Is there any other register to modify ? Thanks
DEFINE OSC 8 ' Oscilator HS
TRISA = %00000000 ' Set PORTA to all output
TRISB = %00000000 ' Set PORTB to all output
TRISC = %00000000 ' Set PORTC to all input
TRISD = %00000000 ' Set PORTD to all output
TRISE = %00000000 ' Set PORTE to all output
ANSEL0= %00000000 ' Analog channel AN0-AN7 off
ANSEL1= %00000000 ' Analog channel AN8 off
main:
hpwm 0, 100, 7000 'RB0 as hpwm output
hpwm 1, 180, 7000 'RB1 as hpwm output
hpwm 2, 250, 7000 'RB2 as hpwm output
goto main
I just made an experiment with 18F4431 again.
The blinky program works, and now I want to have multiple / simultanous HPWM
My code did not work, How to setup so the RB0,1,2,3 become PWM PORT ? Is there any other register to modify ? Thanks
DEFINE OSC 8 ' Oscilator HS
TRISA = %00000000 ' Set PORTA to all output
TRISB = %00000000 ' Set PORTB to all output
TRISC = %00000000 ' Set PORTC to all input
TRISD = %00000000 ' Set PORTD to all output
TRISE = %00000000 ' Set PORTE to all output
ANSEL0= %00000000 ' Analog channel AN0-AN7 off
ANSEL1= %00000000 ' Analog channel AN8 off
main:
hpwm 0, 100, 7000 'RB0 as hpwm output
hpwm 1, 180, 7000 'RB1 as hpwm output
hpwm 2, 250, 7000 'RB2 as hpwm output
goto main