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

FAST_IO / STANDARD_IO

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



Joined: 07 Jul 2010
Posts: 92

View user's profile Send private message

FAST_IO / STANDARD_IO
PostPosted: Tue Jul 13, 2010 3:29 pm     Reply with quote

Hello,

Before I've been using #use fast_io(D) because all pins were fixed. But now I connected to the PIN_D3 a one-wire sensor and of course this pin must be both input and output. But the other pins are fixed. 1 input and the others are outputs. If I use again #use fast_io(D), the sensor does not work, because the pin is fixed input or output.

Now, How can I force the CCS to generate optimal assembly code for the fixed pins and STANDARD_IO code for the bidirectional (one wire) pin?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Jul 13, 2010 5:26 pm     Reply with quote

You can put #use standard_io and #use fast_io anywhere in your
program, as much as you want, to control the behavior of the
compiler for code that occurs after that line. Example:
Code:

#include <16F877.H>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock=4000000)

#define ONE_WIRE_PIN PIN_D0

#use standard_io(D)  // Use standard i/o for the 1-wire driver
#include "1wire.c"

#use fast_io(D)  // Use fast i/o for the rest of the program

//==========================================
void main()
{
set_tris_d(0x01);    // Pin D0 stays as input

output_high(PIN_D1); // This will use Fast i/o

onewire_reset();     // This will use Standard i/o

output_low(PIN_D1);  // This will use Fast i/o

while(1);
}
FFT



Joined: 07 Jul 2010
Posts: 92

View user's profile Send private message

PostPosted: Wed Jul 14, 2010 6:04 am     Reply with quote

Wow, I didn't know that, thank you so much Smile
bkamen



Joined: 07 Jan 2004
Posts: 1611
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Wed Jul 14, 2010 1:19 pm     Reply with quote

You can also set up control over the IO Direction control registers (TRIS) and change in Input/Output config as you need.

When I need mostly fast_io, I usually do that.

Either way works.

-Ben
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
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