Memorial day is 05/25/2015 – Orders will ship out on May 26th. There will not be any deliveries or shipping on Monday. Any order placed after 11am ET on Friday May 22nd will not start to ship out until Tuesday May 26th.

Programs Load but Specified pins don't respond
Moderators: adafruit_support_bill, adafruit

Programs Load but Specified pins don't respond

by cs137 on Sat Jan 26, 2013 10:21 am

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
cs137
 
Posts: 2
Joined: Thu Feb 23, 2012 9:15 am

Re: Programs Load but Specified pins don't respond

by zener on Sat Jan 26, 2013 2:43 pm

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.

zener
 
Posts: 2880
Joined: Sat Feb 21, 2009 2:38 am

Re: Programs Load but Specified pins don't respond

by zener on Sat Jan 26, 2013 4:28 pm

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.

zener
 
Posts: 2880
Joined: Sat Feb 21, 2009 2:38 am

Re: Programs Load but Specified pins don't respond

by cs137 on Sun Jan 27, 2013 11:21 am

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.
cs137
 
Posts: 2
Joined: Thu Feb 23, 2012 9:15 am

Re: Programs Load but Specified pins don't respond

by zener on Sun Jan 27, 2013 5:33 pm

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.

zener
 
Posts: 2880
Joined: Sat Feb 21, 2009 2:38 am