Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
LinkBack Thread Tools Display Modes
Old 15th February 2007, 05:47 AM   (permalink)
Default What mean : tris PORTA

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 by savnik; 15th February 2007 at 06:28 AM.
savnik is offline  
Old 15th February 2007, 06:23 AM   (permalink)
Default

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 by Papabravo; 15th February 2007 at 10:47 PM.
Papabravo is offline  
Old 15th February 2007, 06:24 AM   (permalink)
Default

Quote:
Originally Posted by Papabravo
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 is offline  
Old 15th February 2007, 11:23 AM   (permalink)
Default

Quote:
bsf trisabuf,3
movf trisabuf,W
tris PORTA
Simply You can use this line to turn on RA3 on PORTA
Code:
BSF	PORTA,3
__________________
Gayan

My Website
http://gsmicro.blogspot.com/
Gayan Soyza is offline  
Old 15th February 2007, 10:48 PM   (permalink)
Default

Quote:
Originally Posted by savnik
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.
Papabravo is offline  
Old 16th February 2007, 06:14 AM   (permalink)
Default

I found:

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

I use for pic16f628a
savnik is offline  
Old 16th February 2007, 07:45 AM   (permalink)
Default

Quote:
Originally Posted by savnik
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
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline  
Old 16th February 2007, 05:58 PM   (permalink)
Default

You are right
Thank you
savnik is offline  
Reply

Bookmarks

Thread Tools
Display Modes



Similar Threads
Title Starter Forum Replies Latest
Problem with LCD code? spondootre Micro Controllers 15 29th April 2008 10:15 AM
Help me with code for electronic switch pls x-land Micro Controllers 10 15th July 2006 05:37 PM
Delay routine not working gregmcc Micro Controllers 6 18th September 2005 06:23 PM
chek code assembler gimmy Electronic Projects Design/Ideas/Reviews 10 4th May 2005 07:32 PM
weird PORTA gastonanthony Micro Controllers 6 30th April 2005 11:46 AM



All times are GMT. The time now is 08:09 AM.


Electronic Circuits  |  Learning Electronics
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.

eXTReMe Tracker