Searching \ for 'Timing Routine Question' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/index.htm?key=timing+routine+question
Search entire site for: 'Timing Routine Question'.

Truncated match.
PICList Thread
'Timing Routine Question'
1999\11\11@133408 by James Paul

flavicon
face
All,

Looking at the two routines below, can anyone tell me what the
differences are regarding functionality?

I am using the 2nd routine right now as a delay of 41 uS in an
LCD write routine. All works well. But, if I substitute
the first routine in place of the second, when the circuit is
powered up, all I get on the LCD is gibberish. I don't quite
understand this. I'm waiting the same amount of time in both
of the timing routines. They both are entered and exited the
same way. I'd appreciate any feedback on this question.
I'd really like to know why the second routine works, but the
first one doesn't.


Thanks and Regards,

Jim





delay:
movlw 0x0C
movwf tmr5
decfsz tmr5
goto $-1
nop
nop
return





delay:
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
return

spam_OUTjimTakeThisOuTspamjpes.com

1999\11\11@134801 by Quentin

flavicon
face
James Paul wrote:
>
>
> delay:
> movlw 0x0C
> movwf tmr5
> decfsz tmr5
> goto $-1
> nop
> nop
> return

Hmmm, looks OK, quick adding in my head says it should be 41 microsecs.
I use goto label, but from what I've read, the $-1 should be correct.
Only other thing that is different from your second code is that W
returns from the call with a value 0x0C.

Quentin

1999\11\11@140244 by Mauricio Jancic

flavicon
face
       Look on the programm memory if your code is not on the middle of a page
change. For example, if the line goto $-1 is on address 0x0101 when you execute $-1 it will go to address 0x000, it means that you have to configure the PCLATH register.
       Be careful, cause I'm not quite shure of this, this is only what i tink, but you can give it a try, don't you?

               Mauricio Jancic

-----Mensaje original-----
De:     Quentin [SMTP:.....qscKILLspamspam@spam@ICON.CO.ZA]
Enviado el:     Jueves, 11 de Noviembre de 1999 03:51 p.m.
Para:   PICLISTspamKILLspamMITVMA.MIT.EDU
Asunto: Re: Timing Routine Question

James Paul wrote:
{Quote hidden}

Hmmm, looks OK, quick adding in my head says it should be 41 microsecs.
I use goto label, but from what I've read, the $-1 should be correct.
Only other thing that is different from your second code is that W
returns from the call with a value 0x0C.

Quentin

1999\11\11@153812 by Adam Bryant

picon face
Jim,
I agree with Quentin.  The routine looks fine and I use the $ notation
all the time without problems.  You are probably setting W with some
value before the delay routine that you want to have after the delay
routine returns.  The other suggestion about the routine being on a page
boundary is a possibility.  Look at the .LST file generated by MPLAB or
MPASM and see how big the application is.

Adam

On Thu, 11 Nov 1999 10:29:15 -0800 James Paul <.....jimKILLspamspam.....JPES.COM> writes:
{Quote hidden}

Adam Bryant (age 0x23)
adamdbspamspam_OUTjuno.com
Parker, CO, USA
Robotics, RC Airplanes, anything using a PIC

___________________________________________________________________
Get the Internet just the way you want it.
Free software, free e-mail, and free Internet access for a month!
Try Juno Web: dl.http://www.juno.com/dynoget/tagj.

1999\11\15@125741 by Eisermann, Phil [Ridg/CO]

flavicon
face
{Quote hidden}

1999\11\15@172419 by Tony Nixon

flavicon
picon face
James Paul wrote:
>
> All,
>
> Looking at the two routines below, can anyone tell me what the
> differences are regarding functionality?
>
> delay:
> movlw 0x0C
> movwf tmr5
> decfsz tmr5
> goto $-1
> nop
> nop
> return

What RAM location is tmr5 defined as?

--
Best regards

Tony

http://www.picnpoke.com
Email RemoveMEsalesTakeThisOuTspampicnpoke.com

1999\11\15@174913 by James Paul

flavicon
face
Tony,

tmr5 is defined as location 0x29



On Mon, 15 November 1999, Tony Nixon wrote:

{Quote hidden}

TakeThisOuTjimEraseMEspamspam_OUTjpes.com

1999\11\22@074052 by paulb

flavicon
face
James Paul wrote:

> Looking at the two routines below, can anyone tell me what the
> differences are regarding functionality?

 I assume you are using a 16F84?  Register location $29 sounds fine.

 I can only suggest the blitheringly obvious.  The loop routine alters
tmr5 and most particularly, the W register.  Are you absolutely *sure*
the calling routine doesn't mind this?
--
 Cheers,
       Paul B.

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