CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

set_tris questions

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
liche
Guest







set_tris questions
PostPosted: Fri Apr 25, 2003 7:42 pm     Reply with quote

I'm a bit confused on when to use the set_tris statements for various type of i/o configurations such as Standard IO, Fast IO, etc...

Is it necessary to use the set_tris statements for all of these types of I/O or only on some types?

Thanks
___________________________
This message was ported from CCS's old forum
Original Post ID: 14003
david smith
Guest







Re: set_tris questions
PostPosted: Sat Apr 26, 2003 5:06 pm     Reply with quote

:=I'm a bit confused on when to use the set_tris statements for various type of i/o configurations such as Standard IO, Fast IO, etc...

Somebody may offer better info, but I believe...

STANDARD_IO (default) doesn't require SET_TRIS, and sets direction each instance of an IO cmd.

I use FAST_IO and Set_TRIS on projects to run faster and with less RAM.

On most of my projects, the use of the pin never changes.
In a current project, I use PORTB as a bidirection bus to external parallel registers, so I've defined constants for
bus direction.

Example:

#USE FAST_IO(B) // Use TRIS fctns to set dir of I/O

// Data bus is B, and is bidirectional
#BYTE BUS_RD = 0xFF // tris register values for reading
#BYTE BUS_WR = 0x00 // for writing

//*** write to bus routine
int8U wr_ext(int8U addr, int8U data) {
// not shown: set address
SET_TRIS_B(BUS_WR); // set bus direction
PORTB = data; // put data on data bus [B]
WR = 1; // generate wr pulse
WR = 0;
SET_TRIS_B(BUS_RD); // set bus direction
}
___________________________
This message was ported from CCS's old forum
Original Post ID: 14015
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group