piclist 2001\02\15\085723a >
Thread: LCD Problem Revisited
www.piclist.com/techref/io/lcd/pic.htm?key=lcd
flavicon
face BY : Thomas McGahee email (remove spam text)



I hate wasting code space with multiple NOP instructions.
You can get the equivalent delay of several NOP instructions
by doing a CALL to any RETURN instruction. You do have to
make sure the CALL doesn't cause any problems due to
pushing too many return addresses on the stack, of course,
but that is rarely a problem. I just add a label <RETN>
to an existing RETURN. Executing a CALL RETN will waste
4 cycles for the CALL and eventual RETURN, giving us
the desired delay time, and the program overhead is only
ONE instruction. A variation on this is to have some routine
end with something we can use to generate several different
delays, depending on which label we CALL:

...
...                  ;place the following at the end of an
...                  ; existing called subroutine.
DELAY10  GOTO DELAY8 ;GOTO results in 2 cycle delay
DELAY8   GOTO DELAY6
DELAY6   NOP         ;NOPs are 1 cycle delay
DELAY5   NOP
RETN     RETURN      ;CALL+RETURN is equal to 4 NOPs

Techniques such as these can be useful when you absolutely
have to squeeze a few more bytes into the program space.

Note also that already existing subroutines may end with
some inocuous code, and you may be able to do a CALL to
the near end of that code to generate some extra delay.
Sometimes when I need a delay that does not have to be
exact, I will do something like call an existing subroutine
that does something that does not disturb what I am doing,
but wastes time.

Fr. Tom McGahee


{Original Message removed}

seeking: grounding grids
<00f501c09757$e1803a80$fa00000a@sigmanet> 7bit

See also: www.piclist.com/techref/io/lcd/pic.htm?key=lcd
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) LCD Problem Revisited

month overview.

new search...