Programs Load but Specified pins don't respond

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Programs Load but Specified pins don't respond

Postby cs137 » Sat Jan 26, 2013 9: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 9:31 am, edited 1 time in total.
Reason: Moved topic to General Project Help
cs137
 
Posts: 2
Joined: Thu Feb 23, 2012 8:15 am

Re: Programs Load but Specified pins don't respond

Postby Zener » Sat Jan 26, 2013 1: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: 1994
Joined: Sat Feb 21, 2009 1:38 am

Re: Programs Load but Specified pins don't respond

Postby Zener » Sat Jan 26, 2013 3: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: 1994
Joined: Sat Feb 21, 2009 1:38 am

Re: Programs Load but Specified pins don't respond

Postby cs137 » Sun Jan 27, 2013 10: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 8:15 am

Re: Programs Load but Specified pins don't respond

Postby Zener » Sun Jan 27, 2013 4: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: 1994
Joined: Sat Feb 21, 2009 1:38 am


Return to General Project help

Who is online

Users browsing this forum: No registered users and 6 guests

Stuff to buy from the Adafruit store and links to product documentation!


New Products [108]

Raspberry Pi[80]
 
FLORA[23]
 
Bunnie Studios[9]
 
FPGA[1]
 
mbed[11]
Arduino[60]
 
NETduino[14]
 
BeagleBone[24]
 
Android[6]
 
XBee[10]
More Dev Boards[31]


 
BoArduino[8]
 
SpokePOV[4]
 
TV-B-Gone[4]
 
MiniPOV[3]
 
SIM reader[3]
 
Microtouch[5]
 
Clocks & Watches[18]
 
Drawdio[4]
 
Brain Machine[1]
 
Game of Life[2]
 
MintyBoost[2]
More DIY Kits[16]


 
MaKey MaKey[3]
 
Tweet-a-Watt[5]
 
Young Engineers[33]
 
Discover Electronics[2]
 
Snap Circuits[4]
 
littleBits[3]
 
Project packs[8]


 
Breakout Boards[34]
LCDs & Displays[48]
Components & Parts[70]
Batteries & Power[49]
EL Wire/Tape/Panel[52]
LEDs[111]
 
Wireless[14]
Cables[62]
 
Lasers[6]
Sensors/Parts[145]
 
Enclosures/Cases[11]
 
Solar[11]
 
RFID / NFC[13]
Prototyping[70]
 
iDevices[13]
Tools[71]
 
Wearables[39]
 
CNC[37]
 
Robotics[29]
 
3D printing[1]
 
Materials[24]


 
Stickers[41]
 
Skill badges[55]
 
Books[25]
 
Circuit Playground[7]
 
Gift Certificates[4]