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

How to define array of pins?

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







How to define array of pins?
PostPosted: Tue Jan 02, 2007 4:40 am     Reply with quote

How to define array of pins?
I need to define an array like this:
Pins[3]=
{PIN_E0;
PIN_E1;
PIN_E2;
}
#define doesn't work.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Jan 02, 2007 11:53 am     Reply with quote

You're really asking how to initialize an array. You need to use
commas as separators, not semi-colons. Example:
Code:

int16 Pins[3]=
{
PIN_E0,
PIN_E1,
PIN_E2
};


Note that for 18F PICs, the pin constants are 16 bits, so the array
must be declared as an int16 (as shown above). For the 16F series,
the pin constants are int8 values. This is shown in the .H files for the
PICs, in the #define statements for the pins.
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