Timeline for Reading/writing to Arduino GPIO pins from raw C code
Current License: CC BY-SA 3.0
11 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
S May 13, 2015 at 1:46 | history | edited | Anonymous Penguin | CC BY-SA 3.0 |
Improved the formatting of the example comments and code, removing extra whitespace.
|
S May 13, 2015 at 1:46 | history | suggested | patthoyts | CC BY-SA 3.0 |
Improved the formatting of the example comments and code, removing extra whitespace.
|
May 12, 2015 at 19:48 | vote | accept | smeeb | ||
May 12, 2015 at 19:39 | comment | added | bpinhosilva | I have never used ARM before, but I think it is similar. Just take a look at the datasheet and then you will see the gpio pins. And probably there is a lib similar to avr/io for your usage. | |
May 12, 2015 at 19:32 | comment | added | smeeb | 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! | |
May 12, 2015 at 19:32 | comment | added | bpinhosilva | These names are not variables, they are mnemonics for addresses so you can easily remember them. You are welcome! | |
May 12, 2015 at 19:30 | comment | added | bpinhosilva | 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. | |
May 12, 2015 at 19:29 | comment | added | smeeb |
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!
|
|
May 12, 2015 at 19:27 | comment | added | smeeb |
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!
|
|
May 12, 2015 at 19:26 | review | Suggested edits | |||
S May 13, 2015 at 1:46 | |||||
May 12, 2015 at 18:27 | history | answered | bpinhosilva | CC BY-SA 3.0 |