What mean : tris PORTA

Status
Not open for further replies.

savnik

Member
I have the below code:

---------------------------------------------------
trisabuf VAR BYTE
movlw 0x10 ; 00010000 - RA4 is entry
movwf trisabuf
---------------------------------------------------
bsf trisabuf,3
movf trisabuf,W
tris PORTA
----------------------------------------------------

What mean : tris PORTA ;
This mean that PORTA = trisabuf ;
 
Last edited:
On older versions of the PIC architecture there was a specific instruction that loaded the the TRIS register. On the newer versions you use a move instruction just like every other file register. If you read the datasheets really carefully they discourage the use of the dedicated instruction in favor of the more generic move instruction
 
Last edited:
Yes is for PIC16C54
 
savnik said:
Yes is for PIC16C54
On such an old device there is no alternative to the TRIS instruction because that register does not have a valid register file address.
 
I found:

bcf _trisabuf,3
bsf STATUS, RP0
movf _trisabuf,W
movwf TRISA
bcf STATUS, RP0

I use for pic16f628a
 
savnik said:
I found:

bcf _trisabuf,3
bsf STATUS, RP0
movf _trisabuf,W
movwf TRISA
bcf STATUS, RP0

I use for pic16f628a

Is there some reason for using '_trisabuf'?, instead of just
Code:
	   bsf	 STATUS, RP0     
	   bcf   TRISA, 3            
	   bcf	 STATUS, RP0
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…