|
|
View previous topic :: View next topic |
Author |
Message |
liche Guest
|
set_tris questions |
Posted: Fri Apr 25, 2003 7:42 pm |
|
|
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 |
Posted: Sat Apr 26, 2003 5:06 pm |
|
|
:=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 |
|
|
|
|
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
|