Datasheet

25 | Page
$(TARGET).elf: $(OBJ)
@echo [Link] $<
@$(LD) -o $@ $(OBJ) $(LDFLAGS) $(LIBS)
@avr-size $(TARGET).elf
# Generate .lst file rule
%.lst : %.o
@echo [lst] $<
@avr-objdump -h -S $<> $@
.c.o:
@echo [CC] $<
@$(CC) -c $(CFLAGS) $< -o $@
.PHONEY: clean
clean:
rm -f *.o *.elf *.hex *.lst Makefile.bak *~
Program 48
#!/bin/bash
# script to program 48pa device using AVRDUDE and a hex file
if [ "$1" == "" ]; then
echo Missing argument
exit 1;
fi
# if ends in .hex use full argument
# otherwise add the .hex
ext=${1:${#1}-4}
if [ "$ext" == ".hex" ]; then
/usr/bin/avrdude -c gpio -p m48p $1 -Uflash:w:$1
else
/usr/bin/avrdude -c gpio -p m48p $1.hex -Uflash:w:$1.hex
fi
Save the above code in a file called "program_48" and then run "chmod 777 program_48". Use
./program_48 <hex file> to program the Atmega 48 device.
9 Control Arduino Reset
The Raspberry-Pi GPIO 8 pin controls the Arduino reset pin when the jumpers are in place.
When starting the pin is LOW and thus the Arduino chip is held in reset. To control the reset
(gpio-8 pin) you can use the scripts shown below.
Don’t forget to change the mode of the text file to executable format: (chmod 777 reset_off).
Depending on your path you may have to call the script starting with a <dot><slash>:
./reset_off”.
Alternative copy the scripts to /usr/bin: “sudo cp reset_off /usr/bin”. If you want the Raspberry
Pi to always execute the script at boot up you have to edit the /etc/rc.local file. Make sure that
you have the full path in there. Thus if you have installed the script in /usr/bin you have to add
the following line to /etc/rc.local:
/usr/bin/reset_off