PIC18f4331 PWM Problem
- From: "ydoubleuz@xxxxxxxxx" <ydoubleuz@xxxxxxxxx>
- Date: Wed, 04 Jul 2007 17:49:56 -0700
Hi Guys.
Wrote a simple program to generate some PWMs. Using MPLAB, the output
are just as expected. However, after writing to a 18f4331 and
observing the output from an oscillator, some pins do not produce the
PWM at all.
2 sources of possible error:
1. Code:
CLRF PORTB
CLRF LATB
MOVLW 0x00
MOVWF TRISB
CLRF PORTA
CLRF LATA
MOVLW 0x00
MOVWF ANSEL0
MOVWF TRISA
movlw b'00001000'
movwf PTCON0
movlw 0xC3
movwf PTPERL
movlw 0x09
movwf PTPERH
movlw b'01000000'
movwf PWMCON0
movlw b'00001111'
movwf DTCON
movlw b'00000000'
movwf FLTCONFIG
movlw 0x00
movwf SEVTCMPL
movlw 0x00
movwf SEVTCMPH
bsf PTCON1, PTEN
movlw b'00000000'
movwf OVDCOND
here
movlw b'00011001'
movwf OVDCONS
movlw b'00011010'
movwf OVDCONS
movlw b'00010110'
movwf OVDCONS
movlw b'00100110'
movwf OVDCONS
movlw b'00100101'
movwf OVDCONS
movlw b'00101001'
movwf OVDCONS
goto here ; Loop forever.
2. Circuitry:
I tied MCLR and all other unused pins to gnd. OSC1 & OSC2 to a 4MHz
crystal.
Observations:
a) Nothing will be observed if PWM4(pin38) is not shorted to ground
for a brief duration. WHY???
b) Some pins (PWM1,PWM2) do not have any output. WHY??? MPLAB shows it
should have.
c) When I burn the prog. into a new chip, (a) is again observed but
now other PWMs do not have outputs instead. WHY WHY??
Tks for your time.
ywz
.
- Follow-Ups:
- Re: PIC18f4331 PWM Problem
- From: BrunoG
- Re: PIC18f4331 PWM Problem
- From: Anthony Fremont
- Re: PIC18f4331 PWM Problem
- Prev by Date: Re: Max input level of a PC soundcard?
- Next by Date: Re: 10KHz-55Khz transformer
- Previous by thread: Variable speed cordless drills not variable?
- Next by thread: Re: PIC18f4331 PWM Problem
- Index(es):
Relevant Pages
|