Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • Thank you so much @bpinhosilva (+1) - however, I'm not 100% sure you understand my exact question. Take DDRD for instance. In your code example above you have: DDRD = B11111110. You state that this sets Arduino pins 1 - 7 as OUTPUT. But DDRD is a variable... but what library is it define inside of? In other words, what #include statement do I need to add to my source code to gain access to DDRD? If the answer is one of the Arduino libraries, then this doesn't help me! I need non-Arduino access to the AVR/ARM pins! Thanks again! Commented May 12, 2015 at 19:27
  • I just noticed your 2nd code sample above includes avr/io.h - if you can confirm that DDRD (and other similar port/register vars) are defined in this file, I think I'm all set! Commented May 12, 2015 at 19:29
  • 1
    You use #include <avr/io.h>. This is a standard library for avr units. Inside that you find definitions for these registers. Other point is that I am assuming you use Arduino but want to develop with a different IDE. So you need to find the equivalent avr pin to your board's labels. That's why the code says Arduino pinx and so on. Commented May 12, 2015 at 19:30
  • 1
    These names are not variables, they are mnemonics for addresses so you can easily remember them. You are welcome! Commented May 12, 2015 at 19:32
  • Thanks again @bpinhosilva (+1 again) - last followup question: I am wondering what the equivalent is for ARM registers. I found this EE.SE question but no one has answered it. Any idea what I would use for an ARM MCU? Thanks again! Commented May 12, 2015 at 19:32