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

Who to pass PIN with formal parameters of user functions

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



Joined: 07 Aug 2006
Posts: 2

View user's profile Send private message

Who to pass PIN with formal parameters of user functions
PostPosted: Mon Aug 14, 2006 8:42 am     Reply with quote

.
I´m from Brazil, and have problem with this type of function
Help -me ?


Ex:

using of function :

if( myfunc(PIN_A1))
{
....
....
...
}

int myfunc( short int pin)
{
if(input(pin))
{
return 1;
}
....
....
....
}

Congratulations
Ttelmah
Guest







PostPosted: Mon Aug 14, 2006 9:09 am     Reply with quote

The 'key', is that the standard pin I/O functions, cannot accept variables. They are replaced 'inline', with direct I/O to the specified pin. Hence with these, you cannot pass a value to a function, specifying a pin.
However you can generate your own version of the I/O punction, that will accept a variable.
Have a look at the thread "Accessing digital I/O from within a for loop", which has references to a number of different solutions.

Best Wishes
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Aug 14, 2006 9:56 am     Reply with quote

Here are functions to do pin i/o, with the pin number passed as
a variable:

For 16F:
http://www.ccsinfo.com/forum/viewtopic.php?t=25280&start=4

For 18F:
http://www.ccsinfo.com/forum/viewtopic.php?t=27723&start=3
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