I've built the $50 robot circuit using admin's sire diagram for the 9V/4.8V battery combo. I'm using the atmega328p and the isp mkII programmer with avr studio v.4.18 and WinAVR-20100110. I wanted to test my setup before altering the servos. I am able to connect to and program the atmega328p without errors. I've written a simple program using the SoR_Utils.h header file and the LED_on() function. My source code and the makefile generated by avr studio are below. Also, I had some trouble programming the chip after it had already been successful several times, but it started working again after I got the chip to go deeper into the socket. I've pushed on it with moderate pressure, but I'm still wondering if it is all the way in the socket. I'm not sure if it's normal, but I had to bend the pins to get them into the socket at all. Here's an image of my mcu. Can someone tell me if it's not in all the way or if there is a problem with my source code? Thanks!
... ok I need to figure out how to post the image... still, here's the source code:
#include "SoR_Utils.h"
int main(void){
configure_ports();
LED_on();
while(1){
}
return 0;
}
makefile:
###############################################################################
# Makefile for the project LED_On
###############################################################################
## General Flags
PROJECT = LED_On
MCU = atmega328p
TARGET = LED_On.elf
CC = avr-gcc.exe
## Options common to compile, link and assembly rules
COMMON = -mmcu=$(MCU)
## Compile options common for all C compilation units.
CFLAGS = $(COMMON)
CFLAGS += -Wall -gdwarf-2 -Os -std=gnu99 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
CFLAGS += -MD -MP -MT $(*F).o -MF dep/$(@F).d
## Assembly specific flags
ASMFLAGS = $(COMMON)
ASMFLAGS += $(CFLAGS)
ASMFLAGS += -x assembler-with-cpp -Wa,-gdwarf2
## Linker flags
LDFLAGS = $(COMMON)
LDFLAGS += -Wl,-Map=LED_On.map
## Intel Hex file production flags
HEX_FLASH_FLAGS = -R .eeprom
HEX_EEPROM_FLAGS = -j .eeprom
HEX_EEPROM_FLAGS += --set-section-flags=.eeprom="alloc,load"
HEX_EEPROM_FLAGS += --change-section-lma .eeprom=0 --no-change-warnings
## Include Directories
INCLUDES = -I"C:\Users\Dan\Documents\AVR_Projects\LED_On\..\Photovore_V1"
## Objects that must be built in order to link
OBJECTS = LED_On.o
## Objects explicitly added by the user
LINKONLYOBJECTS =
## Build
all: $(TARGET) LED_On.hex LED_On.eep LED_On.lss size
## Compile
LED_On.o: ../LED_On.c
$(CC) $(INCLUDES) $(CFLAGS) -c $<
##Link
$(TARGET): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) $(LINKONLYOBJECTS) $(LIBDIRS) $(LIBS) -o $(TARGET)
%.hex: $(TARGET)
avr-objcopy -O ihex $(HEX_FLASH_FLAGS) $<
[email protected]%.eep: $(TARGET)
-avr-objcopy $(HEX_EEPROM_FLAGS) -O ihex $<
[email protected] || exit 0
%.lss: $(TARGET)
avr-objdump -h -S $< >
[email protected]size: ${TARGET}
@echo
@avr-size -C --mcu=${MCU} ${TARGET}
## Clean target
.PHONY: clean
clean:
-rm -rf $(OBJECTS) LED_On.elf dep/* LED_On.hex LED_On.eep LED_On.lss LED_On.map
## Other dependencies
-include $(shell mkdir dep 2>/dev/null) $(wildcard dep/*)