1
\$\begingroup\$

Good day! I have been working with Atmel Studio lately and am a bit confused about notation. Thus far, when I reference a pin, I usually just use the PORTxn notation (example: PORD0). However, I constantly come across code samples on the internet that employ an abbreviated form Pxn (PD0). I tried using this form because it seems very convenient but anytime I do it Atmel underlines it in red and throws an error, saying that it does not exist even though I have included the avr/io.h header in my file. Any ideas what might be going wrong? Here is my sample code. You can see the red underline for PD2. Thanks for the help!

Sample Code

\$\endgroup\$
  • 1
    \$\begingroup\$ Do you see PD2 in the io.h header ? I see that you defined PD5 , why didn't you define PD2 ? \$\endgroup\$ – efox29 Mar 1 '18 at 4:02
1
\$\begingroup\$

Weird. avr/io.h includes avr/portpins.h which has the abbreviated forms. Maybe it has something to do with that first include you have? Try removing the #include <io.h> and the #define PD5 = 5 lines, and also check if you have the correct microcontroller configured in your project settings.

\$\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.