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

How to Name a Pin

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



Joined: 02 Mar 2017
Posts: 6
Location: Kochi

View user's profile Send private message

How to Name a Pin
PostPosted: Thu Mar 02, 2017 1:12 pm     Reply with quote

How do I name a pin in PIC ccs compiler? Example name RB0 to Enable, so that I can use enable=1 for high and enable =0 for low?
jeremiah



Joined: 20 Jul 2010
Posts: 1355

View user's profile Send private message

PostPosted: Thu Mar 02, 2017 3:55 pm     Reply with quote

Usually in CCS you would use the following paradigm:

Code:

#define ENABLE PIN_A7

...


output_low(ENABLE);
...
output_high(ENABLE);
...
output_toggle(ENABLE);

...etc.


You can go:

Code:

#byte PORTB = <address or getenv() call>
#bit ENABLE = PORTB.0

...

ENABLE = 1;


But that is usually more hackish and used to work around bugs or unsupported functionality.
sobinstn



Joined: 02 Mar 2017
Posts: 6
Location: Kochi

View user's profile Send private message

Thank you.. This is working..
PostPosted: Fri Mar 03, 2017 12:12 am     Reply with quote

jeremiah wrote:
Usually in CCS you would use the following paradigm:

Code:

#define ENABLE PIN_A7

...


output_low(ENABLE);
...
output_high(ENABLE);
...
output_toggle(ENABLE);

...etc.


You can go:

Code:

#byte PORTB = <address or getenv() call>
#bit ENABLE = PORTB.0

...

ENABLE = 1;


But that is usually more hackish and used to work around bugs or unsupported functionality.
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