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
Posted: Tue Nov 25, 2008 6:58 am
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
Posted: Tue Nov 25, 2008 7:29 am
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
Posted: Tue Nov 25, 2008 9:00 am
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
Posted: Tue Nov 25, 2008 1:10 pm
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
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