Go Down

Topic: Where is DDRB etc defined (Read 2 times) previous topic - next topic

sykic

where are things like DDRB DDRD PORTD PORTB defined

they are used like this (taken from others code)
DDRD=0xFC;      // direction variable for port D - make em all outputs except serial pins 0 & 1
DDRB=0xFF;      // direction variable for port B - all outputs

PORTD = 0xFC;              // all outputs except serial pins 0 & 1
PORTB = 0xFF;              // turn on all pins of ports D & B


want to see what else I can access directly

eg is portE in 32u4 defined (Leonardo ) ?

Thanks in advance for any guidance

MarkT

In the avr includes for your install of avr-gcc.  For me on Ubuntu the relevant file is
/usr/lib/avr/include/avr/iom328p.h
[ I won't respond to messages, use the forum please ]

retrolefty

The AVR datasheet for the chip you are interested in is a good source of information for such information.

Lefty

dhenry

They are defined in the device header file, together with all other good stuff. A must read if you want to program a mcu.

WizenedEE


They are defined in the device header file, together with all other good stuff. A must read if you want to program a mcu.

Soo the header file for the device is in the device header file? Helpful.

I wouldn't say reading header files is recommended for people just using them; the documentation is definitely better: http://www.nongnu.org/avr-libc/user-manual/modules.html And the datasheet is also very helpful: http://www.atmel.com/devices/atmega328p.aspx?tab=documents or http://www.atmel.com/Images/doc8271.pdf

Go Up