At 03:13 PM 3/30/03 -0500, shoppa_piclist@TRAILING-EDGE.COM wrote: > > because you don't seem to realise that this goofy stuff is for your > > *convenience*. In fact it's for your sanity. > >While I fully agree that mnemonic symbols are far superior to raw hex >constants, I honestly don't feel that they've gone far enough. For >example, with MPASM (or the Gnu equivalent gpasm) I can gleefully >set bit 5 in INTCON with a > > BSF INTCON,RP0 Andy Warren suggested a simple fix many years ago and it is how I currently write my code: I have my own set of include files that mirrors every single bit in the special function registers. For example, the above is handled by #define _RP0 INTCON,RP0 within the include file. You use it by referring to the alias: bsf _RP0 Registers in different banks are handled with bsf RB1(_T1IE) where RB1 is a #define located at the start of my code: ;other bit and register macro helpers #define BB1(reg,bit) (reg^0x80),(bit) ;bit in bank 1 #define RB1(reg) (reg^0x80) ;reg in bank 1 ;usage is: bcf BB1(_SOMEBIT) ;usage is: movwf RB1(SOMEREG) #define BNUM(reg,bit) (bit) ;bit number within reg #define BIT(reg,bit) 1<<(bit) ;bit within reg #define MASK(reg,bit) ~(1<<(bit)) ;bit mask within reg #define REG(reg,bit) (reg) ;reg ;usage is: movlw BIT(_SOMEBIT) ; do something ; movwf REG(_SOMEBIT) Olin has a nicer method of dealing with banking issues that I intend to adopt Real Soon Now (tm) - as soon as I get a chance. dwayne -- Dwayne Reid Trinity Electronics Systems Ltd Edmonton, AB, CANADA (780) 489-3199 voice (780) 487-6397 fax Celebrating 19 years of Engineering Innovation (1984 - 2003) .-. .-. .-. .-. .-. .-. .-. .-. .-. .- `-' `-' `-' `-' `-' `-' `-' `-' `-' Do NOT send unsolicited commercial email to this email address. This message neither grants consent to receive unsolicited commercial email nor is intended to solicit commercial email. -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu