Programs Load but Specified pins don't respond

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
cs137
 
Posts: 22
Joined: Thu Feb 23, 2012 9:15 am

Programs Load but Specified pins don't respond

Post by cs137 »

I'm using USB tiny with the Atmel 328p chip. Avrdude works fine. Finds the chip etc. I wrote a simple program using WinAVR in C++. The program is simple test to turn on an LED as follows. The MAKEFile was edited to use the right chip and programmer.

DDRB = 0b00000001; //select PortB pin 0, which is pin 14 on the chip, to output
PORTB = 0b00000001; // make pin 14 high;
while(1)
{

}

The program loads fine - no errors, the block at the bottom says the chip accepted the program, but pin 14 doesn't go high. I checked with voltage on that pin and it stays at zero.
I've tried the same program with PORTC instead of B with the same result.

Any idea what's going on? Why doesn't this work?
Last edited by adafruit_support_rick on Sat Jan 26, 2013 10:31 am, edited 1 time in total.
Reason: Moved topic to General Project Help

User avatar
zener
 
Posts: 4567
Joined: Sat Feb 21, 2009 2:38 am

Re: Programs Load but Specified pins don't respond

Post by zener »

I am a PIC guy so I can't tell you specific answer other than read the IO section of the data sheet. There is a difference between the data register and the actual pins. There is a difference between writing to the register and setting the output. Probably just different syntax is needed.

User avatar
zener
 
Posts: 4567
Joined: Sat Feb 21, 2009 2:38 am

Re: Programs Load but Specified pins don't respond

Post by zener »

You might also try putting a pullup resistor on the pin and see if it goes high. Maybe it is set up as an open collector.

User avatar
cs137
 
Posts: 22
Joined: Thu Feb 23, 2012 9:15 am

Re: Programs Load but Specified pins don't respond

Post by cs137 »

The problem is resolved - I think you were on the right track regarding the pullup resistor.

I'm not sure why but it had something to do with the power supply. Originally, I disabled the power from the programmer and was using a separate power supply because I looked at a video where it advised using a separate supply. In any case, when I disconnected the separate supply and used power from the programmer the problem disappeared.

Thank you for your help.

User avatar
zener
 
Posts: 4567
Joined: Sat Feb 21, 2009 2:38 am

Re: Programs Load but Specified pins don't respond

Post by zener »

Thanks for reporting back. So often people don't say what ever happened. I don't think my advice was too good but it's good that you got it working anyway. It seems a little strange though.

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”