0000. If CKDIV8 is programmed, CLKPS bits are reset to
0011, giving a division factor of eight at start up. Any value can be written to the CLKPS bits regardless of the CKDIV8 Fuse setting. So, it will be left to its default programming, as it's not required at this point. This was simply done by assigning it a programmed digit, 0.
PROJECT=ledblink
SOURCES=$(PROJECT).c
MMCU=attiny44
F_CPU = 20000000
CFLAGS=-mmcu=$(MMCU) -Wall -Os -DF_CPU=$(F_CPU)
$(PROJECT).hex: $(PROJECT).out
avr-objcopy -O ihex $(PROJECT).out $(PROJECT).c.hex;\
avr-size --mcu=$(MMCU) --format=avr $(PROJECT).out
$(PROJECT).out: $(SOURCES)
avr-gcc $(CFLAGS) -I./ -o $(PROJECT).out $(SOURCES)
program-fabISP: $(PROJECT).hex
avrdude -p t44 -P usb -c avrisp2 -U flash:w:$(PROJECT).c.hex
program-fabISP-fuses: $(PROJECT).hex
avrdude -p t44 -P usb -c usbtiny -U lfuse:w:0x0A:m
yazan@yazan-ThinkCentre-M710q:~/Desktop/tarek$ make
avr-gcc -mmcu=attiny44 -Wall -Os -DF_CPU=20000000 -I./ -o ledblink.out ledblink.c
avr-objcopy -O ihex ledblink.out ledblink.c.hex
avr-size --mcu=attiny44 --format=avr ledblink.out
AVR Memory Usage
----------------
Device: attiny44
Program: 64 bytes (1.6% Full)
(.text + .data + .bootloader)
Data: 0 bytes (0.0% Full)
(.data + .bss + .noinit)
yazan@yazan-ThinkCentre-M710q:~/Desktop/tarek$ make program-fabISP-fuses
avr-objcopy -O ihex ledblink.out ledblink.c.hex
avr-size --mcu=attiny44 --format=avr ledblink.out
AVR Memory Usage
----------------
Device: attiny44
Program: 64 bytes (1.6% Full)
(.text + .data + .bootloader)
Data: 0 bytes (0.0% Full)
(.data + .bss + .noinit)
avrdude -p t44 -P usb -c usbtiny -U lfuse:w:0x0A:m
avrdude: error: usbtiny_transmit: error sending control message: Protocol error
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.
avrdude: error: usbtiny_transmit: error sending control message: Protocol error
avrdude done. Thank you.
makefile:18: recipe for target 'program-fabISP-fuses' failed
make: *** [program-fabISP-fuses] Error 1
yazan@yazan-ThinkCentre-M710q:~/Desktop/tarek$ make
avr-gcc -mmcu=attiny44 -Wall -Os -DF_CPU=20000000 -I./ -o ledblink.out ledblink.c
avr-objcopy -O ihex ledblink.out ledblink.c.hex;\
avr-size --mcu=attiny44 --format=avr ledblink.out
AVR Memory Usage
----------------
Device: attiny44
Program: 64 bytes (1.6% Full)
(.text + .data + .bootloader)
Data: 0 bytes (0.0% Full)
(.data + .bss + .noinit)
yazan@yazan-ThinkCentre-M710q:~/Desktop/tarek$ make program-fabISP
avr-objcopy -O ihex ledblink.out ledblink.c.hex;\
avr-size --mcu=attiny44 --format=avr ledblink.out
AVR Memory Usage
----------------
Device: attiny44
Program: 64 bytes (1.6% Full)
(.text + .data + .bootloader)
Data: 0 bytes (0.0% Full)
(.data + .bss + .noinit)
avrdude -p t44 -P usb -c usbtiny -U flash:w:ledblink.c.hex
avrdude: error: usbtiny_transmit: error sending control message: Protocol error
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.
avrdude: error: usbtiny_transmit: error sending control message: Protocol error
avrdude done. Thank you.
makefile:17: recipe for target 'program-fabISP' failed
make: *** [program-fabISP] Error 1
yazan@yazan-ThinkCentre-M710q:~/Desktop/tarek$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 089: ID 1781:0c9f Multiple Vendors USBtiny
Bus 001 Device 004: ID 17ef:608c Lenovo
Bus 001 Device 003: ID 17ef:608d Lenovo
Bus 001 Device 002: ID 8087:0a2a Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
yazan@yazan-ThinkCentre-M710q:~/Desktop/tarek$ make
avr-objcopy -O ihex ledblink.out ledblink.c.hex;\
avr-size --mcu=attiny44 --format=avr ledblink.out
AVR Memory Usage
----------------
Device: attiny44
Program: 64 bytes (1.6% Full)
(.text + .data + .bootloader)
Data: 0 bytes (0.0% Full)
(.data + .bss + .noinit)
yazan@yazan-ThinkCentre-M710q:~/Desktop/tarek$ make program-fabISP
avr-objcopy -O ihex ledblink.out ledblink.c.hex;\
avr-size --mcu=attiny44 --format=avr ledblink.out
AVR Memory Usage
----------------
Device: attiny44
Program: 64 bytes (1.6% Full)
(.text + .data + .bootloader)
Data: 0 bytes (0.0% Full)
(.data + .bss + .noinit)
avrdude -p t44 -P usb -c usbtiny -U flash:w:ledblink.c.hex
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0x1e9207 (probably t44)
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "ledblink.c.hex"
avrdude: input file ledblink.c.hex auto detected as Intel Hex
avrdude: writing flash (64 bytes):
Writing | ################################################## | 100% 0.06s
avrdude: 64 bytes of flash written
avrdude: verifying flash memory against ledblink.c.hex:
avrdude: load data flash data from input file ledblink.c.hex:
avrdude: input file ledblink.c.hex auto detected as Intel Hex
avrdude: input file ledblink.c.hex contains 64 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 0.07s
avrdude: verifying ...
avrdude: 64 bytes of flash verified
avrdude: safemode: Fuses OK (E:FF, H:DF, L:62)
avrdude done. Thank you.
yazan@yazan-ThinkCentre-M710q:~/Desktop/tarek$
#include <avr/io.h> //initialized avr input/output library
#include <util/delay.h> //initialized delay library required for the delay function
#define F_CPU20000UL //define clock processing
#define LED PORTA //Define LED port
#define Button PA7 //Define button port
int delaynum=2500; //delay variable
int main (void)
{
DDRA = 0b00000100;
while(1){
if (Button==1)
{
delaynum= delaynum/1.5;
}
LED = 0b00000100;
_delay_ms(delaynum);
LED = 0b00000000;
_delay_ms(delaynum);
}
}