So Let say I want to access Digital Pin 13. Thats port B pin. Is there an memory address associated with this pin 13 of Arduino Uno r3?
How Port B pins are addressed with corresponding pin numbers like What is the address of digital pin 13?
Currently I am assuming its pin address is 0x05
so my pointer looks like this
uint8_t *adr=0x00+0x05;
Now If I do
*adr |= 0x20;
then should I expect that I am writing to some pin so I like to know which data sheet I should refer for pin addresses of port B?
Currently my code is not working because no matter which pin I connect my LED to it blinks. What if I dont want to use any library and just write to address and I need PORT B pin address how to refer to different pins?
Now assume I have a code that uses avr gcc
#include <avr/iom328p.h>//avr/io.h
#include <util/delay.h>
#include <avr/sfr_defs.h>
#define BLINK_DELAY_MS 18000
int main (void)
{
DDRB |= _BV(DDB5);
while(1)
{
PORTB |= _BV(PORTB5);
_delay_ms(BLINK_DELAY_MS);
PORTB &= ~_BV(PORTB5);
_delay_ms(BLINK_DELAY_MS);
}
return 0;
}
What is the values correspond to DDRB
and _BV(DDB5);
and PORTB
and _BV(PORTB5);
? I like to do it with pointers so I need addresses of PORT B all pins I know the macros but I like the actual addresses . there should be a some datasheet for this what its called. Does arduino has it that gives memory mapped addresses?
The above code is simply for blinking LED light
PORTB |= _BV(PORTB5)
andDDRB |= _BV(DDB5);
why PORTB generic address is used and what the hell isDDRB |= _BV(DDB5);
where is the documentation on this memory mapped io. This is simple question. I checked gcc avr it's has addresses. But shouldn't there be some description for these macros and addresses. It's must be in data sheet but wait what I actually found was tuns of pages about pin layouts when search for arduino uno r3 datasheet.