Defining port bits in mikroc

Status
Not open for further replies.

swapan

Full Member level 4
Joined
Feb 20, 2009
Messages
204
Helped
27
Reputation
54
Reaction score
24
Trophy points
1,298
Location
Kolkata
Visit site
Activity points
2,839
Hi friends,

In assembly language, particular bit of a I/O port could be defined as '#define Relay - PORTA,1'. In mikroC, how this bit could be defined so that in the code, if the respective bit of the port requires to be set, it could be done as 'Relay = 1' or otherwise.


regards


swapan
 

TRISA = 0; //set all pins on port A as output
TRISA = 1; //set all pins on port A as input

TRISA.F1 = 1; //set pin 1 as input;
TRISA.B1 = 1; //set pin 1 as input;

PORTA.F3 = 1; //Set 1 for bit 3
PORTA.B3 = 1; //Set 1 for bit 3

RA0_bit = 1; //Set 1 for bit 0;
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…