![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
G Guest
|
What will happen if i use set_tris without declare #fast_io |
Posted: Sat Aug 01, 2009 5:32 am |
|
|
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 . |
|
![](templates/subSilver/images/spacer.gif) |
Rohit de Sa
Joined: 09 Nov 2007 Posts: 282 Location: India
|
|
Posted: Sat Aug 01, 2009 6:59 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah Guest
|
|
Posted: Sat Aug 01, 2009 2:46 pm |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|