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

What will happen if i use set_tris without declare #fast_io

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







What will happen if i use set_tris without declare #fast_io
PostPosted: Sat Aug 01, 2009 5:32 am     Reply with quote

What will accualy happen if i use set_tris without declare #fast_io or #use fixed_io?(I know it is one of very stupid questions)
I did use set_tris but i forget to declare #fast_io ,but it seem nothing wrong, my PIC done its work in the same way .
Rohit de Sa



Joined: 09 Nov 2007
Posts: 282
Location: India

View user's profile Send private message Visit poster's website

PostPosted: Sat Aug 01, 2009 6:59 am     Reply with quote

Using a 'set_tris' will actually modify the TRIS register for the port. However, do remember that by default the compiler is in standard IO mode, in which the TRIS directions are automatically set by the compiler. So irrespective of whether you set the TRIS manually or not the program will continue to respond just fine.

On the other had, NOT using the appropriate set_tris statement when in Fast IO mode *may not* give you desired results.

Rohit
Ttelmah
Guest







PostPosted: Sat Aug 01, 2009 2:46 pm     Reply with quote

and (of course), as soon as you perform any I/O function, the contents of tris will be changed. So (for instance):
Code:


set_tris_a(0); //whole port is output
dummy=input(PIN_A0); Tris bit for pin A0, is now set as input
dummy=input_a(); Now whole port is set as input.


It really is simpler, to make a decision to either control TRIS yourself, and select fast_io, or let the compiler do it all for you. Classic 'reasons' for wanting to use fast_io, would be first, speed, and secondly, doing things like using the interrupt on change feature on port_b, with perhaps B6, and B7, set as outputs, and the interrupt on B4 & B5. For 95% of uses, the internal functions are fine, and much less likely to make mistakes....

Best Wishes
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