Searching \ for 'Can I make a macro to specificy (a bit within a by' 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=can+make+macro+specificy
Search entire site for: 'Can I make a macro to specificy (a bit within a by'.

Truncated match.
PICList Thread
'Can I make a macro to specificy (a bit within a by'
1998\10\25@175601 by Ry Lato

picon face
Here is an example

BCF    HELLO,HI

HELLO represents 0x030
HI repesents 0x1

can I make a MACRO to replace that command with

BCF ONEWORD

ONEWORD would represent HELLO,HI or 0x030,1

Why would I wan't to do this?
I have many bit switches in a program I am developing. It gets
tedious keeping track of which bit switches belong to which bytes.
It opens up chances for errors. I would appreciate some help, if there
is a way to do what I am asking. Thanks


______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

1998\10\25@180429 by Harold M Hallikainen

picon face
       Though not a macro, I believe you can do this with a DEFINE statement.
It will substitute whatever you specify.  Also, I've done macros similar
to what you're specifying by including the full instruction in the macro.
I have macros called LedGreen, LedYello, LedRed, and LedOff, each of
which contain BSF and BCF instructions.  I don't have to remember which
bit of which port to deal with.  However, when writing code, I generally
have a schematic in front of me, so it's easy to figure out which port
and bit does what.  For internal flags, however, define statements might
be nice to specify the address and bit.


Harold


On Sun, 25 Oct 1998 14:55:40 PST Ry Lato <spam_OUTpicky77TakeThisOuTspamHOTMAIL.COM> writes:
{Quote hidden}

___________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com/getjuno.html
or call Juno at (800) 654-JUNO [654-5866]

1998\10\25@180846 by Michael Hagberg

flavicon
face
here is a snipit from my code

bit_variables   res     1
#define         water_on_high   bit_variables,0
#define         water_on_low    bit_variables,1
#define         played_song     bit_variables,2

then you can use them like

   btfsc    water_on_low

michael

You may leave the list at any time by writing "SIGNOFF PICLIST" in the
   body of a message to .....LISTSERVKILLspamspam@spam@MITVMA.MIT.EDU.

{Original Message removed}

1998\10\26@030852 by g.daniel.invent.design

flavicon
face
Ry Lato wrote:
{Quote hidden}

here's how you do your BSF or BCF oneword:

#DEFINE oneword                 one,word
i.e.--
#DEFINE _D0                     GPIO,2
#DEFINE _D1                     GPIO,3


see also below a code section I commonly *.inc into my files,
saves screen space and coding time:

you must EQU the MV1 & MV2 dummy (assembler) variables prior to use.
;M A C R O    D E F I N I T I O N S :     BY GRAHAM DANIEL:
WMOVL   MACRO   MV1,MV2     ; MOVE [LITERAL] INTO [FILE]   2 CYCLES
       MOVLW   MV1
       MOVWF   MV2
       ENDM

WMOVF   MACRO   MV1,MV2     ; MOVE [FILE] TO [FILE]        2 CYCLES
       MOVF    MV1,W
       MOVWF   MV2
       ENDM

BTG     MACRO   MV1,MV2         ; toggle bit of file reg/port
       MOVLW   1 << MV2
       XORWF   MV1,F
       ENDM

regards,
Graham Daniel.

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