Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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:
Papabravo said:
On older versions of the PIC architecture there was a specific instruction that loaded the the TRIS register. On the newr 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
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.
 
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.

New Articles From Microcontroller Tips

Back
Top