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 CCS Technical Support

a variable for many pins

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



Joined: 05 Jun 2008
Posts: 18

View user's profile Send private message

a variable for many pins
PostPosted: Thu Jun 05, 2008 7:48 am     Reply with quote

Is it possible to use a variable for driving differents pins?
an example:
Code:


int XPIN;

void example(void)
{output_low(XPIN);}

Void main (void)
{
XPIN=PIN_A0;
example();
XPIN=PIN_A1;
example();
}

my code is wrong in case or you would not have realized it Smile

my questions are often very stupid :(
Indy



Joined: 16 May 2008
Posts: 24

View user's profile Send private message

PostPosted: Thu Jun 05, 2008 8:00 am     Reply with quote

You can't do this in the v3 compiler but it should be possible in the v4 compiler.

Code:
int XPIN;
The int type in the CCS compiler is 8 bit and too small to hold the PIN number. Change to an int16 type.
monkeyman



Joined: 05 Jun 2008
Posts: 18

View user's profile Send private message

PostPosted: Thu Jun 05, 2008 8:18 am     Reply with quote

that's true but that's not the solution
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Thu Jun 05, 2008 8:24 am     Reply with quote

So what compiler version are you using?
_________________
The search for better is endless. Instead simply find very good and get the job done.
monkeyman



Joined: 05 Jun 2008
Posts: 18

View user's profile Send private message

PostPosted: Thu Jun 05, 2008 8:27 am     Reply with quote

it's PCWH 4.069
monkeyman



Joined: 05 Jun 2008
Posts: 18

View user's profile Send private message

PostPosted: Thu Jun 05, 2008 8:55 am     Reply with quote

it work.
sorry
monkeyman



Joined: 05 Jun 2008
Posts: 18

View user's profile Send private message

PostPosted: Thu Jun 05, 2008 8:56 am     Reply with quote

and thanks a lot
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