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

Simple Question Please Help

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



Joined: 25 Nov 2008
Posts: 2

View user's profile Send private message

Simple Question Please Help
PostPosted: Tue Nov 25, 2008 5:57 am     Reply with quote

Hi i am new to Pic programming i am a second year student and have just started programming using MPLAB abd CCSC complier, So please exscuse my ignorence and bad spelling.

My question concerns simple input and output on the PIC16F648A chip i have read a book where all the input and output is done by codes such as

OUTPUT_B(0x03);
and
INPUT(PIN_A0);

without any need to set up each pin to be an input or an output using TRIS

i was simply wondering if this is a correct way and will work as some of my friends think that the setup of input and output pins still has to be done

if it is anyhelp i am using
PCB v3.293
PCM v3.293
PCHv3.293

and MPlab v8.10
dyeatman



Joined: 06 Sep 2003
Posts: 1933
Location: Norman, OK

View user's profile Send private message

PostPosted: Tue Nov 25, 2008 6:58 am     Reply with quote

You are correct. In fact it is recommended that you NOT use TRIS statements and let CCS take care of pin I/O setup automatically. You still still need to control what features are enabled/disabled such as CCP and ADC.
RLScott



Joined: 10 Jul 2007
Posts: 465

View user's profile Send private message

PostPosted: Tue Nov 25, 2008 7:29 am     Reply with quote

dyeatman wrote:
...In fact it is recommended that you NOT use TRIS statements and let CCS take care of pin I/O setup automatically...

..But if execution timing is critical, then you want to use #USE FAST_IO and take control of TRIS yourself. One single paradigm does not fit all applications.
_________________
Robert Scott
Real-Time Specialties
Embedded Systems Consulting
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Tue Nov 25, 2008 9:00 am     Reply with quote

For a student I strongly recommend you write a short test program with and without # USE FAST_IO and look at the listing file (.lst) to see what the difference is. Once you understand the difference you will see why you rarely need to handle the TRIS yourself, but occasionally it is crucial.
_________________
The search for better is endless. Instead simply find very good and get the job done.
timllens



Joined: 25 Nov 2008
Posts: 2

View user's profile Send private message

PostPosted: Tue Nov 25, 2008 1:10 pm     Reply with quote

Thank you all. I will try out a prog and have a play arround with the fast io as I may need this soon for some of the apps that I intend to write.
Thanks again Very Happy
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