0
\$\begingroup\$

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?

\$\endgroup\$
  • 3
    \$\begingroup\$ 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. \$\endgroup\$ – Martin Jul 9 '13 at 9:03
1
\$\begingroup\$

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

|improve this answer|||||
\$\endgroup\$
3
\$\begingroup\$

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.

|improve this answer|||||
\$\endgroup\$
  • 2
    \$\begingroup\$ The question has much more to do with how the individual compiler sets up each uC than with the uC itself. \$\endgroup\$ – Scott Seidman Jul 9 '13 at 10:39
0
\$\begingroup\$

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.

|improve this answer|||||
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.