What is the proper way of passing a bit as an argument in a macro ? For example, the following code generates a macro that sets "bit1" and clears "bit2" when "Last_Key" is equal to a given constant : ; TEXT SUBSTITUTION DEFINITIONS #define BNK STATUS,RP0 #define ZERO STATUS,Z #define CARRY STATUS,C #define GREEN_LED PORTA,5 #define RED_LED PORTA,3 #define ESC 0x00 #define BS 0x01 #define DEL 0x08 #define HOME 0x04 #define PGUP 0x05 #define PGDN 0x06 #define END 0x07 ; VARIABLE DEFINITIONS cblock 0x20 Last_key TmpStr String : 16 endc ; MACRO DEFINITIONS KEY_TOG macro key, bit1, bit2 movlw key xorwf Last_Key,w btfss ZERO goto $+3 bsf bit1 bcf bit2 endm - snipped - ; MAIN PROGRAM LOOP Start KEY_TOG PGUP,GREEN_LED, RED_LED goto Start end The compiler doesn't differentiate the comma for bit #5 in the GREEN_LED definition from the argument seperator in the Macro declaration. So it says I supplied too many arguments thinking I meant to pass 5 arguments to the macro as if : KEY_TOG 0x05,PORTA,5,PORTA,3 when what I actually meant was KEY_TOG 0x05,(PORTA,5),(PORTA,3). I know this is just how text substitution IS supposed to work but is there any other way around it ? -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads