DIY Programming Problem

Dear all,

I have a small project and I thought of building my own Arduino to learn a little. I also want to use the normal bootloader but as I figured, I have to modify the pins_arduino.h file. I didn't find this difficult but I need to clarify something. How do I make use of pb6 pb7 adc6 adc7 ? What number do I refer to? 22? 23?

I am using the ATmega328P (SMD with 2 additional adc pins)

Thanks all
X

It would depend what you put in pins_arduino.h.

Assuming you added to these arrays:

const uint8_t PROGMEM digital_pin_to_port_PGM[] = {
	PD, /* 0 */
	PD,
	PD,
	PD,
	PD,
	PD,
	PD,
	PD,
	PB, /* 8 */
	PB,
	PB,
	PB,
	PB,
	PB,
	PC, /* 14 */
	PC,
	PC,
	PC,
	PC,
	PC,
};

const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = {
	_BV(0), /* 0, port D */
	_BV(1),
	_BV(2),
	_BV(3),
	_BV(4),
	_BV(5),
	_BV(6),
	_BV(7),
	_BV(0), /* 8, port B */
	_BV(1),
	_BV(2),
	_BV(3),
	_BV(4),
	_BV(5),
	_BV(0), /* 14, port C */
	_BV(1),
	_BV(2),
	_BV(3),
	_BV(4),
	_BV(5),
};

They would be 20 onwards.

Need some fuse changes to change PB6,7 from external oscillator to user-usable pins if you are planning to load the standard bootloader.

Adc6, 7 are analog inputs only, not usable as digital output. Can fake digital input by looking for levels below low voltage threshold and above high voltage threshold - see section 29 of the datasheet.