NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Microcontroller Programming » Is PORTD.0 and PORTD.1 (RX & TX) available for use with the nerdkits 168 ?

April 05, 2011
by popwarsweet
popwarsweet's Avatar

Hi,

I'm trying to use PORTD.0 and PORTD.1 (the ones used for programming the nerdskit Atmega168 chip) as standard output pins, but they are always at logic high. Are these pins set for serial only by fuse bits or am I just missing something in the code/circuit ?

April 05, 2011
by bretm
bretm's Avatar

They're set for serial I/O during the bootloader which runs before your program does. You should just be able to disable the UART in your program, after the bootloader starts you up, and they'll become normal pins again.

April 05, 2011
by SpaceGhost
SpaceGhost's Avatar

PD0 and PD1 can be used (I have done it). Like bretm said, the bootloader turns on the UART module before it runs your code... But, not only do you not include uart.h in your code, you need to put

UCSR0B = 0;

into your main function.

Humberto explains it here, in this thread.

It worked for me :).

Dave

April 06, 2011
by popwarsweet
popwarsweet's Avatar

Awesome! Thanks so much guys, didn't even think of disabling the UART.

Post a Reply

Please log in to post a reply.

Did you know that two resistors can be used to make a voltage divider? Learn more...