# Microcontroller I/O configuration

I have been using PIC microcontrollers and have been using MikroC for the programming but I am little bit confused about the ports. On a PIC16F84A the port is defined in mikroC as TRISA = 0xFF, and a bit of the port can be accessed by PORTA.f0. But for other microcontrollers in the series a different code is used. For example, TRISIO = 0xFF.

Can you please explain to me how I can know the code for accessing the ports that applies for every microcontroller out there? Also the input for a PIC is 1 and output is 0, and for Atmel the input 0 and output 1 which I found confusing if someone can explain?

• Please consider making your question title more specific, as it stands "Help with microcontrollers" could be any one of a thousand questions. Bear in mind others who come along with the same problem and would never find this question due to a bad title. It's also considered bad to ask two questions in one post, better to ask seperate questions so that each answer can be voted on it's merits. – Martin Jul 9 '13 at 9:03

Try looking at the header files you're using, or like Scott Seidman mentioned the compiler datasheet

Microcontrollers datasheet aren't always going to have the exact variable names used in program (maybe in MPLAB) but most likely not in 3rd-party IDE like MikroC

MikroC Manual for PIC12, 16 and 18

You just have to read the datasheet of each microcontroller that you are using. Which is something you should do for every device that you are using, anyway.

• The question has much more to do with how the individual compiler sets up each uC than with the uC itself. – Scott Seidman Jul 9 '13 at 10:39

I don't use MikroC, which looks like a fine compiler, but many compilers put all the chip-related info into a header file which is compiled into your code via an #include statement, or some such.

Open the header file, and scan it for port information.