nolist ; ***** PIC16 Macro ***** _di MACRO bcf INTCON,7 ENDM _ei MACRO bsf INTCON,7 ENDM _bank0 MACRO ;memory bank 0 select bcf STATUS,5 ENDM _bank1 MACRO ;memory bank 1 select bsf STATUS,5 ENDM _movfi MACRO reg,data ;move reg. <-- data if data==0 clrf reg else movlw data movwf reg endif ENDM _movff MACRO rega,regb ;move regA. <-- regB movf regb,w movwf rega ENDM _ifb1f MACRO bit,reg,not_add ;if bit=1 then next btfss reg,bit goto not_add ENDM _ifb0f MACRO bit,reg,not_add ;if bit=0 then next btfsc reg,bit goto not_add ENDM _ifeqff MACRO rega,regb,not_add ;rega(f) = regb(f) then next movf regb,w subwf rega,w btfss STATUS,2 goto not_add ENDM _ifneff MACRO rega,regb,not_add ;rega(f) = regb(f) then next movf regb,w subwf rega,w btfsc STATUS,2 goto not_add ENDM _ifgtff MACRO rega,regb,not_add ;if rega(f) > regb(f) then next movf rega,w subwf regb,w btfsc STATUS,0 goto not_add ENDM _ifltff MACRO rega,regb,not_add ;if rega(f) < regb(f) then next movf regb,w subwf rega,w btfsc STATUS,0 goto not_add ENDM _ifeqwf MACRO reg,not_add ;if w = reg(f) then next subwf reg,w btfss STATUS,2 goto not_add ENDM _ifnewf MACRO reg,not_add ;if w = reg(f) then next subwf reg,w btfsc STATUS,2 goto not_add ENDM _ifgtwf MACRO reg,not_add ;if w > reg(f) then next subwf reg,w btfsc STATUS,0 goto not_add btfsc STATUS,2 goto not_add ENDM _ifltwf MACRO reg,not_add ;if w < reg(f) then next subwf reg,w btfss STATUS,0 goto not_add ENDM _ifeqfi MACRO reg,data,not_add ;if rega(f) = data then next if data==0 movf reg,f btfss STATUS,2 goto not_add else movlw data subwf reg,w btfss STATUS,2 goto not_add endif ENDM _ifnefi MACRO reg,data,not_add ;if rega(f) = data then next if data==0 movf reg,f btfsc STATUS,2 goto not_add else movlw data subwf reg,w btfsc STATUS,2 goto not_add endif ENDM _ifgtfi MACRO reg,data,not_add ;if rega(f) > data then next movf reg,w sublw data btfsc STATUS,0 goto not_add ENDM _ifltfi MACRO reg,data,not_add ;if rega(f) < data then next movlw data subwf reg,w btfsc STATUS,0 goto not_add ENDM _ifeqwi MACRO data,not_add ;if w = data then next sublw data btfss STATUS,2 goto not_add ENDM _ifnewi MACRO data,not_add ;if w = data then next sublw data btfsc STATUS,2 goto not_add ENDM _ifgtwi MACRO data,not_add ;if w > data then next sublw data btfsc STATUS,0 goto not_add btfsc STATUS,2 goto not_add ENDM _ifltwi MACRO data,not_add ;if w < data then next sublw data btfss STATUS,0 goto not_add ENDM list