Reply by Dwayne Reid September 1, 20032003-09-01
At 09:11 AM 9/1/2003, Matti Laevaert 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).

Have you disabled the watchdog timer? If not, this may cause the symptoms
you mention. Something to try: add some 'clrwdt' instructions to your code
such that a clrwdt happens at least every 5ms or so (assuming prescaler is
assigned to TMR0).

dwayne

--
Dwayne Reid <>
Trinity Electronics Systems Ltd Edmonton, AB, CANADA
(780) 489-3199 voice (780) 487-6397 fax

Celebrating 19 years of Engineering Innovation (1984 - 2003)
.-. .-. .-. .-. .-. .-. .-. .-. .-. .-
`-' `-' `-' `-' `-' `-' `-' `-' `-'
Do NOT send unsolicited commercial email to this email address.
This message neither grants consent to receive unsolicited
commercial email nor is intended to solicit commercial email.


Reply by Matti Laevaert September 1, 20032003-09-01
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




Reply by rtstofer September 1, 20032003-09-01

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





Reply by Matti Laevaert September 1, 20032003-09-01
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



Reply by Matti Laevaert September 1, 20032003-09-01
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