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

pins as a function's parameter

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



Joined: 29 May 2008
Posts: 8

View user's profile Send private message

pins as a function's parameter
PostPosted: Wed Jul 16, 2008 1:21 am     Reply with quote

hi, i want to use a pin as a function parameter. How can i pre-define it in .h file ?

void sample_func (byte) ?

I know i can write the address number of pin, but my parameter is a variable pin. I mean it is code like this:
Code:
void main()
{
x=sample_func(pin_c0);
y= sample_func(pin_c1);
}

As you see, functions are the same, but pins are different. My function:
Code:
sample_function( ?! dumper_pin)
{
if (dumper_pin==pin_c1) ...
if (dumper_pin==pin_c0) ...
}
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Jul 16, 2008 10:06 am     Reply with quote

The pin constants are given in the .H file for your PIC. The .H files are
in this directory:
Quote:
c:\Program Files\Picc\Devices

If the PIC is a 16F, the data type for the pin constant will be 'int8'.
If the PIC is 18F, it will be 'int16'.

Also, the C style is to use upper case for constants. Example: PIN_C0
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