From 72836e52e1e386c2f4f5dd70553914a3c8feb325 Mon Sep 17 00:00:00 2001 From: Jonas Gunz Date: Sun, 19 Oct 2014 22:35:32 +0200 Subject: Uploaded --- .gitattributes | 3 + .gitignore | 227 +++++++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 125 +++++++++++++++++++++++++++++ Tacho_screen.c | 189 ++++++++++++++++++++++++++++++++++++++++++++ Tacho_screen.cproj | 115 +++++++++++++++++++++++++++ 5 files changed, 659 insertions(+) create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 Tacho_screen.c create mode 100644 Tacho_screen.cproj diff --git a/.gitattributes b/.gitattributes index 412eeda..157cc39 100644 --- a/.gitattributes +++ b/.gitattributes @@ -8,6 +8,9 @@ *.vbproj merge=union *.fsproj merge=union *.dbproj merge=union +*.cproj merge=union + + # Standard to msysgit *.doc diff=astextplain diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..714a294 --- /dev/null +++ b/.gitignore @@ -0,0 +1,227 @@ +################# +## Eclipse +################# + +*.pydevproject +.project +.metadata +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.classpath +.settings/ +.loadpath + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# CDT-specific +.cproject + +# PDT-specific +.buildpath + + +################# +## Visual Studio +################# + +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.sln.docstates + +# Build results + +[Dd]ebug/ +[Rr]elease/ +x64/ +build/ +[Bb]in/ +[Oo]bj/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +*_i.c +*_p.c +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.log +*.scc + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +*.ncrunch* +.*crunch*.local.xml + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.Publish.xml +*.pubxml +*.publishproj + +# NuGet Packages Directory +## TODO: If you have NuGet Package Restore enabled, uncomment the next line +#packages/ + +# Windows Azure Build Output +csx +*.build.csdef + +# Windows Store app package directory +AppPackages/ + +# Others +sql/ +*.Cache +ClientBin/ +[Ss]tyle[Cc]op.* +~$* +*~ +*.dbmdl +*.[Pp]ublish.xml +*.pfx +*.publishsettings + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file to a newer +# Visual Studio version. Backup files are not needed, because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +App_Data/*.mdf +App_Data/*.ldf + +############# +## Windows detritus +############# + +# Windows image file caches +Thumbs.db +ehthumbs.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Mac crap +.DS_Store + + +############# +## Python +############# + +*.py[cod] + +# Packages +*.egg +*.egg-info +dist/ +build/ +eggs/ +parts/ +var/ +sdist/ +develop-eggs/ +.installed.cfg + +# Installer logs +pip-log.txt + +# Unit test / coverage reports +.coverage +.tox + +#Translations +*.mo + +#Mr Developer +.mr.developer.cfg + +#avr + +.mk +.d +.eep +.elf +.lss +.map +.o +.srec \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..879a067 --- /dev/null +++ b/Makefile @@ -0,0 +1,125 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +SHELL := cmd.exe +RM := rm -rf + +USER_OBJS := + +LIBS := +PROJ := + +O_SRCS := +C_SRCS := +S_SRCS := +S_UPPER_SRCS := +OBJ_SRCS := +ASM_SRCS := +PREPROCESSING_SRCS := +OBJS := +OBJS_AS_ARGS := +C_DEPS := +C_DEPS_AS_ARGS := +EXECUTABLES := +OUTPUT_FILE_PATH := +OUTPUT_FILE_PATH_AS_ARGS := +AVR_APP_PATH :=$$$AVR_APP_PATH$$$ +QUOTE := " +ADDITIONAL_DEPENDENCIES:= +OUTPUT_FILE_DEP:= +LIB_DEP:= + +# Every subdirectory with source files must be described here +SUBDIRS := + + +# Add inputs and outputs from these tool invocations to the build variables +C_SRCS += \ +../Tacho_screen.c + + +PREPROCESSING_SRCS += + + +ASM_SRCS += + + +OBJS += \ +Tacho_screen.o + +OBJS_AS_ARGS += \ +Tacho_screen.o + +C_DEPS += \ +Tacho_screen.d + +C_DEPS_AS_ARGS += \ +Tacho_screen.d + +OUTPUT_FILE_PATH +=Tacho_screen.elf + +OUTPUT_FILE_PATH_AS_ARGS +=Tacho_screen.elf + +ADDITIONAL_DEPENDENCIES:= + +OUTPUT_FILE_DEP:= ./makedep.mk + +LIB_DEP+= + +# AVR32/GNU C Compiler + + + +./%.o: .././%.c + @echo Building file: $< + @echo Invoking: AVR/GNU C Compiler : 3.4.2 + $(QUOTE)C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.2.1002\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -funsigned-char -funsigned-bitfields -DDEBUG -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -g2 -Wall -mmcu=atmega8 -c -std=gnu99 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<" + @echo Finished building: $< + + + + +# AVR32/GNU Preprocessing Assembler + + + +# AVR32/GNU Assembler + + + + +ifneq ($(MAKECMDGOALS),clean) +ifneq ($(strip $(C_DEPS)),) +-include $(C_DEPS) +endif +endif + +# Add inputs and outputs from these tool invocations to the build variables + +# All Target +all: $(OUTPUT_FILE_PATH) $(ADDITIONAL_DEPENDENCIES) + +$(OUTPUT_FILE_PATH): $(OBJS) $(USER_OBJS) $(OUTPUT_FILE_DEP) $(LIB_DEP) + @echo Building target: $@ + @echo Invoking: AVR/GNU Linker : 3.4.2 + $(QUOTE)C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.2.1002\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -o$(OUTPUT_FILE_PATH_AS_ARGS) $(OBJS_AS_ARGS) $(USER_OBJS) $(LIBS) -Wl,-Map="Tacho_screen.map" -Wl,--start-group -Wl,-lm -Wl,--end-group -Wl,--gc-sections -mmcu=atmega8 + @echo Finished building target: $@ + "C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.2.1002\avr8-gnu-toolchain\bin\avr-objcopy.exe" -O ihex -R .eeprom -R .fuse -R .lock -R .signature "Tacho_screen.elf" "Tacho_screen.hex" + "C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.2.1002\avr8-gnu-toolchain\bin\avr-objcopy.exe" -j .eeprom --set-section-flags=.eeprom=alloc,load --change-section-lma .eeprom=0 --no-change-warnings -O ihex "Tacho_screen.elf" "Tacho_screen.eep" || exit 0 + "C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.2.1002\avr8-gnu-toolchain\bin\avr-objdump.exe" -h -S "Tacho_screen.elf" > "Tacho_screen.lss" + "C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.2.1002\avr8-gnu-toolchain\bin\avr-objcopy.exe" -O srec -R .eeprom -R .fuse -R .lock -R .signature "Tacho_screen.elf" "Tacho_screen.srec" + "C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.2.1002\avr8-gnu-toolchain\bin\avr-size.exe" "Tacho_screen.elf" + + + + + + + +# Other Targets +clean: + -$(RM) $(OBJS_AS_ARGS) $(EXECUTABLES) + -$(RM) $(C_DEPS_AS_ARGS) + rm -rf "Tacho_screen.elf" "Tacho_screen.a" "Tacho_screen.hex" "Tacho_screen.lss" "Tacho_screen.eep" "Tacho_screen.map" "Tacho_screen.srec" + \ No newline at end of file diff --git a/Tacho_screen.c b/Tacho_screen.c new file mode 100644 index 0000000..df8d34c --- /dev/null +++ b/Tacho_screen.c @@ -0,0 +1,189 @@ +/* + * Tacho.c + * + * Created: 19.06.2014 15:33:40 + * Author: Jonas + */ + +#define F_CPU 1000000 +#include +#include +#include + +#define _PRIM PORTC +#define _SEC PORTD + +#define _WHEEL_SIZE 207 + +//Define characters (negative) +#define _C1 0b10101111//0b01010000 +#define _C2 0b11001000//0b00110111 +#define _C3 0b10101000//0b00000000 +#define _C4 0b10100101//0b00000000 +#define _C5 0b10110000//0b00000000 +#define _C6 0b10010001//0b00000000 +#define _C7 0b10101110//0b00000000 +#define _C8 0b10000000//0b00000000 +#define _C9 0b10100000//0b00000000 +#define _C0 0b10000010//0b00000000 +#define _C_ 0b11111101 +#define _CCLEAR 255 + +uint32_t cntr; +unsigned int speed; + +ISR(TIMER0_OVF_vect) +{ + cntr++; +} + +inline void calcSpeed(void) +{ + float tmrSpeed = F_CPU / 256; + float tmrTime = 1 / tmrSpeed; + float comTime = tmrTime * cntr; + + float mps = (_WHEEL_SIZE / 100) / comTime; + + float kmph = mps * 3.6; + + speed = (int)kmph; +}//calcSpeed() + +inline void render(int _screen) +{ + char cNr[16]; + + int i1, i2; + + itoa(_screen, cNr, 10); //convert int to string for rendering + + if(_screen < 10) + { + i1 = 0; + i2 = 1; + cNr[1] = '0'; + } + else + { + i1 = 1; + i2 = 0; + } + + if(_screen > 99 || _screen < 0) + { + _SEC = _PRIM = _C_; + } + else + { + switch (cNr[i1]) //first character + { + case '0': + _PRIM = _C0; + PORTB &= ~(1< + + + 2.0 + 6.1 + com.Atmel.AVRGCC8.C + {862c290e-ca5a-4544-8cf3-b42a901e2a26} + ATmega8 + none + Executable + C + $(MSBuildProjectName) + .elf + $(MSBuildProjectDirectory)\$(Configuration) + Tacho_screen + Tacho_screen + Tacho_screen + Native + true + false + true + true + 0x20000000 + + exception_table + 2 + 0 + + + + + + + + + + + + + com.atmel.avrdbg.tool.ispmk2 + ISP + + + + false + 125000 + + ISP + + com.atmel.avrdbg.tool.ispmk2 + 000200185657 + AVRISP mkII + + + + + + True + True + True + True + True + True + + + NDEBUG + + + Optimize for size (-Os) + True + True + True + + + libm + + + + + + + + + True + True + True + True + True + True + + + DEBUG + + + Optimize (-O1) + True + True + Default (-g2) + True + + + libm + + + Default (-Wa,-g) + + + + + + compile + + + + \ No newline at end of file -- cgit v1.2.3