/MikroBlink/sourcecode/LED port TEST/Hexfiles/MikroBlink_.eep |
---|
0,0 → 1,0 |
:00000001FF |
/MikroBlink/sourcecode/LED port TEST/Hexfiles/MikroBlink_.hex |
---|
0,0 → 1,27 |
:1000000012C02CC02CC02AC029C028C027C026C0BE |
:1000100025C024C023C022C021C020C01FC01EC0D4 |
:100020001DC01CC01BC011241FBECFE5D4E0DEBF25 |
:10003000CDBF10E0A0E6B0E0ECE9F1E002C0059031 |
:100040000D92A036B107D9F710E0A0E6B0E001C0EC |
:100050001D92A236B107E1F71DD09EC0D1CF1F92ED |
:100060000F920FB60F9211248F938091600084300D |
:1000700030F4809160008F5F8093600002C0109226 |
:10008000600081E0809361008F910F900FBE0F9010 |
:100090001F90189585E087BB8EE384BB80EF81BB02 |
:1000A000939A80E88BBF84E085BFAB98AA98C298EA |
:1000B000A99896989598AD9897989498AC98C09868 |
:1000C000C09A80916100882381F428EB3BE04AEFDD |
:1000D00050E080916100882341F421503040CA01F2 |
:1000E0000197F1F721153105A1F7C09878944AEFEF |
:1000F00050E010926100AB9AAA9AC29AA99A969A75 |
:10010000959AAD9A979A949AAC9AC09A8091610008 |
:10011000882371F428EC30E080916100882341F459 |
:1001200021503040CA010197F1F721153105A1F79F |
:10013000AB98AA98C298A99896989598AD989798D0 |
:100140009498AC98C09880916100882391F628EC2F |
:1001500030E080916100882361F621503040CA016F |
:100160000197F1F721153105A1F7C3CF9C018091CB |
:100170006100882359F0089580916100882359F423 |
:1001800021503040FA013197F1F702C04AEF50E0B8 |
:0C0190002115310589F70895F894FFCF80 |
:00000001FF |
/MikroBlink/sourcecode/LED port TEST/main.c |
---|
0,0 → 1,142 |
#include <avr/io.h> |
#include <util/delay.h> |
#include <stdint.h> |
#include <avr/interrupt.h> |
void sleep_ms(uint16_t ms); |
#define LED_WS PB2 // LED port 1 |
#define LED_BL PC1 // LED port 2 |
#define LED_BLITZRT PC2 // LED port 3 |
#define LED_BLITZGN PC3 // LED port 4 |
#define LED_PORT5 PC4 // LED port 5 |
#define LED_HINTENGN PC5 // LED port 6 |
#define LED_HINTENRT PD4 // LED port 7 |
#define LED_VORNEGN PD5 // LED port 8 |
#define LED_UNTENGB PD6 // LED port 9 |
#define LED_VORNERT PD7 // LED port 10 |
#define LED_STATUS PB0 // LED blau - on board |
#define STATUS_OFF PORTB |= (1<<LED_STATUS) //Den Portpin auf high setzen |
#define STATUS_ON PORTB &= ~(1<<LED_STATUS) //Den Portpin auf low setzen |
#define STATUS_TOGGLE PORTB ^= ~(1<<LED_STATUS) //Den Portpin toggeln |
#define WEISS_ON PORTB |= (1<<LED_WS) //Den Portpin auf high setzen |
#define WEISS_OFF PORTB &= ~(1<<LED_WS) //Den Portpin auf low setzen |
#define PORT5_ON PORTC |= (1<<LED_PORT5) //Den Portpin auf high setzen |
#define PORT5_OFF PORTC &= ~(1<<LED_PORT5) //Den Portpin auf low setzen |
#define BLITZGN_ON PORTC |= (1<<LED_BLITZGN) //Den Portpin auf high setzen |
#define BLITZGN_OFF PORTC &= ~(1<<LED_BLITZGN) //Den Portpin auf low setzen |
#define BLITZRT_ON PORTC |= (1<<LED_BLITZRT) //Den Portpin auf high setzen |
#define BLITZRT_OFF PORTC &= ~(1<<LED_BLITZRT) //Den Portpin auf low setzen |
#define BLAU_ON PORTC |= (1<<LED_BL) //Den Portpin auf high setzen |
#define BLAU_OFF PORTC &= ~(1<<LED_BL) //Den Portpin auf low setzen |
#define GELB_ON PORTD |= (1<<LED_UNTENGB) //Den Portpin auf high setzen |
#define GELB_OFF PORTD &= ~(1<<LED_UNTENGB) //Den Portpin auf low setzen |
#define VORNGN_ON PORTD |= (1<<LED_VORNEGN) //Den Portpin auf high setzen |
#define VORNGN_OFF PORTD &= ~(1<<LED_VORNEGN) //Den Portpin auf low setzen |
#define HINTENGN_ON PORTC |= (1<<LED_HINTENGN) //Den Portpin auf high setzen |
#define HINTENGN_OFF PORTC &= ~(1<<LED_HINTENGN) //Den Portpin auf low setzen |
#define VORNRT_ON PORTD |= (1<<LED_VORNERT) //Den Portpin auf high setzen |
#define VORNRT_OFF PORTD &= ~(1<<LED_VORNERT) //Den Portpin auf low setzen |
#define HINTENRT_ON PORTD |= (1<<LED_HINTENRT) //Den Portpin auf high setzen |
#define HINTENRT_OFF PORTD &= ~(1<<LED_HINTENRT) //Den Portpin auf low setzen |
#define FAST_ALLES_OFF BLITZGN_OFF;BLITZRT_OFF;WEISS_OFF;BLAU_OFF;GELB_OFF;VORNGN_OFF;HINTENGN_OFF;VORNRT_OFF;HINTENRT_OFF;PORT5_OFF;STATUS_ON |
#define FAST_ALLES_ON BLITZGN_ON;BLITZRT_ON;WEISS_ON;BLAU_ON;GELB_ON;VORNGN_ON;HINTENGN_ON;VORNRT_ON;HINTENRT_ON;PORT5_ON;STATUS_OFF |
#define F_CPU 1000000UL |
#ifndef F_CPU |
#define F_CPU 1000000 |
#endif |
volatile uint8_t mode = 0; |
volatile uint8_t abbruch = 0; |
ISR(INT1_vect) |
{ |
// Interrupt Code |
if (mode <= 3) |
{ |
mode++; |
} |
else |
{ |
mode = 0; |
} |
// STATUS_TOGGLE; ausgeblendet |
abbruch = 1; |
} |
int main(void){ |
// Pin B |7|6|5|4|3|2|1|0 |
// Binär:|0|0|0|0|0|1|0|1 (b) => #05 (h) |
// Pin B0 und B2 als Ausgänge festlegen |
DDRB = 0x05; |
// Pin C |7|6|5|4|3|2|1|0 |
// Binär:|0|0|1|1|1|1|1|0 (b) => #3E (h) |
// Pin C1 bis C5 als Ausgänge festlegen |
DDRC = 0x3E; |
// Pin D |7|6|5|4|3|2|1|0 |
// Binär:|1|1|1|1|0|0|0|0 (b) => #F0 (h) |
DDRD = 0xF0; |
//Pullup für PD3 aktivieren |
PORTD |= (1 << PD3); |
//interrupt konfigurueren |
GIMSK = 1<<INT1; |
MCUCR = 1<<ISC10; |
FAST_ALLES_OFF; |
STATUS_OFF; |
sleep_ms(3000); |
STATUS_ON; |
sei(); //interrupts einschalten |
while(1){ |
abbruch = 0; |
FAST_ALLES_ON; |
sleep_ms(200); |
FAST_ALLES_OFF; |
sleep_ms(200); |
} |
} |
void sleep_ms(uint16_t ms){ |
if (abbruch == 0) |
{ |
while(ms) |
{ |
if (abbruch != 0) |
{ |
break; |
} |
else |
{ |
ms--; |
_delay_ms(1); |
} |
} |
} |
} |
/MikroBlink/sourcecode/LED port TEST/makefile |
---|
0,0 → 1,420 |
# WinAVR Sample makefile written by Eric B. Weddington, Jörg Wunsch, et al. |
# Released to the Public Domain |
# Please read the make user manual! |
# |
# Additional material for this makefile was submitted by: |
# Tim Henigan |
# Peter Fleury |
# Reiner Patommel |
# Sander Pool |
# Frederik Rouleau |
# Markus Pfaff |
# |
# On command line: |
# |
# make all = Make software. |
# |
# make clean = Clean out built project files. |
# |
# make coff = Convert ELF to AVR COFF (for use with AVR Studio 3.x or VMLAB). |
# |
# make extcoff = Convert ELF to AVR Extended COFF (for use with AVR Studio |
# 4.07 or greater). |
# |
# make program = Download the hex file to the device, using avrdude. Please |
# customize the avrdude settings below first! |
# |
# make filename.s = Just compile filename.c into the assembler code only |
# |
# To rebuild project do "make clean" then "make all". |
# |
# MCU name |
MCU = atmega8 |
#F_CPU = 1000000UL |
#Fuse settings for ATmega644 |
ifeq ($(MCU), atmega644) |
FUSE_BITS = -u -U lfuse:w:0xff:m -U hfuse:w:0xdf:m |
HEX_FILE_NAME = MEGA8 |
endif |
# Output format. (can be srec, ihex, binary) |
FORMAT = ihex |
# Target file name (without extension). |
TARGET = Hexfiles/MikroBlink_$(HEX_FILE_NAME) |
# Optimization level, can be [0, 1, 2, 3, s]. 0 turns off optimization. |
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) |
OPT = s |
# If there is more than one source file, append them above, or modify and |
# uncomment the following: |
SRC = main.c |
# List Assembler source files here. |
# Make them always end in a capital .S. Files ending in a lowercase .s |
# will not be considered source files but generated files (assembler |
# output from the compiler), and will be deleted upon "make clean"! |
# Even though the DOS/Win* filesystem matches both .s and .S the same, |
# it will preserve the spelling of the filenames, and gcc itself does |
# care about how the name is spelled on its command-line. |
ASRC = |
# List any extra directories to look for include files here. |
# Each directory must be seperated by a space. |
EXTRAINCDIRS = |
# Optional compiler flags. |
# -g: generate debugging information (for GDB, or for COFF conversion) |
# -O*: optimization level |
# -f...: tuning, see gcc manual and avr-libc documentation |
# -Wall...: warning level |
# -Wa,...: tell GCC to pass this to the assembler. |
# -ahlms: create assembler listing |
CFLAGS = -g -O$(OPT) \ |
-funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums \ |
-Wall -Wstrict-prototypes \ |
-Wa,-adhlns=$(<:.c=.lst) \ |
$(patsubst %,-I%,$(EXTRAINCDIRS)) |
# Set a "language standard" compiler flag. |
# Unremark just one line below to set the language standard to use. |
# gnu99 = C99 + GNU extensions. See GCC manual for more information. |
#CFLAGS += -std=c89 |
#CFLAGS += -std=gnu89 |
#CFLAGS += -std=c99 |
CFLAGS += -std=gnu99 |
# Optional assembler flags. |
# -Wa,...: tell GCC to pass this to the assembler. |
# -ahlms: create listing |
# -gstabs: have the assembler create line number information; note that |
# for use in COFF files, additional information about filenames |
# and function names needs to be present in the assembler source |
# files -- see avr-libc docs [FIXME: not yet described there] |
ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs |
# Optional linker flags. |
# -Wl,...: tell GCC to pass this to linker. |
# -Map: create map file |
# --cref: add cross reference to map file |
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref |
# Additional libraries |
# Minimalistic printf version |
#LDFLAGS += -Wl,-u,vfprintf -lprintf_min |
# Floating point printf version (requires -lm below) |
#LDFLAGS += -Wl,-u,vfprintf -lprintf_flt |
# -lm = math library |
LDFLAGS += -lm |
# Programming support using avrdude. Settings and variables. |
# Programming hardware: alf avr910 avrisp bascom bsd |
# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500 |
# |
# Type: avrdude -c ? |
# to get a full listing. |
# |
#AVRDUDE_PROGRAMMER = AVR910 |
#AVRDUDE_PROGRAMMER = stk300 |
#AVRDUDE_PROGRAMMER = USBasp |
#AVRDUDE_PROGRAMMER = dt006 |
#AVRDUDE_PROGRAMMER = bascom |
AVRDUDE_PROGRAMMER = siprog |
#AVRDUDE_PROGRAMMER = avrisp2 |
#AVRDUDE_PROGRAMMER = AVRISPMKII |
#AVRDUDE_PORT = usb # programmer connected to USB port |
AVRDUDE_PORT = com2 # programmer connected to serial device |
#AVRDUDE_PORT = lpt1 # programmer connected to parallel port |
AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex $(FUSE_BITS) |
#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep |
#AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -b 115200 -c $(AVRDUDE_PROGRAMMER) |
AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) |
# Uncomment the following if you want avrdude's erase cycle counter. |
# Note that this counter needs to be initialized first using -Yn, |
# see avrdude manual. |
#AVRDUDE_ERASE += -y |
# Uncomment the following if you do /not/ wish a verification to be |
# performed after programming the device. |
#AVRDUDE_FLAGS += -V |
# Increase verbosity level. Please use this when submitting bug |
# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude> |
# to submit bug reports. |
#AVRDUDE_FLAGS += -v -v |
# --------------------------------------------------------------------------- |
# Define directories, if needed. |
DIRAVR = c:/winavr |
DIRAVRBIN = $(DIRAVR)/bin |
DIRAVRUTILS = $(DIRAVR)/utils/bin |
DIRINC = . |
DIRLIB = $(DIRAVR)/avr/lib |
# Define programs and commands. |
SHELL = sh |
CC = avr-gcc |
OBJCOPY = avr-objcopy |
OBJDUMP = avr-objdump |
SIZE = avr-size |
# Programming support using avrdude. |
AVRDUDE = avrdude |
REMOVE = rm -f |
COPY = cp |
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex |
ELFSIZE = $(SIZE) -A $(TARGET).elf |
# Define Messages |
# English |
MSG_ERRORS_NONE = Errors: none |
MSG_BEGIN = -------- begin -------- |
MSG_END = -------- end -------- |
MSG_SIZE_BEFORE = Size before: |
MSG_SIZE_AFTER = Size after: |
MSG_COFF = Converting to AVR COFF: |
MSG_EXTENDED_COFF = Converting to AVR Extended COFF: |
MSG_FLASH = Creating load file for Flash: |
MSG_EEPROM = Creating load file for EEPROM: |
MSG_EXTENDED_LISTING = Creating Extended Listing: |
MSG_SYMBOL_TABLE = Creating Symbol Table: |
MSG_LINKING = Linking: |
MSG_COMPILING = Compiling: |
MSG_ASSEMBLING = Assembling: |
MSG_CLEANING = Cleaning project: |
# Define all object files. |
OBJ = $(SRC:.c=.o) $(ASRC:.S=.o) |
# Define all listing files. |
LST = $(ASRC:.S=.lst) $(SRC:.c=.lst) |
# Combine all necessary flags and optional flags. |
# Add target processor to flags. |
ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) |
ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) |
# Default target. |
all: begin gccversion sizebefore $(TARGET).elf $(TARGET).hex $(TARGET).eep \ |
$(TARGET).lss $(TARGET).sym sizeafter finished end |
# Eye candy. |
# AVR Studio 3.x does not check make's exit code but relies on |
# the following magic strings to be generated by the compile job. |
begin: |
@echo |
@echo $(MSG_BEGIN) |
finished: |
@echo $(MSG_ERRORS_NONE) |
end: |
@echo $(MSG_END) |
@echo |
# Display size of file. |
sizebefore: |
@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi |
sizeafter: |
@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi |
# Display compiler version information. |
gccversion : |
@$(CC) --version |
# Convert ELF to COFF for use in debugging / simulating in |
# AVR Studio or VMLAB. |
COFFCONVERT=$(OBJCOPY) --debugging \ |
--change-section-address .data-0x800000 \ |
--change-section-address .bss-0x800000 \ |
--change-section-address .noinit-0x800000 \ |
--change-section-address .eeprom-0x810000 |
coff: $(TARGET).elf |
@echo |
@echo $(MSG_COFF) $(TARGET).cof |
$(COFFCONVERT) -O coff-avr $< $(TARGET).cof |
extcoff: $(TARGET).elf |
@echo |
@echo $(MSG_EXTENDED_COFF) $(TARGET).cof |
$(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof |
# Program the device. |
program: $(TARGET).hex $(TARGET).eep |
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) |
# Create final output files (.hex, .eep) from ELF output file. |
%.hex: %.elf |
@echo |
@echo $(MSG_FLASH) $@ |
$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@ |
%.eep: %.elf |
@echo |
@echo $(MSG_EEPROM) $@ |
-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ |
--change-section-lma .eeprom=0 -O $(FORMAT) $< $@ |
# Create extended listing file from ELF output file. |
%.lss: %.elf |
@echo |
@echo $(MSG_EXTENDED_LISTING) $@ |
$(OBJDUMP) -h -S $< > $@ |
# Create a symbol table from ELF output file. |
%.sym: %.elf |
@echo |
@echo $(MSG_SYMBOL_TABLE) $@ |
avr-nm -n $< > $@ |
# Link: create ELF output file from object files. |
.SECONDARY : $(TARGET).elf |
.PRECIOUS : $(OBJ) |
%.elf: $(OBJ) |
@echo |
@echo $(MSG_LINKING) $@ |
$(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS) |
# Compile: create object files from C source files. |
%.o : %.c |
@echo |
@echo $(MSG_COMPILING) $< |
$(CC) -c $(ALL_CFLAGS) $< -o $@ |
# Compile: create assembler files from C source files. |
%.s : %.c |
$(CC) -S $(ALL_CFLAGS) $< -o $@ |
# Assemble: create object files from assembler source files. |
%.o : %.S |
@echo |
@echo $(MSG_ASSEMBLING) $< |
$(CC) -c $(ALL_ASFLAGS) $< -o $@ |
# Target: clean project. |
clean: begin clean_list finished end |
clean_list : |
@echo |
@echo $(MSG_CLEANING) |
# $(REMOVE) $(TARGET).hex |
$(REMOVE) $(TARGET).eep |
$(REMOVE) $(TARGET).obj |
$(REMOVE) $(TARGET).cof |
$(REMOVE) $(TARGET).elf |
$(REMOVE) $(TARGET).map |
$(REMOVE) $(TARGET).obj |
$(REMOVE) $(TARGET).a90 |
$(REMOVE) $(TARGET).sym |
$(REMOVE) $(TARGET).lnk |
$(REMOVE) $(TARGET).lss |
$(REMOVE) $(OBJ) |
$(REMOVE) $(LST) |
$(REMOVE) $(SRC:.c=.s) |
$(REMOVE) $(SRC:.c=.d) |
# Automatically generate C source code dependencies. |
# (Code originally taken from the GNU make user manual and modified |
# (See README.txt Credits).) |
# |
# Note that this will work with sh (bash) and sed that is shipped with WinAVR |
# (see the SHELL variable defined above). |
# This may not work with other shells or other seds. |
# |
%.d: %.c |
set -e; $(CC) -MM $(ALL_CFLAGS) $< \ |
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > $@; \ |
[ -s $@ ] || rm -f $@ |
# Remove the '-' if you want to see the dependency files generated. |
-include $(SRC:.c=.d) |
# Listing of phony targets. |
.PHONY : all begin finish end sizebefore sizeafter gccversion coff extcoff \ |
clean clean_list program |
/MikroBlink/sourcecode/Misthaken_V2/Hexfiles/MikroBlink_.eep |
---|
0,0 → 1,0 |
:00000001FF |
/MikroBlink/sourcecode/Misthaken_V2/Hexfiles/MikroBlink_.hex |
---|
0,0 → 1,74 |
:1000000012C02CC02CC02AC029C028C027C026C0BE |
:1000100025C024C023C022C021C020C01FC01EC0D4 |
:100020001DC01CC01BC011241FBECFE5D4E0DEBF25 |
:10003000CDBF10E0A0E6B0E0E0E9F4E002C005903A |
:100040000D92A036B107D9F710E0A0E6B0E001C0EC |
:100050001D92A236B107E1F723D018C2D1CF1F926B |
:100060000F920FB60F9211248F939F93809160008F |
:10007000843030F4809160008F5F8093600002C014 |
:100080001092600088B39EEF892788BB81E080933F |
:1000900061009F918F910F900FBE0F901F90189548 |
:1000A00085E087BB8EE384BB80EF81BB939A80E8B9 |
:1000B0008BBF84E085BFAB98AA98C298A998969800 |
:1000C0009598AD9897989498C09A809161008823EC |
:1000D00081F428EB3BE04AEF50E0809161008823F7 |
:1000E00041F421503040CA010197F1F72115310543 |
:1000F000A1F7C09878944AEF50E010926100809187 |
:100100006000882309F056C0AA98AB98C29A8091E3 |
:100110006100882371F422E330E08091610088233C |
:1001200041F421503040CA010197F1F72115310502 |
:10013000A1F7C298A99A80916100882371F422E303 |
:1001400030E080916100882341F421503040CA01A1 |
:100150000197F1F721153105A1F7A998959AAD9A64 |
:1001600080916100882371F422E330E08091610086 |
:10017000882341F421503040CA010197F1F721153D |
:100180003105A1F79598AD98979A949A809161005E |
:10019000882371F422E330E080916100882341F4E8 |
:1001A00021503040CA010197F1F721153105A1F71F |
:1001B0009798949880916000813049F4AB98AA9800 |
:1001C000C298A99896989598AD9897989498809188 |
:1001D0006000823049F4AB9AAA9AC29AA99A969A78 |
:1001E000959AAD9A979A949A80916000833009F01D |
:1001F0008DC0C298A998969A9598AD98949897981A |
:10020000AB9A80916100882371F42EE130E08091F7 |
:100210006100882341F421503040CA010197F1F771 |
:1002200021153105A1F7AB9880916100882371F405 |
:100230002CE330E080916100882341F4215030406C |
:10024000CA010197F1F721153105A1F7AA9A80910A |
:100250006100882371F42EE130E0809161008823F1 |
:1002600041F421503040CA010197F1F721153105C1 |
:10027000A1F7AA9880916100882371F428EC30E0FE |
:1002800080916100882341F421503040CA010197D8 |
:10029000F1F721153105A1F7AB9A80916100882310 |
:1002A00071F42EE130E080916100882341F4215007 |
:1002B0003040CA010197F1F721153105A1F7AB983C |
:1002C000AA9A80916100882371F42EE130E0809138 |
:1002D0006100882341F421503040CA010197F1F7B1 |
:1002E00021153105A1F7AA9880916100882371F446 |
:1002F00028EE33E080916100882341F421503040A2 |
:10030000CA010197F1F721153105A1F7809160002D |
:10031000843009F090C0C29AA99A969A9598AD989F |
:1003200094989798AB9A80916100882371F42EE19C |
:1003300030E080916100882341F421503040CA01AF |
:100340000197F1F721153105A1F7AB988091610074 |
:10035000882371F42CE330E080916100882341F41C |
:1003600021503040CA010197F1F721153105A1F75D |
:10037000AA9A80916100882371F42EE130E0809187 |
:100380006100882341F421503040CA010197F1F700 |
:1003900021153105A1F7AA9880916100882371F495 |
:1003A00028EC30E080916100882341F421503040F6 |
:1003B000CA010197F1F721153105A1F7AB9A809198 |
:1003C0006100882371F42EE130E080916100882380 |
:1003D00041F421503040CA010197F1F72115310550 |
:1003E000A1F7AB98AA9A80916100882371F42EE15D |
:1003F00030E080916100882341F421503040CA01EF |
:100400000197F1F721153105A1F7AA9880916100B4 |
:10041000882309F072CE28EE33E0809161008823B2 |
:1004200009F06BCE21503040CA010197F1F7211538 |
:10043000310599F762CE80916100882309F05DCE85 |
:100440002AE030E080916100882309F056CE2150E7 |
:100450003040CA010197F1F72115310599F74DCECA |
:100460009C0180916100882359F00895809161007A |
:10047000882359F421503040FA013197F1F702C036 |
:100480004AEF50E02115310589F70895F894FFCF20 |
:00000001FF |
/MikroBlink/sourcecode/Misthaken_V2/main.c |
---|
0,0 → 1,229 |
// |
// Grottenflieger hat: Nisthakens main.c angepasst auf PCB version 2.2 |
// |
#include <avr/io.h> |
#include <util/delay.h> |
#include <stdint.h> |
#include <avr/interrupt.h> |
void sleep_ms(uint16_t ms); |
#define LED_WS PB2 // LED port 1 |
#define LED_BL PC1 // LED port 2 |
#define LED_BLITZRT PC2 // LED port 3 |
#define LED_BLITZGN PC3 // LED port 4 |
#define LED_PORT5 PC4 // LED port 5 |
#define LED_HINTENGN PC5 // LED port 6 |
#define LED_HINTENRT PD4 // LED port 7 |
#define LED_VORNEGN PD5 // LED port 8 |
#define LED_UNTENGB PD6 // LED port 9 |
#define LED_VORNERT PD7 // LED port 10 |
#define LED_STATUS PB0 // LED blau - on board |
#define STATUS_OFF PORTB |= (1<<LED_STATUS) //Den Portpin auf high setzen |
#define STATUS_ON PORTB &= ~(1<<LED_STATUS) //Den Portpin auf low setzen |
#define STATUS_TOGGLE PORTB ^= ~(1<<LED_STATUS) //Den Portpin toggeln |
#define WEISS_ON PORTB |= (1<<LED_WS) //Den Portpin auf high setzen |
#define WEISS_OFF PORTB &= ~(1<<LED_WS) //Den Portpin auf low setzen |
#define PORT5_ON PORTC |= (1<<LED_PORT5) //Den Portpin auf high setzen |
#define PORT5_OFF PORTC &= ~(1<<LED_PORT5) //Den Portpin auf low setzen |
#define BLITZGN_ON PORTC |= (1<<LED_BLITZGN) //Den Portpin auf high setzen |
#define BLITZGN_OFF PORTC &= ~(1<<LED_BLITZGN) //Den Portpin auf low setzen |
#define BLITZRT_ON PORTC |= (1<<LED_BLITZRT) //Den Portpin auf high setzen |
#define BLITZRT_OFF PORTC &= ~(1<<LED_BLITZRT) //Den Portpin auf low setzen |
#define BLAU_ON PORTC |= (1<<LED_BL) //Den Portpin auf high setzen |
#define BLAU_OFF PORTC &= ~(1<<LED_BL) //Den Portpin auf low setzen |
#define GELB_ON PORTD |= (1<<LED_UNTENGB) //Den Portpin auf high setzen |
#define GELB_OFF PORTD &= ~(1<<LED_UNTENGB) //Den Portpin auf low setzen |
#define VORNGN_ON PORTD |= (1<<LED_VORNEGN) //Den Portpin auf high setzen |
#define VORNGN_OFF PORTD &= ~(1<<LED_VORNEGN) //Den Portpin auf low setzen |
#define HINTENGN_ON PORTC |= (1<<LED_HINTENGN) //Den Portpin auf high setzen |
#define HINTENGN_OFF PORTC &= ~(1<<LED_HINTENGN) //Den Portpin auf low setzen |
#define VORNRT_ON PORTD |= (1<<LED_VORNERT) //Den Portpin auf high setzen |
#define VORNRT_OFF PORTD &= ~(1<<LED_VORNERT) //Den Portpin auf low setzen |
#define HINTENRT_ON PORTD |= (1<<LED_HINTENRT) //Den Portpin auf high setzen |
#define HINTENRT_OFF PORTD &= ~(1<<LED_HINTENRT) //Den Portpin auf low setzen |
#define ALLES_OFF BLITZGN_OFF;BLITZRT_OFF;WEISS_OFF;BLAU_OFF;GELB_OFF;VORNGN_OFF;HINTENGN_OFF;VORNRT_OFF;HINTENRT_OFF |
#define ALLES_ON BLITZGN_ON;BLITZRT_ON;WEISS_ON;BLAU_ON;GELB_ON;VORNGN_ON;HINTENGN_ON;VORNRT_ON;HINTENRT_ON |
#define F_CPU 1000000UL |
#ifndef F_CPU |
#define F_CPU 1000000 |
#endif |
volatile uint8_t mode = 0; |
volatile uint8_t abbruch = 0; |
ISR(INT1_vect) |
{ |
// Interrupt Code |
if (mode <= 3) |
{ |
mode++; |
} |
else |
{ |
mode = 0; |
} |
STATUS_TOGGLE; |
abbruch = 1; |
} |
int main(void){ |
// Ports einstellen |
// Pin B |7|6|5|4|3|2|1|0 |
// Binär:|0|0|0|0|0|1|0|1 (b) => #05 (h) |
// Pin B0 und B2 als Ausgänge festlegen |
DDRB = 0x05; |
// Pin C |7|6|5|4|3|2|1|0 |
// Binär:|0|0|1|1|1|1|1|0 (b) => #3E (h) |
// Pin C1 bis C5 als Ausgänge festlegen |
DDRC = 0x3E; |
// Pin D |7|6|5|4|3|2|1|0 |
// Binär:|1|1|1|1|0|0|0|0 (b) => #F0 (h) |
DDRD = 0xF0; |
//Pullup für PD3 aktivieren |
PORTD |= (1 << PD3); |
//interrupt konfigurueren |
GIMSK = 1<<INT1; |
MCUCR = 1<<ISC10; |
ALLES_OFF; |
STATUS_OFF; |
sleep_ms(3000); |
STATUS_ON; |
sei(); //interrupts einschalten |
while(1){ |
abbruch = 0; |
if (mode == 0) |
{ |
BLITZRT_OFF; |
BLITZGN_OFF; |
WEISS_ON; |
sleep_ms(50); |
WEISS_OFF; |
BLAU_ON; |
sleep_ms(50); |
BLAU_OFF; |
VORNGN_ON; |
HINTENGN_ON; |
sleep_ms(50); |
VORNGN_OFF; |
HINTENGN_OFF; |
VORNRT_ON; |
HINTENRT_ON; |
sleep_ms(50); |
VORNRT_OFF; |
HINTENRT_OFF; |
} |
if (mode == 1) //mit diesem Mode wird gestartet |
{ |
ALLES_OFF; |
} |
if (mode == 2) |
{ |
ALLES_ON; |
} |
if (mode == 3) //Dieser Mode ist nach dem Kalibrieren an |
{ |
WEISS_OFF; |
BLAU_OFF; |
GELB_ON; |
VORNGN_OFF; |
HINTENGN_OFF; |
HINTENRT_OFF; |
VORNRT_OFF; |
BLITZGN_ON; |
sleep_ms(30); |
BLITZGN_OFF; |
sleep_ms(60); |
BLITZRT_ON; |
sleep_ms(30); |
BLITZRT_OFF; |
sleep_ms(200); |
BLITZGN_ON; |
sleep_ms(30); |
BLITZGN_OFF; |
BLITZRT_ON; |
sleep_ms(30); |
BLITZRT_OFF; |
sleep_ms(1000); |
} |
if (mode == 4) |
{ |
WEISS_ON; |
BLAU_ON; |
GELB_ON; |
VORNGN_OFF; |
HINTENGN_OFF; |
HINTENRT_OFF; |
VORNRT_OFF; |
BLITZGN_ON; |
sleep_ms(30); |
BLITZGN_OFF; |
sleep_ms(60); |
BLITZRT_ON; |
sleep_ms(30); |
BLITZRT_OFF; |
sleep_ms(200); |
BLITZGN_ON; |
sleep_ms(30); |
BLITZGN_OFF; |
BLITZRT_ON; |
sleep_ms(30); |
BLITZRT_OFF; |
sleep_ms(1000); |
} |
else |
{ |
sleep_ms(10); |
} |
} |
} |
void sleep_ms(uint16_t ms){ |
if (abbruch == 0) |
{ |
while(ms) |
{ |
if (abbruch != 0) |
{ |
break; |
} |
else |
{ |
ms--; |
_delay_ms(1); |
} |
} |
} |
} |
/MikroBlink/sourcecode/Misthaken_V2/makefile |
---|
0,0 → 1,420 |
# WinAVR Sample makefile written by Eric B. Weddington, Jörg Wunsch, et al. |
# Released to the Public Domain |
# Please read the make user manual! |
# |
# Additional material for this makefile was submitted by: |
# Tim Henigan |
# Peter Fleury |
# Reiner Patommel |
# Sander Pool |
# Frederik Rouleau |
# Markus Pfaff |
# |
# On command line: |
# |
# make all = Make software. |
# |
# make clean = Clean out built project files. |
# |
# make coff = Convert ELF to AVR COFF (for use with AVR Studio 3.x or VMLAB). |
# |
# make extcoff = Convert ELF to AVR Extended COFF (for use with AVR Studio |
# 4.07 or greater). |
# |
# make program = Download the hex file to the device, using avrdude. Please |
# customize the avrdude settings below first! |
# |
# make filename.s = Just compile filename.c into the assembler code only |
# |
# To rebuild project do "make clean" then "make all". |
# |
# MCU name |
MCU = atmega8 |
#F_CPU = 1000000UL |
#Fuse settings for ATmega644 |
ifeq ($(MCU), atmega644) |
FUSE_BITS = -u -U lfuse:w:0xff:m -U hfuse:w:0xdf:m |
HEX_FILE_NAME = MEGA8 |
endif |
# Output format. (can be srec, ihex, binary) |
FORMAT = ihex |
# Target file name (without extension). |
TARGET = Hexfiles/MikroBlink_$(HEX_FILE_NAME) |
# Optimization level, can be [0, 1, 2, 3, s]. 0 turns off optimization. |
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) |
OPT = s |
# If there is more than one source file, append them above, or modify and |
# uncomment the following: |
SRC = main.c |
# List Assembler source files here. |
# Make them always end in a capital .S. Files ending in a lowercase .s |
# will not be considered source files but generated files (assembler |
# output from the compiler), and will be deleted upon "make clean"! |
# Even though the DOS/Win* filesystem matches both .s and .S the same, |
# it will preserve the spelling of the filenames, and gcc itself does |
# care about how the name is spelled on its command-line. |
ASRC = |
# List any extra directories to look for include files here. |
# Each directory must be seperated by a space. |
EXTRAINCDIRS = |
# Optional compiler flags. |
# -g: generate debugging information (for GDB, or for COFF conversion) |
# -O*: optimization level |
# -f...: tuning, see gcc manual and avr-libc documentation |
# -Wall...: warning level |
# -Wa,...: tell GCC to pass this to the assembler. |
# -ahlms: create assembler listing |
CFLAGS = -g -O$(OPT) \ |
-funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums \ |
-Wall -Wstrict-prototypes \ |
-Wa,-adhlns=$(<:.c=.lst) \ |
$(patsubst %,-I%,$(EXTRAINCDIRS)) |
# Set a "language standard" compiler flag. |
# Unremark just one line below to set the language standard to use. |
# gnu99 = C99 + GNU extensions. See GCC manual for more information. |
#CFLAGS += -std=c89 |
#CFLAGS += -std=gnu89 |
#CFLAGS += -std=c99 |
CFLAGS += -std=gnu99 |
# Optional assembler flags. |
# -Wa,...: tell GCC to pass this to the assembler. |
# -ahlms: create listing |
# -gstabs: have the assembler create line number information; note that |
# for use in COFF files, additional information about filenames |
# and function names needs to be present in the assembler source |
# files -- see avr-libc docs [FIXME: not yet described there] |
ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs |
# Optional linker flags. |
# -Wl,...: tell GCC to pass this to linker. |
# -Map: create map file |
# --cref: add cross reference to map file |
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref |
# Additional libraries |
# Minimalistic printf version |
#LDFLAGS += -Wl,-u,vfprintf -lprintf_min |
# Floating point printf version (requires -lm below) |
#LDFLAGS += -Wl,-u,vfprintf -lprintf_flt |
# -lm = math library |
LDFLAGS += -lm |
# Programming support using avrdude. Settings and variables. |
# Programming hardware: alf avr910 avrisp bascom bsd |
# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500 |
# |
# Type: avrdude -c ? |
# to get a full listing. |
# |
#AVRDUDE_PROGRAMMER = AVR910 |
#AVRDUDE_PROGRAMMER = stk300 |
#AVRDUDE_PROGRAMMER = USBasp |
#AVRDUDE_PROGRAMMER = dt006 |
#AVRDUDE_PROGRAMMER = bascom |
AVRDUDE_PROGRAMMER = siprog |
#AVRDUDE_PROGRAMMER = avrisp2 |
#AVRDUDE_PROGRAMMER = AVRISPMKII |
#AVRDUDE_PORT = usb # programmer connected to USB port |
AVRDUDE_PORT = com2 # programmer connected to serial device |
#AVRDUDE_PORT = lpt1 # programmer connected to parallel port |
AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex $(FUSE_BITS) |
#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep |
#AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -b 115200 -c $(AVRDUDE_PROGRAMMER) |
AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) |
# Uncomment the following if you want avrdude's erase cycle counter. |
# Note that this counter needs to be initialized first using -Yn, |
# see avrdude manual. |
#AVRDUDE_ERASE += -y |
# Uncomment the following if you do /not/ wish a verification to be |
# performed after programming the device. |
#AVRDUDE_FLAGS += -V |
# Increase verbosity level. Please use this when submitting bug |
# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude> |
# to submit bug reports. |
#AVRDUDE_FLAGS += -v -v |
# --------------------------------------------------------------------------- |
# Define directories, if needed. |
DIRAVR = c:/winavr |
DIRAVRBIN = $(DIRAVR)/bin |
DIRAVRUTILS = $(DIRAVR)/utils/bin |
DIRINC = . |
DIRLIB = $(DIRAVR)/avr/lib |
# Define programs and commands. |
SHELL = sh |
CC = avr-gcc |
OBJCOPY = avr-objcopy |
OBJDUMP = avr-objdump |
SIZE = avr-size |
# Programming support using avrdude. |
AVRDUDE = avrdude |
REMOVE = rm -f |
COPY = cp |
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex |
ELFSIZE = $(SIZE) -A $(TARGET).elf |
# Define Messages |
# English |
MSG_ERRORS_NONE = Errors: none |
MSG_BEGIN = -------- begin -------- |
MSG_END = -------- end -------- |
MSG_SIZE_BEFORE = Size before: |
MSG_SIZE_AFTER = Size after: |
MSG_COFF = Converting to AVR COFF: |
MSG_EXTENDED_COFF = Converting to AVR Extended COFF: |
MSG_FLASH = Creating load file for Flash: |
MSG_EEPROM = Creating load file for EEPROM: |
MSG_EXTENDED_LISTING = Creating Extended Listing: |
MSG_SYMBOL_TABLE = Creating Symbol Table: |
MSG_LINKING = Linking: |
MSG_COMPILING = Compiling: |
MSG_ASSEMBLING = Assembling: |
MSG_CLEANING = Cleaning project: |
# Define all object files. |
OBJ = $(SRC:.c=.o) $(ASRC:.S=.o) |
# Define all listing files. |
LST = $(ASRC:.S=.lst) $(SRC:.c=.lst) |
# Combine all necessary flags and optional flags. |
# Add target processor to flags. |
ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) |
ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) |
# Default target. |
all: begin gccversion sizebefore $(TARGET).elf $(TARGET).hex $(TARGET).eep \ |
$(TARGET).lss $(TARGET).sym sizeafter finished end |
# Eye candy. |
# AVR Studio 3.x does not check make's exit code but relies on |
# the following magic strings to be generated by the compile job. |
begin: |
@echo |
@echo $(MSG_BEGIN) |
finished: |
@echo $(MSG_ERRORS_NONE) |
end: |
@echo $(MSG_END) |
@echo |
# Display size of file. |
sizebefore: |
@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi |
sizeafter: |
@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi |
# Display compiler version information. |
gccversion : |
@$(CC) --version |
# Convert ELF to COFF for use in debugging / simulating in |
# AVR Studio or VMLAB. |
COFFCONVERT=$(OBJCOPY) --debugging \ |
--change-section-address .data-0x800000 \ |
--change-section-address .bss-0x800000 \ |
--change-section-address .noinit-0x800000 \ |
--change-section-address .eeprom-0x810000 |
coff: $(TARGET).elf |
@echo |
@echo $(MSG_COFF) $(TARGET).cof |
$(COFFCONVERT) -O coff-avr $< $(TARGET).cof |
extcoff: $(TARGET).elf |
@echo |
@echo $(MSG_EXTENDED_COFF) $(TARGET).cof |
$(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof |
# Program the device. |
program: $(TARGET).hex $(TARGET).eep |
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) |
# Create final output files (.hex, .eep) from ELF output file. |
%.hex: %.elf |
@echo |
@echo $(MSG_FLASH) $@ |
$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@ |
%.eep: %.elf |
@echo |
@echo $(MSG_EEPROM) $@ |
-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ |
--change-section-lma .eeprom=0 -O $(FORMAT) $< $@ |
# Create extended listing file from ELF output file. |
%.lss: %.elf |
@echo |
@echo $(MSG_EXTENDED_LISTING) $@ |
$(OBJDUMP) -h -S $< > $@ |
# Create a symbol table from ELF output file. |
%.sym: %.elf |
@echo |
@echo $(MSG_SYMBOL_TABLE) $@ |
avr-nm -n $< > $@ |
# Link: create ELF output file from object files. |
.SECONDARY : $(TARGET).elf |
.PRECIOUS : $(OBJ) |
%.elf: $(OBJ) |
@echo |
@echo $(MSG_LINKING) $@ |
$(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS) |
# Compile: create object files from C source files. |
%.o : %.c |
@echo |
@echo $(MSG_COMPILING) $< |
$(CC) -c $(ALL_CFLAGS) $< -o $@ |
# Compile: create assembler files from C source files. |
%.s : %.c |
$(CC) -S $(ALL_CFLAGS) $< -o $@ |
# Assemble: create object files from assembler source files. |
%.o : %.S |
@echo |
@echo $(MSG_ASSEMBLING) $< |
$(CC) -c $(ALL_ASFLAGS) $< -o $@ |
# Target: clean project. |
clean: begin clean_list finished end |
clean_list : |
@echo |
@echo $(MSG_CLEANING) |
# $(REMOVE) $(TARGET).hex |
$(REMOVE) $(TARGET).eep |
$(REMOVE) $(TARGET).obj |
$(REMOVE) $(TARGET).cof |
$(REMOVE) $(TARGET).elf |
$(REMOVE) $(TARGET).map |
$(REMOVE) $(TARGET).obj |
$(REMOVE) $(TARGET).a90 |
$(REMOVE) $(TARGET).sym |
$(REMOVE) $(TARGET).lnk |
$(REMOVE) $(TARGET).lss |
$(REMOVE) $(OBJ) |
$(REMOVE) $(LST) |
$(REMOVE) $(SRC:.c=.s) |
$(REMOVE) $(SRC:.c=.d) |
# Automatically generate C source code dependencies. |
# (Code originally taken from the GNU make user manual and modified |
# (See README.txt Credits).) |
# |
# Note that this will work with sh (bash) and sed that is shipped with WinAVR |
# (see the SHELL variable defined above). |
# This may not work with other shells or other seds. |
# |
%.d: %.c |
set -e; $(CC) -MM $(ALL_CFLAGS) $< \ |
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > $@; \ |
[ -s $@ ] || rm -f $@ |
# Remove the '-' if you want to see the dependency files generated. |
-include $(SRC:.c=.d) |
# Listing of phony targets. |
.PHONY : all begin finish end sizebefore sizeafter gccversion coff extcoff \ |
clean clean_list program |