|
|
View previous topic :: View next topic |
Author |
Message |
rikotech8
Joined: 10 Dec 2011 Posts: 376 Location: Sofiq,Bulgariq
|
#FAST_IO for certain pins |
Posted: Mon Sep 22, 2014 5:48 am |
|
|
Hello
I would like to ask you this:
How can I tell the compiler to produce a TRIS direction code only for some pins? Let say we have PORT A with 8 pins form A0 to A7. I want a fast reaction from pin A0 when I set it's state. For the rest 6 pins (A1-A7) I want the compiler to generate a TRIS direction code.
When I read the manual, its written:
Quote: | Syntax:
#USE FAST_IO (port)
Elements:
port is A, B, C, D, E, F, G, H, J or ALL |
In other words I can adjust the compiler settings only to generate a TRIS direction code for the entire port, not pin by pin. BUT the next directive
#USE FIXED_IO (port_outputs=pin, pin?) is able to handle pin by pin.
So if I set the code for PORTA this way:
Code: | #USE FAST_IO (A)
#USE FIXED_IO (a_outputs=PIN_A1,PIN_A2, PIN_A3,PIN_A4,PIN_A5,PIN_A6,PIN_A7) |
Does it mean that I will have PIN_A0 as fast I/O? _________________ A person who never made a mistake never tried anything new. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Sep 22, 2014 3:23 pm |
|
|
No, because only the last directive takes effect. The fixed_io cancels
the fast_io. And fixed_io writes to the whole TRIS register every time
anyway. |
|
|
rikotech8
Joined: 10 Dec 2011 Posts: 376 Location: Sofiq,Bulgariq
|
|
Posted: Tue Sep 23, 2014 6:30 am |
|
|
10x _________________ A person who never made a mistake never tried anything new. |
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Tue Sep 23, 2014 10:04 am |
|
|
in my work , deciding to declare FAST_IO depends
on how a PORT will be used.
in specific - if speed MATTERS - such as accessing a byte wide SRAM chip's
data pins- ONLY FAST_IO makes sense, since a single unmasked instruction
"does it all". the rest of the time , default CCS "smart" / on the fly TRISIO
is much simpler. pick one or the other and you will be happy.
The other case where fast_io is helpful is where you never, ever anywhere in your code change TRIS, though this might be a CCS version dependent optimization.
Then set TRIS at the top of main() and forget it. |
|
|
|
|
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
|