Auto stash before merge of "main" and "origin/main"
This commit is contained in:
139
Microcontrollers/opdracht 4.3/Debug/Makefile
Normal file
139
Microcontrollers/opdracht 4.3/Debug/Makefile
Normal file
@@ -0,0 +1,139 @@
|
||||
################################################################################
|
||||
# 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:=
|
||||
LINKER_SCRIPT_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 += \
|
||||
../lcd_control.c \
|
||||
../main.c
|
||||
|
||||
|
||||
PREPROCESSING_SRCS +=
|
||||
|
||||
|
||||
ASM_SRCS +=
|
||||
|
||||
|
||||
OBJS += \
|
||||
lcd_control.o \
|
||||
main.o
|
||||
|
||||
OBJS_AS_ARGS += \
|
||||
lcd_control.o \
|
||||
main.o
|
||||
|
||||
C_DEPS += \
|
||||
lcd_control.d \
|
||||
main.d
|
||||
|
||||
C_DEPS_AS_ARGS += \
|
||||
lcd_control.d \
|
||||
main.d
|
||||
|
||||
OUTPUT_FILE_PATH +=opdracht\ 4.3.elf
|
||||
|
||||
OUTPUT_FILE_PATH_AS_ARGS +="opdracht 4.3.elf"
|
||||
|
||||
ADDITIONAL_DEPENDENCIES:=
|
||||
|
||||
OUTPUT_FILE_DEP:= ./makedep.mk
|
||||
|
||||
LIB_DEP+=
|
||||
|
||||
LINKER_SCRIPT_DEP+=
|
||||
|
||||
|
||||
# AVR32/GNU C Compiler
|
||||
./lcd_control.o: .././lcd_control.c
|
||||
@echo Building file: $<
|
||||
@echo Invoking: AVR/GNU C Compiler : 5.4.0
|
||||
$(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -x c -funsigned-char -funsigned-bitfields -DDEBUG -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\include" -Og -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=atmega128 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\gcc\dev\atmega128" -c -std=gnu99 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<"
|
||||
@echo Finished building: $<
|
||||
|
||||
|
||||
./main.o: .././main.c
|
||||
@echo Building file: $<
|
||||
@echo Invoking: AVR/GNU C Compiler : 5.4.0
|
||||
$(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -x c -funsigned-char -funsigned-bitfields -DDEBUG -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\include" -Og -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=atmega128 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\gcc\dev\atmega128" -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) $(LINKER_SCRIPT_DEP)
|
||||
@echo Building target: $@
|
||||
@echo Invoking: AVR/GNU Linker : 5.4.0
|
||||
$(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -o$(OUTPUT_FILE_PATH_AS_ARGS) $(OBJS_AS_ARGS) $(USER_OBJS) $(LIBS) -Wl,-Map="opdracht 4.3.map" -Wl,--start-group -Wl,-lm -Wl,--end-group -Wl,--gc-sections -mrelax -mmcu=atmega128 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\gcc\dev\atmega128"
|
||||
@echo Finished building target: $@
|
||||
"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objcopy.exe" -O ihex -R .eeprom -R .fuse -R .lock -R .signature -R .user_signatures "opdracht 4.3.elf" "opdracht 4.3.hex"
|
||||
"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\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 "opdracht 4.3.elf" "opdracht 4.3.eep" || exit 0
|
||||
"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objdump.exe" -h -S "opdracht 4.3.elf" > "opdracht 4.3.lss"
|
||||
"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objcopy.exe" -O srec -R .eeprom -R .fuse -R .lock -R .signature -R .user_signatures "opdracht 4.3.elf" "opdracht 4.3.srec"
|
||||
"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-size.exe" "opdracht 4.3.elf"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Other Targets
|
||||
clean:
|
||||
-$(RM) $(OBJS_AS_ARGS) $(EXECUTABLES)
|
||||
-$(RM) $(C_DEPS_AS_ARGS)
|
||||
rm -rf "opdracht 4.3.elf" "opdracht 4.3.a" "opdracht 4.3.hex" "opdracht 4.3.lss" "opdracht 4.3.eep" "opdracht 4.3.map" "opdracht 4.3.srec" "opdracht 4.3.usersignatures"
|
||||
|
||||
8
Microcontrollers/opdracht 4.3/Debug/makedep.mk
Normal file
8
Microcontrollers/opdracht 4.3/Debug/makedep.mk
Normal file
@@ -0,0 +1,8 @@
|
||||
################################################################################
|
||||
# Automatically-generated file. Do not edit or delete the file
|
||||
################################################################################
|
||||
|
||||
lcd_control.c
|
||||
|
||||
main.c
|
||||
|
||||
1
Microcontrollers/opdracht 4.3/Debug/opdracht 4.3.eep
Normal file
1
Microcontrollers/opdracht 4.3/Debug/opdracht 4.3.eep
Normal file
@@ -0,0 +1 @@
|
||||
:00000001FF
|
||||
1459
Microcontrollers/opdracht 4.3/Debug/opdracht 4.3.lss
Normal file
1459
Microcontrollers/opdracht 4.3/Debug/opdracht 4.3.lss
Normal file
File diff suppressed because it is too large
Load Diff
147
Microcontrollers/opdracht 4.3/Debug/opdracht 4.3.srec
Normal file
147
Microcontrollers/opdracht 4.3/Debug/opdracht 4.3.srec
Normal file
@@ -0,0 +1,147 @@
|
||||
S01400006F7064726163687420342E332E7372656306
|
||||
S113000045C0000058C0000056C0000054C00000A5
|
||||
S113001052C0000050C000004EC000004CC00000A0
|
||||
S11300204AC000003BC1000046C0000044C00000BC
|
||||
S113003042C0000040C000003EC000003CC00000C0
|
||||
S11300403AC0000038C0000036C0000034C00000D0
|
||||
S113005032C0000030C000002EC000002CC00000E0
|
||||
S11300602AC0000028C0000026C0000024C00000F0
|
||||
S113007022C0000020C000001EC000001CC0000000
|
||||
S11300801AC0000018C0000016C0000011241FBED2
|
||||
S1130090CFEFD0E1DEBFCDBF11E0A0E0B1E0E8EFEB
|
||||
S11300A0F8E000E00BBF02C007900D92A430B10746
|
||||
S11300B0D9F711D11FC4A4CF9BB321E030E002C013
|
||||
S11300C0220F331F8A95E2F7292B2BBB08959BB38C
|
||||
S11300D021E030E002C0220F331F8A95E2F7209519
|
||||
S11300E029232BBB089586E090E0E6DF89EF90E0BA
|
||||
S11300F00197F1F700C0000086E090E0E8DF89EFA7
|
||||
S113010090E00197F1F700C000000895CF93C82F45
|
||||
S113011085BB84E090E0D0DFE6DFC295C07FC5BB3D
|
||||
S113012084E090E0C9DFDFDFCF910895CF93C82F3B
|
||||
S113013085BB84E090E0CBDFD6DFC295C07FC5BB32
|
||||
S113014084E090E0C4DFCFDFCF91089581E0EEDF5B
|
||||
S113015083EF91E00197F1F700C0000080E8E6CF5B
|
||||
S11301600895CF938FEF84BB85BB8ABB15BA1BBAA6
|
||||
S1130170C0E2C5BBB8DFC5BBB6DF80E885BBB3DF73
|
||||
S113018015BAB1DF80EF85BBAEDF15BAACDF80E610
|
||||
S113019085BBA9DF82E0CADFA6DFCF910895CF93A4
|
||||
S11301A0DF93EC0102C0B2DF219688818111FBCF7D
|
||||
S11301B0DF91CF910895AF92BF92CF92DF92EF92E9
|
||||
S11301C0FF920F931F93CF93DF93CDB7DEB76C01EC
|
||||
S11301D0ADB6BEB601969F938F930F2EF0E0EF2E2F
|
||||
S11301E0F1E0FF2EF02DFF92EF921F921F921F92CB
|
||||
S11301F01F9297D001962DB73EB7285F3F4F0FB699
|
||||
S1130200F8943EBF0FBE2DBF281B390B0FB6F894D0
|
||||
S11302103EBF0FBE2DBF0DB71EB70F5F1F4FDF923E
|
||||
S1130220CF92FF92EF929F938F931F930F9379D066
|
||||
S1130230802F912FB4DF8DB79EB708960FB6F89430
|
||||
S11302409EBF0FBE8DBF0FB6F894BEBE0FBEADBE2F
|
||||
S1130250DF91CF911F910F91FF90EF90DF90CF909E
|
||||
S1130260BF90AF90089520E030E008C0EFECF7E0D5
|
||||
S11302703197F1F700C000002F5F3F4F281739076F
|
||||
S1130280ACF3089580EE87B986E886B9089587B7F8
|
||||
S1130290806887BF789483E085BD08951F920F928C
|
||||
S11302A00FB60F9211248F9386B1806486B98F9113
|
||||
S11302B00F900FBE0F901F90189585B190E0880F96
|
||||
S11302C0991F880F991F24B122952695269523708E
|
||||
S11302D0820F911D0895109261008FEF82B9D2DFD1
|
||||
S11302E040DF8FE19EE40197F1F700C000002EDFAC
|
||||
S11302F0CEDF80E090E025B122BB24B123B9C5B1A3
|
||||
S1130300D0E08C179D0741F021DF8AE090E0ABDF5D
|
||||
S1130310D4DF959587954FDF84E690E0A4DFCE0186
|
||||
S1130320EACF0F931F93CF93DF93CDB7DEB72E970A
|
||||
S11303300FB6F894DEBF0FBECDBF0D891E898F891D
|
||||
S1130340988D26E02C831A83098397FF02C080E0EE
|
||||
S113035090E801979E838D83AE01455E5F4F698D62
|
||||
S11303607A8DCE01019619D04D815E8157FD0AC068
|
||||
S11303702F813885421753070CF49A01F801E20FD4
|
||||
S1130380F31F10822E960FB6F894DEBF0FBECDBFBA
|
||||
S1130390DF91CF911F910F9108952F923F924F9229
|
||||
S11303A05F926F927F928F929F92AF92BF92CF9201
|
||||
S11303B0DF92EF92FF920F931F93CF93DF93CDB70A
|
||||
S11303C0DEB72B970FB6F894DEBF0FBECDBF6C011E
|
||||
S11303D07B018A01FC0117821682838181FFBFC1E0
|
||||
S11303E0CE0101963C01F6019381F70193FD8591BD
|
||||
S11303F093FF81917F01882309F4ADC1853239F4DB
|
||||
S113040093FD859193FF81917F01853221F4B6019B
|
||||
S113041090E0D6D1E8CF912C212C312CFFE1F315BB
|
||||
S1130420D8F08B3279F038F4803279F08332A1F449
|
||||
S1130430232D20611DC08D3261F0803369F4232D9A
|
||||
S1130440216016C0832D8260382EE32DE4603E2E99
|
||||
S11304502AC0F32DF8601DC037FC2DC020ED280FF5
|
||||
S11304602A3040F08E32B9F436FC75C1232D206455
|
||||
S1130470322E19C036FE06C08AE0989E200D112443
|
||||
S1130480922E11C0EAE02E9E200D1124222EF32D6F
|
||||
S1130490F0623F2E08C08C3621F4832D8068382EFC
|
||||
S11304A002C0883641F4F70193FD859193FF819151
|
||||
S11304B07F018111B3CF982F9F7D9554933028F4F9
|
||||
S11304C00C5F1F4F9FE399830DC0833631F0833750
|
||||
S11304D071F0833509F055C020C0F801808189830B
|
||||
S11304E00E5F1F4F88248394912C530112C028015E
|
||||
S11304F0F2E04F0E511CF801A080B18036FE03C01B
|
||||
S1130500692D70E002C06FEF7FEFC5014ED14C0141
|
||||
S11305108201F32DFF773F2E15C0280122E0420E01
|
||||
S1130520511CF801A080B18036FE03C0692D70E033
|
||||
S113053002C06FEF7FEFC5012DD14C01F32DF068A0
|
||||
S11305403F2E820133FC19C0822D90E08816990653
|
||||
S1130550A0F4B60180E290E033D12A94F5CFF501FE
|
||||
S113056037FC859137FE81915F01B60190E028D177
|
||||
S113057021102A9421E0821A91088114910479F7B8
|
||||
S1130580E1C0843611F0893639F5F80137FE07C029
|
||||
S113059060817181828193810C5F1F4F08C06081EB
|
||||
S11305A07181072E000C880B990B0E5F1F4FF32DE2
|
||||
S11305B0FF763F2E97FF09C09095809570956195C1
|
||||
S11305C07F4F8F4F9F4FF0683F2E2AE030E0A3010A
|
||||
S11305D033D1882E861844C0853731F4232D2F7EDD
|
||||
S11305E0B22E2AE030E025C0932D997FB92E8F36A4
|
||||
S11305F0C1F018F4883579F0AEC0803719F0883727
|
||||
S113060021F0A9C0E92FE061BE2EB4FE0DC0FB2D80
|
||||
S1130610F460BF2E09C034FE0AC0292F2660B22E12
|
||||
S113062006C028E030E005C020E130E002C020E14F
|
||||
S113063032E0F801B7FE07C0608171818281938145
|
||||
S11306400C5F1F4F06C06081718180E090E00E5FF7
|
||||
S11306501F4FA301F1D0882E8618FB2DFF773F2E64
|
||||
S113066036FE0DC0232D2E7FA22E891458F434FE9D
|
||||
S11306700BC032FC09C0832D8E7EA82E05C0B82C79
|
||||
S1130680A32C03C0B82C01C0B92CA4FE0FC0FE01DA
|
||||
S1130690E80DF11D8081803321F49A2D997EA92ED5
|
||||
S11306A009C0A2FE06C0B394B39404C08A2D867810
|
||||
S11306B009F0B394A3FC10C0A0FE06C0B21480F4E9
|
||||
S11306C0280C922C9B180DC0B21458F4B60180E289
|
||||
S11306D090E076D0B394F8CFB21418F42B1802C07B
|
||||
S11306E0982C212CA4FE0FC0B60180E390E068D0C2
|
||||
S11306F0A2FE16C0A1FC03C088E790E002C088E512
|
||||
S113070090E0B6010CC08A2D867851F0A1FE02C09B
|
||||
S11307108BE201C080E2A7FC8DE2B60190E050D0EC
|
||||
S1130720891430F4B60180E390E04AD09A94F8CF6B
|
||||
S11307308A94F301E80DF11D8081B60190E040D068
|
||||
S11307408110F6CF222009F44ECEB60180E290E06B
|
||||
S113075037D02A94F7CFF6018681978102C08FEFB4
|
||||
S11307609FEF2B960FB6F894DEBF0FBECDBFDF917F
|
||||
S1130770CF911F910F91FF90EF90DF90CF90BF909A
|
||||
S1130780AF909F908F907F906F905F904F903F902D
|
||||
S11307902F900895FC010590615070400110D8F726
|
||||
S11307A0809590958E0F9F1F0895FC0161507040B5
|
||||
S11307B001900110D8F7809590958E0F9F1F089592
|
||||
S11307C00F931F93CF93DF93FB01238121FD03C07C
|
||||
S11307D08FEF9FEF2CC022FF16C0468157812481E2
|
||||
S11307E035814217530744F4A081B1819D012F5FE5
|
||||
S11307F03F4F318320838C93268137812F5F3F4F76
|
||||
S11308003783268314C08B01EC01FB010084F1853E
|
||||
S1130810E02D0995892BE1F6D80116968D919C91CE
|
||||
S11308201797019617969C938E931697CE01DF9196
|
||||
S1130830CF911F910F910895FA01AA27283051F101
|
||||
S1130840203181F1E8946F936E7F6E5F7F4F8F4FFD
|
||||
S11308509F4FAF4FB1E03ED0B4E03CD0670F781F5C
|
||||
S1130860891F9A1FA11D680F791F8A1F911DA11D41
|
||||
S11308706A0F711D811D911DA11D20D009F468947A
|
||||
S11308803F912AE0269F11243019305D3193DEF622
|
||||
S1130890CF010895462F4770405D4193B3E00FD0D8
|
||||
S11308A0C9F7F6CF462F4F70405D4A3318F0495DC3
|
||||
S11308B031FD4052419302D0A9F7EACFB4E0A695A6
|
||||
S11308C09795879577956795BA95C9F700976105C8
|
||||
S11308D0710508959B01AC010A2E0694579547951E
|
||||
S11308E037952795BA95C9F7620F731F841F951F13
|
||||
S10B08F0A01D0895F894FFCF48
|
||||
S10708F8256400006F
|
||||
S9030000FC
|
||||
130
Microcontrollers/opdracht 4.3/lcd_control.c
Normal file
130
Microcontrollers/opdracht 4.3/lcd_control.c
Normal file
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* lcd_controlc.c
|
||||
*
|
||||
* Created: 24-2-2021 11:55:12
|
||||
* Author: Sem
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <avr/io.h>
|
||||
#include <util/delay.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include "lcd_control.h"
|
||||
|
||||
void _delay_ms(double __ms);
|
||||
|
||||
void lcd_clear() {
|
||||
lcd_write_command (0x01); //Leeg display
|
||||
_delay_ms(2);
|
||||
lcd_write_command (0x80); //Cursor terug naar start
|
||||
}
|
||||
|
||||
void lcd_strobe_lcd_e(void) {
|
||||
|
||||
sbi_porta(LCD_E); // E high
|
||||
_delay_ms(1);
|
||||
cbi_porta(LCD_E); // E low
|
||||
_delay_ms(1);
|
||||
|
||||
}
|
||||
|
||||
void sbi_portc(int index){
|
||||
PORTC |= (1<<index);
|
||||
}
|
||||
|
||||
|
||||
void cbi_portc(int index){
|
||||
PORTC &= ~(1<<index);
|
||||
}
|
||||
|
||||
void sbi_porta(int index){
|
||||
PORTA |= (1<<index);
|
||||
}
|
||||
|
||||
|
||||
void cbi_porta(int index){
|
||||
PORTA &= ~(1<<index);
|
||||
}
|
||||
|
||||
void init_4bits_mode(void) {
|
||||
|
||||
// PORTC output mode and all low (also E and RS pin)
|
||||
|
||||
// Init I/O
|
||||
DDRC = 0xFF; // PORTD(7) output, PORTD(6:0) input
|
||||
PORTC = 0xFF;
|
||||
|
||||
DDRA = 0xFF;
|
||||
PORTC = 0x00;
|
||||
PORTA = 0x00;
|
||||
|
||||
PORTC = 0x20; // function for 4-bit 1 row
|
||||
lcd_strobe_lcd_e();
|
||||
|
||||
PORTC = 0x20; // function high nibble 4-bit 2 row
|
||||
lcd_strobe_lcd_e();
|
||||
PORTC = 0x80; // function low nibble 4-bit 2 row
|
||||
lcd_strobe_lcd_e();
|
||||
|
||||
PORTC = 0x00; // function high nibble turn on visible blinking-block cursor
|
||||
lcd_strobe_lcd_e();
|
||||
PORTC = 0xF0; // function low nibble turn on visible blinking-block cursor
|
||||
lcd_strobe_lcd_e();
|
||||
|
||||
PORTC = 0x00; // Entry mode set high nibble
|
||||
lcd_strobe_lcd_e();
|
||||
PORTC = 0x60; // Entry mode set low nibble
|
||||
lcd_strobe_lcd_e();
|
||||
|
||||
// return home
|
||||
lcd_write_command(0x02);
|
||||
lcd_strobe_lcd_e();
|
||||
}
|
||||
|
||||
void lcd_write_integer(int number){
|
||||
int length = snprintf(NULL, 0, "%d", number + 1);
|
||||
char str[length + 1];
|
||||
snprintf(str, length + 1, "%d", number);
|
||||
lcd_write_string(str);
|
||||
}
|
||||
|
||||
void lcd_write_character(unsigned char byte){
|
||||
|
||||
|
||||
//upper nibble
|
||||
PORTC = byte;
|
||||
sbi_porta(LCD_RS);
|
||||
lcd_strobe_lcd_e();
|
||||
|
||||
//lower nibble
|
||||
PORTC = (byte<<4);
|
||||
sbi_porta(LCD_RS);
|
||||
lcd_strobe_lcd_e();
|
||||
|
||||
}
|
||||
|
||||
void lcd_write_command(unsigned char byte){
|
||||
|
||||
//upper nibble
|
||||
PORTC = byte;
|
||||
cbi_porta(LCD_RS);
|
||||
lcd_strobe_lcd_e();
|
||||
|
||||
//lower nibble
|
||||
PORTC = (byte<<4);
|
||||
cbi_porta(LCD_RS);
|
||||
lcd_strobe_lcd_e();
|
||||
|
||||
}
|
||||
|
||||
void lcd_write_string(const char *str) {
|
||||
|
||||
for(;*str; str++){
|
||||
lcd_write_character(*str);
|
||||
}
|
||||
}
|
||||
|
||||
void lcd_move_right(void){
|
||||
|
||||
lcd_write_command(0x1E);
|
||||
}
|
||||
31
Microcontrollers/opdracht 4.3/lcd_control.h
Normal file
31
Microcontrollers/opdracht 4.3/lcd_control.h
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* lcd_control.h
|
||||
*
|
||||
* Created: 24-2-2021 11:56:16
|
||||
* Author: Sem
|
||||
*/
|
||||
|
||||
|
||||
#ifndef LCD_CONTROL_H_
|
||||
#define LCD_CONTROL_H_
|
||||
|
||||
#define LCD_E 6
|
||||
#define LCD_RS 4
|
||||
|
||||
void _delay_ms(double __ms);
|
||||
void lcd_strobe_lcd_e(void);
|
||||
void sbi_portc(int index);
|
||||
void cbi_portc(int index);
|
||||
void sbi_porta(int index);
|
||||
void cbi_porta(int index);
|
||||
void init_4bits_mode(void);
|
||||
void lcd_write_string(const char *str);
|
||||
void lcd_write_character(unsigned char byte);
|
||||
void lcd_write_command(unsigned char byte);
|
||||
void lcd_write_integer(int number);
|
||||
void lcd_move_right(void);
|
||||
void lcd_clear();
|
||||
|
||||
|
||||
|
||||
#endif /* LCD_CONTROL_H_ */
|
||||
83
Microcontrollers/opdracht 4.3/main.c
Normal file
83
Microcontrollers/opdracht 4.3/main.c
Normal file
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* opdracht 4.1.c
|
||||
*
|
||||
* Created: 03-Mar-21 9:26:31 AM
|
||||
* Author : lemms
|
||||
*/
|
||||
|
||||
|
||||
#define F_CPU 8e6
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <avr/io.h>
|
||||
#include <util/delay.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include "lcd_control.h"
|
||||
#define BIT(x) (1 << (x))
|
||||
|
||||
void wait( int ms ) {
|
||||
for (int tms=0; tms<ms; tms++) {
|
||||
_delay_ms( 1 ); // library function (max 30 ms at 8MHz)
|
||||
}
|
||||
}
|
||||
|
||||
void adcInit(){
|
||||
ADMUX = 0b11100000; // internal reference: 2.56V and SEI on ADC0 and left-adjusted.
|
||||
ADCSRA = 0b10000110; // enable ADC. No free-run. Clock 64 D-factor.
|
||||
}
|
||||
|
||||
void timer2Init( void ) {
|
||||
TIMSK |= BIT(7); // T2 compare match interrupt enable
|
||||
sei(); // turn_on interrupt all
|
||||
TCCR2 = 0b00000011; // Initialize T2: timer, pre-scaler=64
|
||||
}
|
||||
|
||||
ISR( TIMER2_COMP_vect ) {
|
||||
ADCSRA |= BIT(6);
|
||||
}
|
||||
|
||||
int getADCValue(){
|
||||
int value = 0;
|
||||
value = ADCH;
|
||||
value <<= 2;
|
||||
value += (ADCL >> 6);
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int previousValue = 0;
|
||||
/* Replace with your application code */
|
||||
DDRF = 0x00; // set port F input.
|
||||
DDRE = 0xFF; // all port A output.
|
||||
adcInit();
|
||||
|
||||
init_4bits_mode();
|
||||
_delay_ms(10);
|
||||
lcd_clear();
|
||||
|
||||
timer2Init();
|
||||
while (1)
|
||||
{
|
||||
PORTD = ADCH;
|
||||
PORTE = ADCL;
|
||||
|
||||
int number = ADCH;
|
||||
|
||||
if(previousValue != number){
|
||||
|
||||
lcd_clear();
|
||||
|
||||
wait(10);
|
||||
|
||||
lcd_write_integer((getADCValue() >> 1));
|
||||
}
|
||||
|
||||
previousValue = number;
|
||||
|
||||
wait(100);
|
||||
}
|
||||
}
|
||||
|
||||
86
Microcontrollers/opdracht 4.3/opdracht 4.3.componentinfo.xml
Normal file
86
Microcontrollers/opdracht 4.3/opdracht 4.3.componentinfo.xml
Normal file
@@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Store xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="AtmelPackComponentManagement">
|
||||
<ProjectComponents>
|
||||
<ProjectComponent z:Id="i1" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/">
|
||||
<CApiVersion></CApiVersion>
|
||||
<CBundle></CBundle>
|
||||
<CClass>Device</CClass>
|
||||
<CGroup>Startup</CGroup>
|
||||
<CSub></CSub>
|
||||
<CVariant></CVariant>
|
||||
<CVendor>Atmel</CVendor>
|
||||
<CVersion>1.6.0</CVersion>
|
||||
<DefaultRepoPath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs</DefaultRepoPath>
|
||||
<DependentComponents xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" />
|
||||
<Description></Description>
|
||||
<Files xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
|
||||
<d4p1:anyType i:type="FileInfo">
|
||||
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\include\</AbsolutePath>
|
||||
<Attribute></Attribute>
|
||||
<Category>include</Category>
|
||||
<Condition>C</Condition>
|
||||
<FileContentHash i:nil="true" />
|
||||
<FileVersion></FileVersion>
|
||||
<Name>include/</Name>
|
||||
<SelectString></SelectString>
|
||||
<SourcePath></SourcePath>
|
||||
</d4p1:anyType>
|
||||
<d4p1:anyType i:type="FileInfo">
|
||||
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\include\avr\iom128.h</AbsolutePath>
|
||||
<Attribute></Attribute>
|
||||
<Category>header</Category>
|
||||
<Condition>C</Condition>
|
||||
<FileContentHash>JdJ7J9I/SJh965SEyyyVYw==</FileContentHash>
|
||||
<FileVersion></FileVersion>
|
||||
<Name>include/avr/iom128.h</Name>
|
||||
<SelectString></SelectString>
|
||||
<SourcePath></SourcePath>
|
||||
</d4p1:anyType>
|
||||
<d4p1:anyType i:type="FileInfo">
|
||||
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\templates\main.c</AbsolutePath>
|
||||
<Attribute>template</Attribute>
|
||||
<Category>source</Category>
|
||||
<Condition>C Exe</Condition>
|
||||
<FileContentHash>E3YF7GOdCa1nIeGlpTnlmw==</FileContentHash>
|
||||
<FileVersion></FileVersion>
|
||||
<Name>templates/main.c</Name>
|
||||
<SelectString>Main file (.c)</SelectString>
|
||||
<SourcePath></SourcePath>
|
||||
</d4p1:anyType>
|
||||
<d4p1:anyType i:type="FileInfo">
|
||||
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\templates\main.cpp</AbsolutePath>
|
||||
<Attribute>template</Attribute>
|
||||
<Category>source</Category>
|
||||
<Condition>C Exe</Condition>
|
||||
<FileContentHash>mkKaE95TOoATsuBGv6jmxg==</FileContentHash>
|
||||
<FileVersion></FileVersion>
|
||||
<Name>templates/main.cpp</Name>
|
||||
<SelectString>Main file (.cpp)</SelectString>
|
||||
<SourcePath></SourcePath>
|
||||
</d4p1:anyType>
|
||||
<d4p1:anyType i:type="FileInfo">
|
||||
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\gcc\dev\atmega128</AbsolutePath>
|
||||
<Attribute></Attribute>
|
||||
<Category>libraryPrefix</Category>
|
||||
<Condition>GCC</Condition>
|
||||
<FileContentHash i:nil="true" />
|
||||
<FileVersion></FileVersion>
|
||||
<Name>gcc/dev/atmega128</Name>
|
||||
<SelectString></SelectString>
|
||||
<SourcePath></SourcePath>
|
||||
</d4p1:anyType>
|
||||
</Files>
|
||||
<PackName>ATmega_DFP</PackName>
|
||||
<PackPath>C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.6.364/Atmel.ATmega_DFP.pdsc</PackPath>
|
||||
<PackVersion>1.6.364</PackVersion>
|
||||
<PresentInProject>true</PresentInProject>
|
||||
<ReferenceConditionId>ATmega128</ReferenceConditionId>
|
||||
<RteComponents xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
|
||||
<d4p1:string></d4p1:string>
|
||||
</RteComponents>
|
||||
<Status>Resolved</Status>
|
||||
<VersionMode>Fixed</VersionMode>
|
||||
<IsComponentInAtProject>true</IsComponentInAtProject>
|
||||
</ProjectComponent>
|
||||
</ProjectComponents>
|
||||
</Store>
|
||||
136
Microcontrollers/opdracht 4.3/opdracht 4.3.cproj
Normal file
136
Microcontrollers/opdracht 4.3/opdracht 4.3.cproj
Normal file
@@ -0,0 +1,136 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
|
||||
<PropertyGroup>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectVersion>7.0</ProjectVersion>
|
||||
<ToolchainName>com.Atmel.AVRGCC8.C</ToolchainName>
|
||||
<ProjectGuid>{f7219797-d668-49e2-ac80-7eaf068ba957}</ProjectGuid>
|
||||
<avrdevice>ATmega128</avrdevice>
|
||||
<avrdeviceseries>none</avrdeviceseries>
|
||||
<OutputType>Executable</OutputType>
|
||||
<Language>C</Language>
|
||||
<OutputFileName>$(MSBuildProjectName)</OutputFileName>
|
||||
<OutputFileExtension>.elf</OutputFileExtension>
|
||||
<OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory>
|
||||
<AssemblyName>opdracht 4.3</AssemblyName>
|
||||
<Name>opdracht 4.3</Name>
|
||||
<RootNamespace>opdracht 4.3</RootNamespace>
|
||||
<ToolchainFlavour>Native</ToolchainFlavour>
|
||||
<KeepTimersRunning>true</KeepTimersRunning>
|
||||
<OverrideVtor>false</OverrideVtor>
|
||||
<CacheFlash>true</CacheFlash>
|
||||
<ProgFlashFromRam>true</ProgFlashFromRam>
|
||||
<RamSnippetAddress />
|
||||
<UncachedRange />
|
||||
<preserveEEPROM>true</preserveEEPROM>
|
||||
<OverrideVtorValue />
|
||||
<BootSegment>2</BootSegment>
|
||||
<ResetRule>0</ResetRule>
|
||||
<eraseonlaunchrule>0</eraseonlaunchrule>
|
||||
<EraseKey />
|
||||
<AsfFrameworkConfig>
|
||||
<framework-data xmlns="">
|
||||
<options />
|
||||
<configurations />
|
||||
<files />
|
||||
<documentation help="" />
|
||||
<offline-documentation help="" />
|
||||
<dependencies>
|
||||
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.49.1" />
|
||||
</dependencies>
|
||||
</framework-data>
|
||||
</AsfFrameworkConfig>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<ToolchainSettings>
|
||||
<AvrGcc>
|
||||
<avrgcc.common.Device>-mmcu=atmega128 -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\gcc\dev\atmega128"</avrgcc.common.Device>
|
||||
<avrgcc.common.optimization.RelaxBranches>True</avrgcc.common.optimization.RelaxBranches>
|
||||
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
|
||||
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
|
||||
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
|
||||
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
|
||||
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
|
||||
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
|
||||
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
|
||||
<avrgcc.compiler.symbols.DefSymbols>
|
||||
<ListValues>
|
||||
<Value>NDEBUG</Value>
|
||||
</ListValues>
|
||||
</avrgcc.compiler.symbols.DefSymbols>
|
||||
<avrgcc.compiler.directories.IncludePaths>
|
||||
<ListValues>
|
||||
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\include\</Value>
|
||||
</ListValues>
|
||||
</avrgcc.compiler.directories.IncludePaths>
|
||||
<avrgcc.compiler.optimization.level>Optimize for size (-Os)</avrgcc.compiler.optimization.level>
|
||||
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
|
||||
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
|
||||
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
|
||||
<avrgcc.linker.libraries.Libraries>
|
||||
<ListValues>
|
||||
<Value>libm</Value>
|
||||
</ListValues>
|
||||
</avrgcc.linker.libraries.Libraries>
|
||||
<avrgcc.assembler.general.IncludePaths>
|
||||
<ListValues>
|
||||
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\include\</Value>
|
||||
</ListValues>
|
||||
</avrgcc.assembler.general.IncludePaths>
|
||||
</AvrGcc>
|
||||
</ToolchainSettings>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<ToolchainSettings>
|
||||
<AvrGcc>
|
||||
<avrgcc.common.Device>-mmcu=atmega128 -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\gcc\dev\atmega128"</avrgcc.common.Device>
|
||||
<avrgcc.common.optimization.RelaxBranches>True</avrgcc.common.optimization.RelaxBranches>
|
||||
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
|
||||
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
|
||||
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
|
||||
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
|
||||
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
|
||||
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
|
||||
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
|
||||
<avrgcc.compiler.symbols.DefSymbols>
|
||||
<ListValues>
|
||||
<Value>DEBUG</Value>
|
||||
</ListValues>
|
||||
</avrgcc.compiler.symbols.DefSymbols>
|
||||
<avrgcc.compiler.directories.IncludePaths>
|
||||
<ListValues>
|
||||
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\include\</Value>
|
||||
</ListValues>
|
||||
</avrgcc.compiler.directories.IncludePaths>
|
||||
<avrgcc.compiler.optimization.level>Optimize debugging experience (-Og)</avrgcc.compiler.optimization.level>
|
||||
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
|
||||
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
|
||||
<avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel>
|
||||
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
|
||||
<avrgcc.linker.libraries.Libraries>
|
||||
<ListValues>
|
||||
<Value>libm</Value>
|
||||
</ListValues>
|
||||
</avrgcc.linker.libraries.Libraries>
|
||||
<avrgcc.assembler.general.IncludePaths>
|
||||
<ListValues>
|
||||
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\include\</Value>
|
||||
</ListValues>
|
||||
</avrgcc.assembler.general.IncludePaths>
|
||||
<avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel>
|
||||
</AvrGcc>
|
||||
</ToolchainSettings>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="lcd_control.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="lcd_control.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="main.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
|
||||
</Project>
|
||||
Reference in New Issue
Block a user