Thanks for the input Olin. That's quite a set of macros you have. I'll have to remember those and after I get a foot or two on the ground, I may come back to them. Right now only have a toe or two on the ground re PICs. One answer always seems to raise more questions. Your macro's use IF/Endifs. Does MPLAB and most assemblers support them? I'll go check out MPLAB. I just realized the other day that the 12c671 does not have decision making commands other than the btfsc, btfss, decfsz and incfsz instructions. Thanks, Jess -----Original Message----- From: Olin Lathrop To: PICLIST@MITVMA.MIT.EDU Date: Monday, March 05, 2001 9:07 AM Subject: Re: [PIC]: 12c671 - GPIO vs TRIS Reg >> Bob, the documentation indicates the GPIO/TRIS registers are at register >> memory locations 0x05/0x85 and therefore it seems the disassembler should >> know which register is being addressed. > >No, because only the low 7 bits of the address are encoded into the >instruction. The upper two bits come from the bank bits. The disassembler >can't always know the runtime value of the bank bits, and therefore can't >tell whether GPIO or TRISIO was addressed. If in doubt, it reports the name >of the register in bank 0. > >> So, when coding in assembly, which register name should one use - the >> register name matching the Bank or is it sufficient to use either name and >> preselect the correct Bank? > >Always always always use the name of the intended register! Just because >using a different name causes the same instruction to be generated doesn't >make it right. Imagine someone (or maybe you) trying to figure out in three >years what you intended. Not only might that change from one PIC to >another, but using an alias register name is like writing deliberately >misleading comments. > >By the way, I deal with this register banking issue by using macros that >switch banks for me only when needed. For example, my code might look like >this: > >come_from_someplace unbank ;clear bank setting assumptions > dbankif trisio ;set banks for access to TRISIO > movlw 12 ;load some value into TRISIO > movwf trisio > > dbankif gpio ;change banks as needed to access GPIO > movlw 34 ;load some other value into GPIO > movwf gpio > >You are free to use my bank switching macros and lots of other stuff. Go to >http://www.embedinc.com/pic and see file STD.INS.ASPIC. > > >***************************************************************** >Olin Lathrop, embedded systems consultant in Devens Massachusetts >(978) 772-3129, olin@embedinc.com, http://www.embedinc.com > -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.