Yes it was the watchdog, I already found it. :-) Thx anyway!
Matti
--- In , "rtstofer" <rstofer@p...> wrote:
>
> Are you certain you have the watch dog timer turned off? It will
do
> a PIC reset periodically.
>
> --- In , "Matti Laevaert"
> <matti.laevaert@w...> wrote:
> > Hello,
> >
> > I experience some problems with a usual PIC-delay, written in
> > assembler (with MPLAB IDE).
> > I try to make a simple program wich toggles pin RA0. The program
> > listed bellow is for a period(!) of +/- 6,5ms (but actually it
> > doesn't mather I guess). When I connect my oscilloscope at pin
RA0,
> > I can see the squarewave, but at regulier
times (every second or
2)
> > there is a little spike (going low). I
don't know how it got
there.
> > When I make the delay longer (0,5s for
example), I have a
simmilar
> > problem: RA0 goes high for 0,5s, back to low
for 0,5s, back to
high
> > for 0,5s and then there is a very small time
that RA0 goes low
> (only
> > vissible at scope). After this very short time, RA0 is back high
> for
> > 0,5s and the process continues. And I didn't program it that way
> (or
> > that's what I think).
> >
> > Can someboby pls take a look at my code below (sorry, comments
are
> > in dutch)?
> >
> > Thx in advance,
> > Matti, Belgium
> >
> >
> >
> > status equ 03h ;statusregister
> > porta equ 05h ;poortA
> > trisa equ 05h ;poortA input/output
register
> > portb equ 06h ;poortB
> > trisb equ 06h ;poortB input/output
register
> > delay1 equ 0ch
> > delay2 equ 0dh
> > delay3 equ 0eh
> > #define rp0 status,5 ;rp0 = bit5
> statusreg
> >
> >
> >
> > start
> > org 05h
> > call portdir ;poortA & B
> > directions
> > bcf rp0 ;bank0 selecteren
> >
> > ;HOOFDPROGRAMMA
> > ;--------------
> >
> > main
> > bsf porta,0 ;uitgang RA0 aan
> > call delay ;vertraging oproepen
> > bcf porta,0 ;uitgang RA0 uit
> > call delay ;vertraging oproepen
> > goto main
> >
> > ;DELAY SUBROUTINE
> > ;----------------
> >
> > delay
> > movlw b'00001010'
> > movwf delay1
> > del1
> > movlw b'00001010'
> > movwf delay2
> > del2
> > movlw b'00001010'
> > movwf delay3
> > del3
> > decfsz delay3,f ;vertraging
> > goto del3
> > decfsz delay2,f
> > goto del2
> > decfsz delay1,f
> > goto del1
> > return
> >
> > ;POORT-INITIALISATIES
> > ;--------------------
> >
> > portdir
> > bsf rp0 ;bank1 selecteren
> > movlw b'00000001' ;poortB in/out
> > movwf trisb
> > movlw b'00010000' ;poortA in/out
> > movwf trisa
> > return
> >
> > end
|