CCPMX_ON .... that should be off....
I found a working program from steve in another thread:
@ DEVICE MCLR_ON, INTRC_OSC, WDT_ON, LVP_OFF, BOD_OFF, PWRT_ON, PROTECT_OFF, CCPMX_ON
OSCCON=$60 ' use internal 4MHZ osc
PAUSE 100 ' start-up delay
TRISB=0
DEFINE CCP1_REG PORTB
DEFINE CCP1_BIT 3
HPWM 1,128,1000
HERE: GOTO HERE
I just change the oscillation to 20Mhz, and it si not working: I think this is the problem..
I change the program to:
@ DEVICE MCLR_ON, HS_OSC, WDT_ON, LVP_OFF, BOD_OFF, PWRT_ON, PROTECT_OFF, CCPMX_ON
DEFINE OSC 20 'use external 20mhz crystal 'OSCCON=$60 ' use internal 4MHZ osc
PAUSE 100 ' start-up delay
TRISB=0
DEFINE CCP1_REG PORTB
DEFINE CCP1_BIT 3
HPWM 1,128,1000
HERE: GOTO HERE
19531Hz for a 20Mhz
I remember using 5Khz for one of my project for motor driver PWM.
How can I change steve's program to use a 20Mhz crystal?
well 10800hz fall well within those range , so no problem there.
k
Bookmarks