'macro subroutines: was: Stepper Motor'
Use of subroutines. Careful with overdoing it, esp. with the 12C50x and
the 16C5x for two simple reasons: Due to the size and structure of the
program counter you can only have subs in the first 256 addresses. Here
you won't see it, because the code is small, but later it could become a
problem. Secondly these Pics only got a two level deep stack, IOW, you
can only call subs twice without a return. I think you made such a
mistake in calling your delay routines.
As a general rule I only use subs if I am going to call that sub more
that once from my main routine. Later on, learn about using Macros if
you want to use this type of program structure.
Has anyone been able to write a macro for MPLAB or include a capability in
any assembler that allows one to define a routine and:
- not include it if it is not referenced,
- include it inline if it is used once or
- automatically make it a subroutine and include calls to it inline if it is
used more than once?
I was able to do this once years ago with and old version of MASM (for the
x86 processors) but the technique fails in the current MASM 6.14 (for
Windows 32bit code). And no, you don't have to be crazy to write Win32 code
in MASM, see
Anyway, back on topic, it has seemed to me for years that this should be a
very, very desirable feature to have in any assembler. Especially for the
little processors like the PIC. If anyone has this, I would dearly love to
know. How about a preprocessor?
James Newton geocities.com 1-619-652-0593 jamesnewton
http://techref.massmind.org NEW! FINALLY A REAL NAME!
Members can add private/public comments/pages ($0 TANSTAAFL web hosting)
More... (looser matching)
- Last day of these posts
- In 2000
, 2001 only
- New search...