added test lcd project
This commit is contained in:
@@ -21,6 +21,8 @@ Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "opdracht 2.3", "opdracht 2.
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "opdracht 2.5", "opdracht 2.5\opdracht 2.5.cproj", "{C81B68AA-F4BB-4A5D-81F8-2737DCD1D4A7}"
|
Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "opdracht 2.5", "opdracht 2.5\opdracht 2.5.cproj", "{C81B68AA-F4BB-4A5D-81F8-2737DCD1D4A7}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "testlcd", "testlcd\testlcd.cproj", "{B964892D-A92F-44D4-AF99-3ADC61820917}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|AVR = Debug|AVR
|
Debug|AVR = Debug|AVR
|
||||||
@@ -63,6 +65,10 @@ Global
|
|||||||
{C81B68AA-F4BB-4A5D-81F8-2737DCD1D4A7}.Debug|AVR.Build.0 = Debug|AVR
|
{C81B68AA-F4BB-4A5D-81F8-2737DCD1D4A7}.Debug|AVR.Build.0 = Debug|AVR
|
||||||
{C81B68AA-F4BB-4A5D-81F8-2737DCD1D4A7}.Release|AVR.ActiveCfg = Release|AVR
|
{C81B68AA-F4BB-4A5D-81F8-2737DCD1D4A7}.Release|AVR.ActiveCfg = Release|AVR
|
||||||
{C81B68AA-F4BB-4A5D-81F8-2737DCD1D4A7}.Release|AVR.Build.0 = Release|AVR
|
{C81B68AA-F4BB-4A5D-81F8-2737DCD1D4A7}.Release|AVR.Build.0 = Release|AVR
|
||||||
|
{B964892D-A92F-44D4-AF99-3ADC61820917}.Debug|AVR.ActiveCfg = Debug|AVR
|
||||||
|
{B964892D-A92F-44D4-AF99-3ADC61820917}.Debug|AVR.Build.0 = Debug|AVR
|
||||||
|
{B964892D-A92F-44D4-AF99-3ADC61820917}.Release|AVR.ActiveCfg = Release|AVR
|
||||||
|
{B964892D-A92F-44D4-AF99-3ADC61820917}.Release|AVR.Build.0 = Release|AVR
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
127
Microcontrollers/testlcd/Debug/Makefile
Normal file
127
Microcontrollers/testlcd/Debug/Makefile
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
################################################################################
|
||||||
|
# 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 += \
|
||||||
|
../main.c
|
||||||
|
|
||||||
|
|
||||||
|
PREPROCESSING_SRCS +=
|
||||||
|
|
||||||
|
|
||||||
|
ASM_SRCS +=
|
||||||
|
|
||||||
|
|
||||||
|
OBJS += \
|
||||||
|
main.o
|
||||||
|
|
||||||
|
OBJS_AS_ARGS += \
|
||||||
|
main.o
|
||||||
|
|
||||||
|
C_DEPS += \
|
||||||
|
main.d
|
||||||
|
|
||||||
|
C_DEPS_AS_ARGS += \
|
||||||
|
main.d
|
||||||
|
|
||||||
|
OUTPUT_FILE_PATH +=testlcd.elf
|
||||||
|
|
||||||
|
OUTPUT_FILE_PATH_AS_ARGS +=testlcd.elf
|
||||||
|
|
||||||
|
ADDITIONAL_DEPENDENCIES:=
|
||||||
|
|
||||||
|
OUTPUT_FILE_DEP:= ./makedep.mk
|
||||||
|
|
||||||
|
LIB_DEP+=
|
||||||
|
|
||||||
|
LINKER_SCRIPT_DEP+=
|
||||||
|
|
||||||
|
|
||||||
|
# AVR32/GNU C Compiler
|
||||||
|
./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="testlcd.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 "testlcd.elf" "testlcd.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 "testlcd.elf" "testlcd.eep" || exit 0
|
||||||
|
"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objdump.exe" -h -S "testlcd.elf" > "testlcd.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 "testlcd.elf" "testlcd.srec"
|
||||||
|
"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-size.exe" "testlcd.elf"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Other Targets
|
||||||
|
clean:
|
||||||
|
-$(RM) $(OBJS_AS_ARGS) $(EXECUTABLES)
|
||||||
|
-$(RM) $(C_DEPS_AS_ARGS)
|
||||||
|
rm -rf "testlcd.elf" "testlcd.a" "testlcd.hex" "testlcd.lss" "testlcd.eep" "testlcd.map" "testlcd.srec" "testlcd.usersignatures"
|
||||||
|
|
||||||
6
Microcontrollers/testlcd/Debug/makedep.mk
Normal file
6
Microcontrollers/testlcd/Debug/makedep.mk
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
################################################################################
|
||||||
|
# Automatically-generated file. Do not edit or delete the file
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
main.c
|
||||||
|
|
||||||
1
Microcontrollers/testlcd/Debug/testlcd.eep
Normal file
1
Microcontrollers/testlcd/Debug/testlcd.eep
Normal file
@@ -0,0 +1 @@
|
|||||||
|
:00000001FF
|
||||||
430
Microcontrollers/testlcd/Debug/testlcd.lss
Normal file
430
Microcontrollers/testlcd/Debug/testlcd.lss
Normal file
@@ -0,0 +1,430 @@
|
|||||||
|
|
||||||
|
testlcd.elf: file format elf32-avr
|
||||||
|
|
||||||
|
Sections:
|
||||||
|
Idx Name Size VMA LMA File off Algn
|
||||||
|
0 .data 0000000e 00800100 000001ce 00000242 2**0
|
||||||
|
CONTENTS, ALLOC, LOAD, DATA
|
||||||
|
1 .text 000001ce 00000000 00000000 00000074 2**1
|
||||||
|
CONTENTS, ALLOC, LOAD, READONLY, CODE
|
||||||
|
2 .comment 00000030 00000000 00000000 00000250 2**0
|
||||||
|
CONTENTS, READONLY
|
||||||
|
3 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 00000280 2**2
|
||||||
|
CONTENTS, READONLY
|
||||||
|
4 .debug_aranges 00000058 00000000 00000000 000002bc 2**0
|
||||||
|
CONTENTS, READONLY, DEBUGGING
|
||||||
|
5 .debug_info 00000b5a 00000000 00000000 00000314 2**0
|
||||||
|
CONTENTS, READONLY, DEBUGGING
|
||||||
|
6 .debug_abbrev 0000088d 00000000 00000000 00000e6e 2**0
|
||||||
|
CONTENTS, READONLY, DEBUGGING
|
||||||
|
7 .debug_line 00000470 00000000 00000000 000016fb 2**0
|
||||||
|
CONTENTS, READONLY, DEBUGGING
|
||||||
|
8 .debug_frame 000000b8 00000000 00000000 00001b6c 2**2
|
||||||
|
CONTENTS, READONLY, DEBUGGING
|
||||||
|
9 .debug_str 00000479 00000000 00000000 00001c24 2**0
|
||||||
|
CONTENTS, READONLY, DEBUGGING
|
||||||
|
10 .debug_loc 00000299 00000000 00000000 0000209d 2**0
|
||||||
|
CONTENTS, READONLY, DEBUGGING
|
||||||
|
11 .debug_ranges 00000048 00000000 00000000 00002336 2**0
|
||||||
|
CONTENTS, READONLY, DEBUGGING
|
||||||
|
|
||||||
|
Disassembly of section .text:
|
||||||
|
|
||||||
|
00000000 <__vectors>:
|
||||||
|
0: 45 c0 rjmp .+138 ; 0x8c <__ctors_end>
|
||||||
|
2: 00 00 nop
|
||||||
|
4: 58 c0 rjmp .+176 ; 0xb6 <__bad_interrupt>
|
||||||
|
6: 00 00 nop
|
||||||
|
8: 56 c0 rjmp .+172 ; 0xb6 <__bad_interrupt>
|
||||||
|
a: 00 00 nop
|
||||||
|
c: 54 c0 rjmp .+168 ; 0xb6 <__bad_interrupt>
|
||||||
|
e: 00 00 nop
|
||||||
|
10: 52 c0 rjmp .+164 ; 0xb6 <__bad_interrupt>
|
||||||
|
12: 00 00 nop
|
||||||
|
14: 50 c0 rjmp .+160 ; 0xb6 <__bad_interrupt>
|
||||||
|
16: 00 00 nop
|
||||||
|
18: 4e c0 rjmp .+156 ; 0xb6 <__bad_interrupt>
|
||||||
|
1a: 00 00 nop
|
||||||
|
1c: 4c c0 rjmp .+152 ; 0xb6 <__bad_interrupt>
|
||||||
|
1e: 00 00 nop
|
||||||
|
20: 4a c0 rjmp .+148 ; 0xb6 <__bad_interrupt>
|
||||||
|
22: 00 00 nop
|
||||||
|
24: 48 c0 rjmp .+144 ; 0xb6 <__bad_interrupt>
|
||||||
|
26: 00 00 nop
|
||||||
|
28: 46 c0 rjmp .+140 ; 0xb6 <__bad_interrupt>
|
||||||
|
2a: 00 00 nop
|
||||||
|
2c: 44 c0 rjmp .+136 ; 0xb6 <__bad_interrupt>
|
||||||
|
2e: 00 00 nop
|
||||||
|
30: 42 c0 rjmp .+132 ; 0xb6 <__bad_interrupt>
|
||||||
|
32: 00 00 nop
|
||||||
|
34: 40 c0 rjmp .+128 ; 0xb6 <__bad_interrupt>
|
||||||
|
36: 00 00 nop
|
||||||
|
38: 3e c0 rjmp .+124 ; 0xb6 <__bad_interrupt>
|
||||||
|
3a: 00 00 nop
|
||||||
|
3c: 3c c0 rjmp .+120 ; 0xb6 <__bad_interrupt>
|
||||||
|
3e: 00 00 nop
|
||||||
|
40: 3a c0 rjmp .+116 ; 0xb6 <__bad_interrupt>
|
||||||
|
42: 00 00 nop
|
||||||
|
44: 38 c0 rjmp .+112 ; 0xb6 <__bad_interrupt>
|
||||||
|
46: 00 00 nop
|
||||||
|
48: 36 c0 rjmp .+108 ; 0xb6 <__bad_interrupt>
|
||||||
|
4a: 00 00 nop
|
||||||
|
4c: 34 c0 rjmp .+104 ; 0xb6 <__bad_interrupt>
|
||||||
|
4e: 00 00 nop
|
||||||
|
50: 32 c0 rjmp .+100 ; 0xb6 <__bad_interrupt>
|
||||||
|
52: 00 00 nop
|
||||||
|
54: 30 c0 rjmp .+96 ; 0xb6 <__bad_interrupt>
|
||||||
|
56: 00 00 nop
|
||||||
|
58: 2e c0 rjmp .+92 ; 0xb6 <__bad_interrupt>
|
||||||
|
5a: 00 00 nop
|
||||||
|
5c: 2c c0 rjmp .+88 ; 0xb6 <__bad_interrupt>
|
||||||
|
5e: 00 00 nop
|
||||||
|
60: 2a c0 rjmp .+84 ; 0xb6 <__bad_interrupt>
|
||||||
|
62: 00 00 nop
|
||||||
|
64: 28 c0 rjmp .+80 ; 0xb6 <__bad_interrupt>
|
||||||
|
66: 00 00 nop
|
||||||
|
68: 26 c0 rjmp .+76 ; 0xb6 <__bad_interrupt>
|
||||||
|
6a: 00 00 nop
|
||||||
|
6c: 24 c0 rjmp .+72 ; 0xb6 <__bad_interrupt>
|
||||||
|
6e: 00 00 nop
|
||||||
|
70: 22 c0 rjmp .+68 ; 0xb6 <__bad_interrupt>
|
||||||
|
72: 00 00 nop
|
||||||
|
74: 20 c0 rjmp .+64 ; 0xb6 <__bad_interrupt>
|
||||||
|
76: 00 00 nop
|
||||||
|
78: 1e c0 rjmp .+60 ; 0xb6 <__bad_interrupt>
|
||||||
|
7a: 00 00 nop
|
||||||
|
7c: 1c c0 rjmp .+56 ; 0xb6 <__bad_interrupt>
|
||||||
|
7e: 00 00 nop
|
||||||
|
80: 1a c0 rjmp .+52 ; 0xb6 <__bad_interrupt>
|
||||||
|
82: 00 00 nop
|
||||||
|
84: 18 c0 rjmp .+48 ; 0xb6 <__bad_interrupt>
|
||||||
|
86: 00 00 nop
|
||||||
|
88: 16 c0 rjmp .+44 ; 0xb6 <__bad_interrupt>
|
||||||
|
...
|
||||||
|
|
||||||
|
0000008c <__ctors_end>:
|
||||||
|
8c: 11 24 eor r1, r1
|
||||||
|
8e: 1f be out 0x3f, r1 ; 63
|
||||||
|
90: cf ef ldi r28, 0xFF ; 255
|
||||||
|
92: d0 e1 ldi r29, 0x10 ; 16
|
||||||
|
94: de bf out 0x3e, r29 ; 62
|
||||||
|
96: cd bf out 0x3d, r28 ; 61
|
||||||
|
|
||||||
|
00000098 <__do_copy_data>:
|
||||||
|
98: 11 e0 ldi r17, 0x01 ; 1
|
||||||
|
9a: a0 e0 ldi r26, 0x00 ; 0
|
||||||
|
9c: b1 e0 ldi r27, 0x01 ; 1
|
||||||
|
9e: ee ec ldi r30, 0xCE ; 206
|
||||||
|
a0: f1 e0 ldi r31, 0x01 ; 1
|
||||||
|
a2: 00 e0 ldi r16, 0x00 ; 0
|
||||||
|
a4: 0b bf out 0x3b, r16 ; 59
|
||||||
|
a6: 02 c0 rjmp .+4 ; 0xac <__do_copy_data+0x14>
|
||||||
|
a8: 07 90 elpm r0, Z+
|
||||||
|
aa: 0d 92 st X+, r0
|
||||||
|
ac: ae 30 cpi r26, 0x0E ; 14
|
||||||
|
ae: b1 07 cpc r27, r17
|
||||||
|
b0: d9 f7 brne .-10 ; 0xa8 <__do_copy_data+0x10>
|
||||||
|
b2: 75 d0 rcall .+234 ; 0x19e <main>
|
||||||
|
b4: 8a c0 rjmp .+276 ; 0x1ca <_exit>
|
||||||
|
|
||||||
|
000000b6 <__bad_interrupt>:
|
||||||
|
b6: a4 cf rjmp .-184 ; 0x0 <__vectors>
|
||||||
|
|
||||||
|
000000b8 <wait>:
|
||||||
|
clock value is set. This is used by _delay_ms inside
|
||||||
|
util/delay.h
|
||||||
|
Version : DMK, Initial code
|
||||||
|
*******************************************************************/
|
||||||
|
void wait( int ms ) {
|
||||||
|
for (int i=0; i<ms; i++) {
|
||||||
|
b8: 20 e0 ldi r18, 0x00 ; 0
|
||||||
|
ba: 30 e0 ldi r19, 0x00 ; 0
|
||||||
|
bc: 08 c0 rjmp .+16 ; 0xce <wait+0x16>
|
||||||
|
#else
|
||||||
|
//round up by default
|
||||||
|
__ticks_dc = (uint32_t)(ceil(fabs(__tmp)));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
__builtin_avr_delay_cycles(__ticks_dc);
|
||||||
|
be: ef ec ldi r30, 0xCF ; 207
|
||||||
|
c0: f7 e0 ldi r31, 0x07 ; 7
|
||||||
|
c2: 31 97 sbiw r30, 0x01 ; 1
|
||||||
|
c4: f1 f7 brne .-4 ; 0xc2 <wait+0xa>
|
||||||
|
c6: 00 c0 rjmp .+0 ; 0xc8 <wait+0x10>
|
||||||
|
c8: 00 00 nop
|
||||||
|
ca: 2f 5f subi r18, 0xFF ; 255
|
||||||
|
cc: 3f 4f sbci r19, 0xFF ; 255
|
||||||
|
ce: 28 17 cp r18, r24
|
||||||
|
d0: 39 07 cpc r19, r25
|
||||||
|
d2: ac f3 brlt .-22 ; 0xbe <wait+0x6>
|
||||||
|
_delay_ms( 1 ); // library function (max 30 ms at 8MHz)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
d4: 08 95 ret
|
||||||
|
|
||||||
|
000000d6 <lcd_strobe_lcd_e>:
|
||||||
|
outputs:
|
||||||
|
notes: According datasheet HD44780
|
||||||
|
Version : DMK, Initial code
|
||||||
|
*******************************************************************/
|
||||||
|
void lcd_strobe_lcd_e(void) {
|
||||||
|
PORTA |= (1<<LCD_E); // E high
|
||||||
|
d6: 8b b3 in r24, 0x1b ; 27
|
||||||
|
d8: 80 64 ori r24, 0x40 ; 64
|
||||||
|
da: 8b bb out 0x1b, r24 ; 27
|
||||||
|
dc: 8f ec ldi r24, 0xCF ; 207
|
||||||
|
de: 97 e0 ldi r25, 0x07 ; 7
|
||||||
|
e0: 01 97 sbiw r24, 0x01 ; 1
|
||||||
|
e2: f1 f7 brne .-4 ; 0xe0 <lcd_strobe_lcd_e+0xa>
|
||||||
|
e4: 00 c0 rjmp .+0 ; 0xe6 <lcd_strobe_lcd_e+0x10>
|
||||||
|
e6: 00 00 nop
|
||||||
|
_delay_ms(1); // nodig
|
||||||
|
PORTA &= ~(1<<LCD_E); // E low
|
||||||
|
e8: 8b b3 in r24, 0x1b ; 27
|
||||||
|
ea: 8f 7b andi r24, 0xBF ; 191
|
||||||
|
ec: 8b bb out 0x1b, r24 ; 27
|
||||||
|
ee: 8f ec ldi r24, 0xCF ; 207
|
||||||
|
f0: 97 e0 ldi r25, 0x07 ; 7
|
||||||
|
f2: 01 97 sbiw r24, 0x01 ; 1
|
||||||
|
f4: f1 f7 brne .-4 ; 0xf2 <lcd_strobe_lcd_e+0x1c>
|
||||||
|
f6: 00 c0 rjmp .+0 ; 0xf8 <lcd_strobe_lcd_e+0x22>
|
||||||
|
f8: 00 00 nop
|
||||||
|
fa: 08 95 ret
|
||||||
|
|
||||||
|
000000fc <init_4bits_mode>:
|
||||||
|
inputs:
|
||||||
|
outputs:
|
||||||
|
notes: According datasheet HD44780 table 12
|
||||||
|
Version : DMK, Initial code
|
||||||
|
*******************************************************************/
|
||||||
|
void init_4bits_mode(void) {
|
||||||
|
fc: cf 93 push r28
|
||||||
|
// PORTC output mode and all low (also E and RS pin)
|
||||||
|
DDRD = 0xFF;
|
||||||
|
fe: 8f ef ldi r24, 0xFF ; 255
|
||||||
|
100: 81 bb out 0x11, r24 ; 17
|
||||||
|
DDRA = 0xFF;
|
||||||
|
102: 8a bb out 0x1a, r24 ; 26
|
||||||
|
PORTC = 0x00;
|
||||||
|
104: 15 ba out 0x15, r1 ; 21
|
||||||
|
PORTA = 0x00;
|
||||||
|
106: 1b ba out 0x1b, r1 ; 27
|
||||||
|
//PORTA = 0xFF;
|
||||||
|
|
||||||
|
// Step 2 (table 12)
|
||||||
|
PORTC = 0x20; // function set
|
||||||
|
108: c0 e2 ldi r28, 0x20 ; 32
|
||||||
|
10a: c5 bb out 0x15, r28 ; 21
|
||||||
|
lcd_strobe_lcd_e();
|
||||||
|
10c: e4 df rcall .-56 ; 0xd6 <lcd_strobe_lcd_e>
|
||||||
|
|
||||||
|
// Step 3 (table 12)
|
||||||
|
PORTC = 0x20; // function set
|
||||||
|
lcd_strobe_lcd_e();
|
||||||
|
10e: c5 bb out 0x15, r28 ; 21
|
||||||
|
110: e2 df rcall .-60 ; 0xd6 <lcd_strobe_lcd_e>
|
||||||
|
PORTC = 0x80;
|
||||||
|
112: 80 e8 ldi r24, 0x80 ; 128
|
||||||
|
lcd_strobe_lcd_e();
|
||||||
|
114: 85 bb out 0x15, r24 ; 21
|
||||||
|
|
||||||
|
// Step 4 (table 12)
|
||||||
|
PORTC = 0x00; // Display on/off control
|
||||||
|
116: df df rcall .-66 ; 0xd6 <lcd_strobe_lcd_e>
|
||||||
|
lcd_strobe_lcd_e();
|
||||||
|
118: 15 ba out 0x15, r1 ; 21
|
||||||
|
PORTC = 0xF0;
|
||||||
|
11a: dd df rcall .-70 ; 0xd6 <lcd_strobe_lcd_e>
|
||||||
|
lcd_strobe_lcd_e();
|
||||||
|
11c: 80 ef ldi r24, 0xF0 ; 240
|
||||||
|
|
||||||
|
// Step 4 (table 12)
|
||||||
|
PORTC = 0x00; // Entry mode set
|
||||||
|
11e: 85 bb out 0x15, r24 ; 21
|
||||||
|
lcd_strobe_lcd_e();
|
||||||
|
120: da df rcall .-76 ; 0xd6 <lcd_strobe_lcd_e>
|
||||||
|
122: 15 ba out 0x15, r1 ; 21
|
||||||
|
PORTC = 0x60;
|
||||||
|
124: d8 df rcall .-80 ; 0xd6 <lcd_strobe_lcd_e>
|
||||||
|
126: 80 e6 ldi r24, 0x60 ; 96
|
||||||
|
lcd_strobe_lcd_e();
|
||||||
|
128: 85 bb out 0x15, r24 ; 21
|
||||||
|
12a: d5 df rcall .-86 ; 0xd6 <lcd_strobe_lcd_e>
|
||||||
|
}
|
||||||
|
12c: cf 91 pop r28
|
||||||
|
12e: 08 95 ret
|
||||||
|
|
||||||
|
00000130 <lcd_write_data>:
|
||||||
|
inputs: byte - written to LCD
|
||||||
|
outputs:
|
||||||
|
notes: According datasheet HD44780 table 12
|
||||||
|
Version : DMK, Initial code
|
||||||
|
*******************************************************************/
|
||||||
|
void lcd_write_data(unsigned char byte) {
|
||||||
|
130: cf 93 push r28
|
||||||
|
132: c8 2f mov r28, r24
|
||||||
|
// First nibble.
|
||||||
|
PORTC = byte;
|
||||||
|
134: 85 bb out 0x15, r24 ; 21
|
||||||
|
PORTA |= (1<<LCD_RS);
|
||||||
|
136: 8b b3 in r24, 0x1b ; 27
|
||||||
|
138: 80 61 ori r24, 0x10 ; 16
|
||||||
|
13a: 8b bb out 0x1b, r24 ; 27
|
||||||
|
lcd_strobe_lcd_e();
|
||||||
|
13c: cc df rcall .-104 ; 0xd6 <lcd_strobe_lcd_e>
|
||||||
|
|
||||||
|
// Second nibble
|
||||||
|
PORTC = (byte<<4);
|
||||||
|
13e: c2 95 swap r28
|
||||||
|
140: c0 7f andi r28, 0xF0 ; 240
|
||||||
|
142: c5 bb out 0x15, r28 ; 21
|
||||||
|
PORTA |= (1<<LCD_RS);
|
||||||
|
144: 8b b3 in r24, 0x1b ; 27
|
||||||
|
146: 80 61 ori r24, 0x10 ; 16
|
||||||
|
lcd_strobe_lcd_e();
|
||||||
|
148: 8b bb out 0x1b, r24 ; 27
|
||||||
|
14a: c5 df rcall .-118 ; 0xd6 <lcd_strobe_lcd_e>
|
||||||
|
}
|
||||||
|
14c: cf 91 pop r28
|
||||||
|
14e: 08 95 ret
|
||||||
|
|
||||||
|
00000150 <lcd_write_string>:
|
||||||
|
inputs:
|
||||||
|
outputs:
|
||||||
|
notes: According datasheet HD44780 table 12
|
||||||
|
Version : DMK, Initial code
|
||||||
|
*******************************************************************/
|
||||||
|
void lcd_write_string(char *str) {
|
||||||
|
150: cf 93 push r28
|
||||||
|
152: df 93 push r29
|
||||||
|
154: ec 01 movw r28, r24
|
||||||
|
// while(*str) {
|
||||||
|
// lcd_write_data(*str++);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// of met een for:
|
||||||
|
for(;*str; str++){
|
||||||
|
156: 02 c0 rjmp .+4 ; 0x15c <lcd_write_string+0xc>
|
||||||
|
lcd_write_data(*str);
|
||||||
|
158: eb df rcall .-42 ; 0x130 <lcd_write_data>
|
||||||
|
// while(*str) {
|
||||||
|
// lcd_write_data(*str++);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// of met een for:
|
||||||
|
for(;*str; str++){
|
||||||
|
15a: 21 96 adiw r28, 0x01 ; 1
|
||||||
|
15c: 88 81 ld r24, Y
|
||||||
|
15e: 81 11 cpse r24, r1
|
||||||
|
160: fb cf rjmp .-10 ; 0x158 <lcd_write_string+0x8>
|
||||||
|
lcd_write_data(*str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
162: df 91 pop r29
|
||||||
|
164: cf 91 pop r28
|
||||||
|
166: 08 95 ret
|
||||||
|
|
||||||
|
00000168 <lcd_write_command>:
|
||||||
|
inputs: byte - written to LCD
|
||||||
|
outputs:
|
||||||
|
notes: According datasheet HD44780 table 12
|
||||||
|
Version : DMK, Initial code
|
||||||
|
*******************************************************************/
|
||||||
|
void lcd_write_command(unsigned char byte) {
|
||||||
|
168: cf 93 push r28
|
||||||
|
16a: c8 2f mov r28, r24
|
||||||
|
// First nibble.
|
||||||
|
PORTC = byte;
|
||||||
|
16c: 85 bb out 0x15, r24 ; 21
|
||||||
|
PORTA &= ~(1<<LCD_RS);
|
||||||
|
16e: 8b b3 in r24, 0x1b ; 27
|
||||||
|
170: 8f 7e andi r24, 0xEF ; 239
|
||||||
|
172: 8b bb out 0x1b, r24 ; 27
|
||||||
|
lcd_strobe_lcd_e();
|
||||||
|
174: b0 df rcall .-160 ; 0xd6 <lcd_strobe_lcd_e>
|
||||||
|
|
||||||
|
// Second nibble
|
||||||
|
PORTC = (byte<<4);
|
||||||
|
176: c2 95 swap r28
|
||||||
|
178: c0 7f andi r28, 0xF0 ; 240
|
||||||
|
17a: c5 bb out 0x15, r28 ; 21
|
||||||
|
PORTA &= ~(1<<LCD_RS);
|
||||||
|
17c: 8b b3 in r24, 0x1b ; 27
|
||||||
|
17e: 8f 7e andi r24, 0xEF ; 239
|
||||||
|
lcd_strobe_lcd_e();
|
||||||
|
180: 8b bb out 0x1b, r24 ; 27
|
||||||
|
182: a9 df rcall .-174 ; 0xd6 <lcd_strobe_lcd_e>
|
||||||
|
}
|
||||||
|
184: cf 91 pop r28
|
||||||
|
186: 08 95 ret
|
||||||
|
|
||||||
|
00000188 <lcd_clear>:
|
||||||
|
|
||||||
|
|
||||||
|
void lcd_clear() {
|
||||||
|
lcd_write_command (0x01); //Leeg display
|
||||||
|
188: 81 e0 ldi r24, 0x01 ; 1
|
||||||
|
18a: ee df rcall .-36 ; 0x168 <lcd_write_command>
|
||||||
|
18c: 8f e9 ldi r24, 0x9F ; 159
|
||||||
|
18e: 9f e0 ldi r25, 0x0F ; 15
|
||||||
|
190: 01 97 sbiw r24, 0x01 ; 1
|
||||||
|
192: f1 f7 brne .-4 ; 0x190 <lcd_clear+0x8>
|
||||||
|
194: 00 c0 rjmp .+0 ; 0x196 <lcd_clear+0xe>
|
||||||
|
196: 00 00 nop
|
||||||
|
_delay_ms(2);
|
||||||
|
lcd_write_command (0x80); //Cursor terug naar start
|
||||||
|
198: 80 e8 ldi r24, 0x80 ; 128
|
||||||
|
19a: e6 cf rjmp .-52 ; 0x168 <lcd_write_command>
|
||||||
|
19c: 08 95 ret
|
||||||
|
|
||||||
|
0000019e <main>:
|
||||||
|
notes: Slow background task after init ISR
|
||||||
|
Version : DMK, Initial code
|
||||||
|
*******************************************************************/
|
||||||
|
int main( void ) {
|
||||||
|
// Init I/O
|
||||||
|
DDRC = 0xFF; // PORTD(7) output, PORTD(6:0) input
|
||||||
|
19e: 8f ef ldi r24, 0xFF ; 255
|
||||||
|
1a0: 84 bb out 0x14, r24 ; 20
|
||||||
|
PORTC = 0xFF;
|
||||||
|
1a2: 85 bb out 0x15, r24 ; 21
|
||||||
|
|
||||||
|
// Init LCD
|
||||||
|
init_4bits_mode();
|
||||||
|
1a4: ab df rcall .-170 ; 0xfc <init_4bits_mode>
|
||||||
|
1a6: 8f e1 ldi r24, 0x1F ; 31
|
||||||
|
1a8: 9e e4 ldi r25, 0x4E ; 78
|
||||||
|
1aa: 01 97 sbiw r24, 0x01 ; 1
|
||||||
|
1ac: f1 f7 brne .-4 ; 0x1aa <main+0xc>
|
||||||
|
1ae: 00 c0 rjmp .+0 ; 0x1b0 <main+0x12>
|
||||||
|
|
||||||
|
_delay_ms(10);
|
||||||
|
|
||||||
|
lcd_clear();
|
||||||
|
1b0: 00 00 nop
|
||||||
|
1b2: ea df rcall .-44 ; 0x188 <lcd_clear>
|
||||||
|
|
||||||
|
// Write sample string
|
||||||
|
lcd_write_string("Hello world!");
|
||||||
|
1b4: 80 e0 ldi r24, 0x00 ; 0
|
||||||
|
1b6: 91 e0 ldi r25, 0x01 ; 1
|
||||||
|
1b8: cb df rcall .-106 ; 0x150 <lcd_write_string>
|
||||||
|
|
||||||
|
// Loop forever
|
||||||
|
while (1) {
|
||||||
|
PORTC ^= (1<<0); // Toggle PORTD.7
|
||||||
|
1ba: 95 b3 in r25, 0x15 ; 21
|
||||||
|
1bc: 81 e0 ldi r24, 0x01 ; 1
|
||||||
|
1be: 89 27 eor r24, r25
|
||||||
|
wait( 250 );
|
||||||
|
1c0: 85 bb out 0x15, r24 ; 21
|
||||||
|
1c2: 8a ef ldi r24, 0xFA ; 250
|
||||||
|
1c4: 90 e0 ldi r25, 0x00 ; 0
|
||||||
|
1c6: 78 df rcall .-272 ; 0xb8 <wait>
|
||||||
|
1c8: f8 cf rjmp .-16 ; 0x1ba <main+0x1c>
|
||||||
|
|
||||||
|
000001ca <_exit>:
|
||||||
|
1ca: f8 94 cli
|
||||||
|
|
||||||
|
000001cc <__stop_program>:
|
||||||
|
1cc: ff cf rjmp .-2 ; 0x1cc <__stop_program>
|
||||||
32
Microcontrollers/testlcd/Debug/testlcd.srec
Normal file
32
Microcontrollers/testlcd/Debug/testlcd.srec
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
S00F0000746573746C63642E7372656322
|
||||||
|
S113000045C0000058C0000056C0000054C00000A5
|
||||||
|
S113001052C0000050C000004EC000004CC00000A0
|
||||||
|
S11300204AC0000048C0000046C0000044C00000B0
|
||||||
|
S113003042C0000040C000003EC000003CC00000C0
|
||||||
|
S11300403AC0000038C0000036C0000034C00000D0
|
||||||
|
S113005032C0000030C000002EC000002CC00000E0
|
||||||
|
S11300602AC0000028C0000026C0000024C00000F0
|
||||||
|
S113007022C0000020C000001EC000001CC0000000
|
||||||
|
S11300801AC0000018C0000016C0000011241FBED2
|
||||||
|
S1130090CFEFD0E1DEBFCDBF11E0A0E0B1E0EEECE8
|
||||||
|
S11300A0F1E000E00BBF02C007900D92AE30B10743
|
||||||
|
S11300B0D9F775D08AC0A4CF20E030E008C0EFECB7
|
||||||
|
S11300C0F7E03197F1F700C000002F5F3F4F28178A
|
||||||
|
S11300D03907ACF308958BB380648BBB8FEC97E046
|
||||||
|
S11300E00197F1F700C000008BB38F7B8BBB8FECC3
|
||||||
|
S11300F097E00197F1F700C000000895CF938FEFC8
|
||||||
|
S113010081BB8ABB15BA1BBAC0E2C5BBE4DFC5BB61
|
||||||
|
S1130110E2DF80E885BBDFDF15BADDDF80EF85BB7A
|
||||||
|
S1130120DADF15BAD8DF80E685BBD5DFCF91089535
|
||||||
|
S1130130CF93C82F85BB8BB380618BBBCCDFC295BB
|
||||||
|
S1130140C07FC5BB8BB380618BBBC5DFCF910895E6
|
||||||
|
S1130150CF93DF93EC0102C0EBDF219688818111FC
|
||||||
|
S1130160FBCFDF91CF910895CF93C82F85BB8BB37D
|
||||||
|
S11301708F7E8BBBB0DFC295C07FC5BB8BB38F7E38
|
||||||
|
S11301808BBBA9DFCF91089581E0EEDF8FE99FE07B
|
||||||
|
S11301900197F1F700C0000080E8E6CF08958FEFE3
|
||||||
|
S11301A084BB85BBABDF8FE19EE40197F1F700C010
|
||||||
|
S11301B00000EADF80E091E0CBDF95B381E089279E
|
||||||
|
S11101C085BB8AEF90E078DFF8CFF894FFCF8C
|
||||||
|
S11101CE48656C6C6F20776F726C64210000C2
|
||||||
|
S9030000FC
|
||||||
200
Microcontrollers/testlcd/main.c
Normal file
200
Microcontrollers/testlcd/main.c
Normal file
@@ -0,0 +1,200 @@
|
|||||||
|
/* ---------------------------------------------------------------------------
|
||||||
|
** This software is in the public domain, furnished "as is", without technical
|
||||||
|
** support, and with no warranty, express or implied, as to its usefulness for
|
||||||
|
** any purpose.
|
||||||
|
**
|
||||||
|
** ioisr.c
|
||||||
|
**
|
||||||
|
** Beschrijving: BigAVR LCD module
|
||||||
|
** Target: AVR mcu
|
||||||
|
** Build: avr-gcc -std=c99 -Wall -O3 -mmcu=atmega128 -D F_CPU=8000000UL -c lcd.c
|
||||||
|
** avr-gcc -g -mmcu=atmega128 -o lcd.elf lcd.o
|
||||||
|
** avr-objcopy -O ihex lcd.elf lcd.hex
|
||||||
|
** or type 'make'
|
||||||
|
** Author: dkroeske@gmail.com
|
||||||
|
** -------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define F_CPU 8e6
|
||||||
|
|
||||||
|
#include <avr/io.h>
|
||||||
|
#include <util/delay.h>
|
||||||
|
#include <avr/interrupt.h>
|
||||||
|
|
||||||
|
#define LCD_E 6 // RA6 UNI-6
|
||||||
|
#define LCD_RS 4 // RA4 UNI-6
|
||||||
|
|
||||||
|
void lcd_strobe_lcd_e(void);
|
||||||
|
void init_4bits_mode(void);
|
||||||
|
void lcd_write_string(char *str);
|
||||||
|
void lcd_write_data(unsigned char byte);
|
||||||
|
void lcd_write_cmd(unsigned char byte);
|
||||||
|
void lcd_clear(void);
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************************************
|
||||||
|
short: Busy wait number of millisecs
|
||||||
|
inputs: int ms (Number of millisecs to busy wait)
|
||||||
|
outputs:
|
||||||
|
notes: Busy wait, not very accurate. Make sure (external)
|
||||||
|
clock value is set. This is used by _delay_ms inside
|
||||||
|
util/delay.h
|
||||||
|
Version : DMK, Initial code
|
||||||
|
*******************************************************************/
|
||||||
|
void wait( int ms ) {
|
||||||
|
for (int i=0; i<ms; i++) {
|
||||||
|
_delay_ms( 1 ); // library function (max 30 ms at 8MHz)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************************************************
|
||||||
|
short: Strobe LCD module E pin --__
|
||||||
|
inputs:
|
||||||
|
outputs:
|
||||||
|
notes: According datasheet HD44780
|
||||||
|
Version : DMK, Initial code
|
||||||
|
*******************************************************************/
|
||||||
|
void lcd_strobe_lcd_e(void) {
|
||||||
|
PORTA |= (1<<LCD_E); // E high
|
||||||
|
_delay_ms(1); // nodig
|
||||||
|
PORTA &= ~(1<<LCD_E); // E low
|
||||||
|
_delay_ms(1); // nodig?
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************************************
|
||||||
|
short: Init LCD module in 4 bits mode.
|
||||||
|
inputs:
|
||||||
|
outputs:
|
||||||
|
notes: According datasheet HD44780 table 12
|
||||||
|
Version : DMK, Initial code
|
||||||
|
*******************************************************************/
|
||||||
|
void init_4bits_mode(void) {
|
||||||
|
// PORTC output mode and all low (also E and RS pin)
|
||||||
|
DDRD = 0xFF;
|
||||||
|
DDRA = 0xFF;
|
||||||
|
PORTC = 0x00;
|
||||||
|
PORTA = 0x00;
|
||||||
|
//PORTA = 0xFF;
|
||||||
|
|
||||||
|
// Step 2 (table 12)
|
||||||
|
PORTC = 0x20; // function set
|
||||||
|
lcd_strobe_lcd_e();
|
||||||
|
|
||||||
|
// Step 3 (table 12)
|
||||||
|
PORTC = 0x20; // function set
|
||||||
|
lcd_strobe_lcd_e();
|
||||||
|
PORTC = 0x80;
|
||||||
|
lcd_strobe_lcd_e();
|
||||||
|
|
||||||
|
// Step 4 (table 12)
|
||||||
|
PORTC = 0x00; // Display on/off control
|
||||||
|
lcd_strobe_lcd_e();
|
||||||
|
PORTC = 0xF0;
|
||||||
|
lcd_strobe_lcd_e();
|
||||||
|
|
||||||
|
// Step 4 (table 12)
|
||||||
|
PORTC = 0x00; // Entry mode set
|
||||||
|
lcd_strobe_lcd_e();
|
||||||
|
PORTC = 0x60;
|
||||||
|
lcd_strobe_lcd_e();
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************************************************
|
||||||
|
short: Writes string to LCD at cursor position
|
||||||
|
inputs:
|
||||||
|
outputs:
|
||||||
|
notes: According datasheet HD44780 table 12
|
||||||
|
Version : DMK, Initial code
|
||||||
|
*******************************************************************/
|
||||||
|
void lcd_write_string(char *str) {
|
||||||
|
// Het kan met een while:
|
||||||
|
|
||||||
|
// while(*str) {
|
||||||
|
// lcd_write_data(*str++);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// of met een for:
|
||||||
|
for(;*str; str++){
|
||||||
|
lcd_write_data(*str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************************************
|
||||||
|
short: Writes 8 bits DATA to lcd
|
||||||
|
inputs: byte - written to LCD
|
||||||
|
outputs:
|
||||||
|
notes: According datasheet HD44780 table 12
|
||||||
|
Version : DMK, Initial code
|
||||||
|
*******************************************************************/
|
||||||
|
void lcd_write_data(unsigned char byte) {
|
||||||
|
// First nibble.
|
||||||
|
PORTC = byte;
|
||||||
|
PORTA |= (1<<LCD_RS);
|
||||||
|
lcd_strobe_lcd_e();
|
||||||
|
|
||||||
|
// Second nibble
|
||||||
|
PORTC = (byte<<4);
|
||||||
|
PORTA |= (1<<LCD_RS);
|
||||||
|
lcd_strobe_lcd_e();
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************************************************
|
||||||
|
short: Writes 8 bits COMMAND to lcd
|
||||||
|
inputs: byte - written to LCD
|
||||||
|
outputs:
|
||||||
|
notes: According datasheet HD44780 table 12
|
||||||
|
Version : DMK, Initial code
|
||||||
|
*******************************************************************/
|
||||||
|
void lcd_write_command(unsigned char byte) {
|
||||||
|
// First nibble.
|
||||||
|
PORTC = byte;
|
||||||
|
PORTA &= ~(1<<LCD_RS);
|
||||||
|
lcd_strobe_lcd_e();
|
||||||
|
|
||||||
|
// Second nibble
|
||||||
|
PORTC = (byte<<4);
|
||||||
|
PORTA &= ~(1<<LCD_RS);
|
||||||
|
lcd_strobe_lcd_e();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void lcd_clear() {
|
||||||
|
lcd_write_command (0x01); //Leeg display
|
||||||
|
_delay_ms(2);
|
||||||
|
lcd_write_command (0x80); //Cursor terug naar start
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************************************
|
||||||
|
short: main() loop, entry point of executable
|
||||||
|
inputs:
|
||||||
|
outputs:
|
||||||
|
notes: Slow background task after init ISR
|
||||||
|
Version : DMK, Initial code
|
||||||
|
*******************************************************************/
|
||||||
|
int main( void ) {
|
||||||
|
// Init I/O
|
||||||
|
DDRC = 0xFF; // PORTD(7) output, PORTD(6:0) input
|
||||||
|
PORTC = 0xFF;
|
||||||
|
|
||||||
|
// Init LCD
|
||||||
|
init_4bits_mode();
|
||||||
|
|
||||||
|
_delay_ms(10);
|
||||||
|
|
||||||
|
lcd_clear();
|
||||||
|
|
||||||
|
// Write sample string
|
||||||
|
lcd_write_string("Hello world!");
|
||||||
|
|
||||||
|
// Loop forever
|
||||||
|
while (1) {
|
||||||
|
PORTC ^= (1<<0); // Toggle PORTD.7
|
||||||
|
wait( 250 );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
86
Microcontrollers/testlcd/testlcd.componentinfo.xml
Normal file
86
Microcontrollers/testlcd/testlcd.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>acTgQvo2LQZomOc3SBvMjw==</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>
|
||||||
146
Microcontrollers/testlcd/testlcd.cproj
Normal file
146
Microcontrollers/testlcd/testlcd.cproj
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
<?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>{b964892d-a92f-44d4-af99-3adc61820917}</ProjectGuid>
|
||||||
|
<avrdevice>ATmega128</avrdevice>
|
||||||
|
<avrdeviceseries>none</avrdeviceseries>
|
||||||
|
<OutputType>Executable</OutputType>
|
||||||
|
<Language>C</Language>
|
||||||
|
<OutputFileName>$(MSBuildProjectName)</OutputFileName>
|
||||||
|
<OutputFileExtension>.elf</OutputFileExtension>
|
||||||
|
<OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory>
|
||||||
|
<AssemblyName>testlcd</AssemblyName>
|
||||||
|
<Name>testlcd</Name>
|
||||||
|
<RootNamespace>testlcd</RootNamespace>
|
||||||
|
<ToolchainFlavour>Native</ToolchainFlavour>
|
||||||
|
<KeepTimersRunning>true</KeepTimersRunning>
|
||||||
|
<OverrideVtor>false</OverrideVtor>
|
||||||
|
<CacheFlash>true</CacheFlash>
|
||||||
|
<ProgFlashFromRam>true</ProgFlashFromRam>
|
||||||
|
<RamSnippetAddress>0x20000000</RamSnippetAddress>
|
||||||
|
<UncachedRange />
|
||||||
|
<preserveEEPROM>true</preserveEEPROM>
|
||||||
|
<OverrideVtorValue>exception_table</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>
|
||||||
|
<avrtool>com.atmel.avrdbg.tool.atmelice</avrtool>
|
||||||
|
<avrtoolserialnumber>J42700011096</avrtoolserialnumber>
|
||||||
|
<avrdeviceexpectedsignature>0x1E9702</avrdeviceexpectedsignature>
|
||||||
|
<com_atmel_avrdbg_tool_atmelice>
|
||||||
|
<ToolOptions>
|
||||||
|
<InterfaceProperties>
|
||||||
|
<JtagDbgClock>2000000</JtagDbgClock>
|
||||||
|
</InterfaceProperties>
|
||||||
|
<InterfaceName>JTAG</InterfaceName>
|
||||||
|
</ToolOptions>
|
||||||
|
<ToolType>com.atmel.avrdbg.tool.atmelice</ToolType>
|
||||||
|
<ToolNumber>J42700011096</ToolNumber>
|
||||||
|
<ToolName>Atmel-ICE</ToolName>
|
||||||
|
</com_atmel_avrdbg_tool_atmelice>
|
||||||
|
<avrtoolinterface>JTAG</avrtoolinterface>
|
||||||
|
<avrtoolinterfaceclock>2000000</avrtoolinterfaceclock>
|
||||||
|
</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="main.c">
|
||||||
|
<SubType>compile</SubType>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
|
||||||
|
</Project>
|
||||||
Reference in New Issue
Block a user