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 CCS Technical Support

12F508/509 TRIS configuration

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



Joined: 09 Oct 2008
Posts: 1

View user's profile Send private message

12F508/509 TRIS configuration
PostPosted: Thu Oct 09, 2008 6:35 am     Reply with quote

Reading the Microchip documentation this device does not provide an address for the TRISGPIO. In assembly you load your I/O config in x and execute a tris command.

Looking through the Forum at some of the examples it appears that I should be using:

set_tris_b(0x??);

to configure the I/O. Is this correct?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Oct 09, 2008 1:07 pm     Reply with quote

That will work. You need to tell the compiler that you want to set TRIS
for Port B, by using the #use fast_io directive. See the manual.

But you can also just let the compiler set the TRIS. Don't use Fast i/o
mode, and don't write directly to Port B. Instead, use the CCS pin and
port i/o functions, such as output_low(), output_high, output_b(), etc.
These are in the manual. The compiler will "know" the proper TRIS
settings for the function that you use, and set the TRIS for you.

It's much easier to write programs this way. It's one of the good things
about the CCS compiler (which is not even advertised as an important
feature).
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