Searching \ for 'NEWBIE Still strugling with DELAY routine' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/timers.htm?key=delay
Search entire site for: 'NEWBIE Still strugling with DELAY routine'.

Truncated match.
PICList Thread
'NEWBIE Still strugling with DELAY routine'
2000\03\16@125623 by Muqtar Mohamed Usuf

flavicon
face
Thanks  for some of the hints, but couldn't get it to working after
some more reading. Any done and dusted examples at some

Environmet MPBLAB
PIC16F84
prescaler 1:64 see bellow
pure asssembly code used

ROUTINE WAIT
                     MOVLW .255
                     MOVWF TMR0

DELAY1SECOND
                     CLRWF
                     XORWF TMRO,W
                     BTFSS STATUS,Z
                     GOTO DELAY1SECOND
RETLW 0X0


in main
 MOVLW B '1101010101'  ; enable internal tmro 1:64


Bad Boy from ell

2000\03\16@175442 by Sebastian Garcia

flavicon
face
Hi Muqtar,

A more formal way to do this is using the tmr0 interrupt.

|Environmet MPBLAB
|PIC16F84
|prescaler 1:64 see bellow
|pure asssembly code used

I assume the PIC running at 4 MHz.

|ROUTINE WAIT
|                      MOVLW .255
|                      MOVWF TMR0
|
|DELAY1SECOND
|                      CLRWF

You said clrw?

|                      XORWF TMRO,W


If You want to test when TMR0 is zero by looking at the Z flag, You can
delete the latter 2 lines, and do:

                   movf    TMR0,F

|                      BTFSS STATUS,Z
|                      GOTO DELAY1SECOND
|                      RETLW 0X0
|
|in main
|                      MOVLW B '1101010101'  ; enable internal tmro 1:64

Hey, ten bits!
I assume You did:
                     movlw    b'11010101'
                     movwf    OPTION_REG



With your routine (and 4 MHz xtal.) You are delaying aprox. 80 mseg.

Regards,

S.-

2000\03\17@020433 by Dr. Imre Bartfai

flavicon
face
Hi,
if you set TMR0 to 255, it will overflow in the NEXT cycle!

On the other hand, it is not wise to try to load W register with a 10-bit
constant. Is it what you intend?

Regards,
Imre


On Thu, 16 Mar 2000, Muqtar Mohamed Usuf wrote:

{Quote hidden}

More... (looser matching)
- Last day of these posts
- In 2000 , 2001 only
- Today
- New search...