Read answers below: Richard S wrote: >First method: >banksel trisa ;switch to bank1 sets status to b'01' I'd use this "first" one, it is more safe in my opinion. >Second method: >BSF STATUS,RP0 ;switch to bank1 sets status to b'01' This is only true if RP1 is clear, but that is not absolutely necessary with the 16F876. >Question: I could not find reference to where someone knew to use the >"banksel trisa" line of code where does this come from? Banksel and Bankisel are two very useful directives for generating bank selecting code >Wondering if there are other such commands that are useful? >Is there an advantage/importance of one way over the other? Yes, the first one is automatic and lift the headache of bank switching from your shoulders. [snip] >Question I see many talk about the use of shadow variables like "portb_tmp" >but not sure when it should be used? It is a good idea to "manipulate" data in shadow registers before actually writting to a port, for many reasons. >It was explained some to me before but I just still do not understand but >know it must >be important in more complex programs. Read it again, it will make sense to you after a while. >Now I think I know this one but want to make sure. Both of the following >do the same thing if all I want to do is set all PORTA pins to all >outputs so there is no advantage of one of these over the other in this >case. >Is this correct? In my opinion that's correct. I'd set or clear a port without recurring to mask registers. [snip] >Method 1: >movlw B'00000000' >BSF STATUS,RP0 ;switch to bank1 sets status to b'01' >MOVWF TRISA ; make all bit of PORT A outputs >Method 2: >banksel trisa ;switch to bank1 >clrf trisa ;set as all outputs I'd go for the second option. >Thanks for the help sorry for so many basic questions. I just want to >make sure >I have a sound foundation to move on with. May I suggest you to read a little on www.piclist.com. There are tons of information there. Further more, try www.microchip.com they have ready made solutions for almost everything. Some of them work, some don't but then you can ask here when getting stuck. One thing I consider very helpful is the "MPASM User's guide", it can save you lots of time. Best regards VV Do you Yahoo!? Yahoo! Mail - More reliable, more storage, less spam -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.