opdracht 2.5 probeersel
This commit is contained in:
125
Microcontrollers/opdracht 2.5/Debug/Makefile
Normal file
125
Microcontrollers/opdracht 2.5/Debug/Makefile
Normal file
@@ -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:=
|
||||
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 +=opdracht\ 2.5.elf
|
||||
|
||||
OUTPUT_FILE_PATH_AS_ARGS +="opdracht 2.5.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: XC8 C Compiler : 2.31
|
||||
$(QUOTE)C:\Program Files\Microchip\xc8\v2.31\bin\xc8-cc.exe$(QUOTE) -mcpu=ATmega128 -mdfp="C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\xc8" -c -x c -funsigned-char -funsigned-bitfields -mext=cci -D__ATmega128__ -DDEBUG -Og -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -g2 -Wall -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: XC8 C Linker : 2.31
|
||||
$(QUOTE)C:\Program Files\Microchip\xc8\v2.31\bin\xc8-cc.exe$(QUOTE) -o$(OUTPUT_FILE_PATH_AS_ARGS) $(OBJS_AS_ARGS) $(USER_OBJS) $(LIBS) -mcpu=ATmega128 -mdfp="C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\xc8" -Wl,-Map="opdracht 2.5.map" -funsigned-char -funsigned-bitfields -Wl,--start-group -Wl,-lm -Wl,--end-group -Wl,--gc-sections -Og -ffunction-sections -fdata-sections -fpack-struct -fshort-enums --memorysummary,memoryfile.xml
|
||||
@echo Finished building target: $@
|
||||
"C:\Program Files\Microchip\xc8\v2.31\bin\avr-objcopy.exe" -O ihex -R .eeprom -R .fuse -R .lock -R .signature -R .user_signatures "opdracht 2.5.elf" "opdracht 2.5.hex"
|
||||
"C:\Program Files\Microchip\xc8\v2.31\bin\avr-objcopy.exe" -j .eeprom --set-section-flags=.eeprom=alloc,load --change-section-lma .eeprom=0 --no-change-warnings -O ihex "opdracht 2.5.elf" "opdracht 2.5.eep" || exit 0
|
||||
"C:\Program Files\Microchip\xc8\v2.31\bin\avr-objdump.exe" -h -S "opdracht 2.5.elf" > "opdracht 2.5.lss"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Other Targets
|
||||
clean:
|
||||
-$(RM) $(OBJS_AS_ARGS) $(EXECUTABLES)
|
||||
-$(RM) $(C_DEPS_AS_ARGS)
|
||||
rm -rf "opdracht 2.5.elf" "opdracht 2.5.hex" "opdracht 2.5.eep" "opdracht 2.5.map" "opdracht 2.5.usersignatures" "opdracht 2.5.a" "opdracht 2.5.lss"
|
||||
|
||||
6
Microcontrollers/opdracht 2.5/Debug/makedep.mk
Normal file
6
Microcontrollers/opdracht 2.5/Debug/makedep.mk
Normal file
@@ -0,0 +1,6 @@
|
||||
################################################################################
|
||||
# Automatically-generated file. Do not edit or delete the file
|
||||
################################################################################
|
||||
|
||||
main.c
|
||||
|
||||
17
Microcontrollers/opdracht 2.5/Debug/memoryfile.xml
Normal file
17
Microcontrollers/opdracht 2.5/Debug/memoryfile.xml
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project>
|
||||
<executable name="opdracht 2.5.elf">
|
||||
<memory name="program">
|
||||
<units>bytes</units>
|
||||
<length>131072</length>
|
||||
<used>444</used>
|
||||
<free>130628</free>
|
||||
</memory>
|
||||
<memory name="data">
|
||||
<units>bytes</units>
|
||||
<length>4096</length>
|
||||
<used>0</used>
|
||||
<free>4096</free>
|
||||
</memory>
|
||||
</executable>
|
||||
</project>
|
||||
1
Microcontrollers/opdracht 2.5/Debug/opdracht 2.5.eep
Normal file
1
Microcontrollers/opdracht 2.5/Debug/opdracht 2.5.eep
Normal file
@@ -0,0 +1 @@
|
||||
:00000001FF
|
||||
328
Microcontrollers/opdracht 2.5/Debug/opdracht 2.5.lss
Normal file
328
Microcontrollers/opdracht 2.5/Debug/opdracht 2.5.lss
Normal file
@@ -0,0 +1,328 @@
|
||||
|
||||
opdracht 2.5.elf: file format elf32-avr
|
||||
|
||||
Sections:
|
||||
Idx Name Size VMA LMA File off Algn
|
||||
0 .data 00000000 00800100 00800100 00000210 2**0
|
||||
ALLOC, LOAD, DATA
|
||||
1 .text 000000a4 00000000 00000000 00000054 2**1
|
||||
CONTENTS, ALLOC, LOAD, READONLY, CODE
|
||||
2 .comment 0000002f 00000000 00000000 00000210 2**0
|
||||
CONTENTS, READONLY
|
||||
3 .debug_aranges 00000060 00000000 00000000 0000023f 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
4 .debug_info 00000dbf 00000000 00000000 0000029f 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
5 .debug_abbrev 00000878 00000000 00000000 0000105e 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
6 .debug_line 000003d5 00000000 00000000 000018d6 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
7 .debug_frame 000000cc 00000000 00000000 00001cac 2**2
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
8 .debug_str 0000027d 00000000 00000000 00001d78 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
9 .debug_loc 000001b4 00000000 00000000 00001ff5 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
10 .debug_ranges 00000050 00000000 00000000 000021a9 2**0
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
11 .text 00000004 000001b8 000001b8 0000020c 2**1
|
||||
CONTENTS, ALLOC, LOAD, READONLY, CODE
|
||||
12 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 000021fc 2**2
|
||||
CONTENTS, READONLY, DEBUGGING
|
||||
13 .text.sbi_portc 00000016 0000018e 0000018e 000001e2 2**1
|
||||
CONTENTS, ALLOC, LOAD, READONLY, CODE
|
||||
14 .text.cbi_portc 00000018 00000176 00000176 000001ca 2**1
|
||||
CONTENTS, ALLOC, LOAD, READONLY, CODE
|
||||
15 .text.lcd_strobe_lcd_e 0000002a 00000124 00000124 00000178 2**1
|
||||
CONTENTS, ALLOC, LOAD, READONLY, CODE
|
||||
16 .text.lcd_add_character 00000028 0000014e 0000014e 000001a2 2**1
|
||||
CONTENTS, ALLOC, LOAD, READONLY, CODE
|
||||
17 .text.lcd_write_string 0000002e 000000f6 000000f6 0000014a 2**1
|
||||
CONTENTS, ALLOC, LOAD, READONLY, CODE
|
||||
18 .progmemx.data 0000000a 000000a4 000000a4 000000f8 2**0
|
||||
CONTENTS, ALLOC, LOAD, READONLY, PROGMEMX
|
||||
19 .text.init_4bits_mode 00000048 000000ae 000000ae 00000102 2**1
|
||||
CONTENTS, ALLOC, LOAD, READONLY, CODE
|
||||
20 .text.main 00000006 000001b2 000001b2 00000206 2**1
|
||||
CONTENTS, ALLOC, LOAD, READONLY, CODE
|
||||
21 .text.libgcc 0000000e 000001a4 000001a4 000001f8 2**1
|
||||
CONTENTS, ALLOC, LOAD, READONLY, CODE
|
||||
|
||||
Disassembly of section .text:
|
||||
|
||||
00000000 <__vectors>:
|
||||
0: 0c 94 46 00 jmp 0x8c ; 0x8c <__ctors_end>
|
||||
4: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt>
|
||||
8: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt>
|
||||
c: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt>
|
||||
10: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt>
|
||||
14: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt>
|
||||
18: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt>
|
||||
1c: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt>
|
||||
20: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt>
|
||||
24: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt>
|
||||
28: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt>
|
||||
2c: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt>
|
||||
30: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt>
|
||||
34: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt>
|
||||
38: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt>
|
||||
3c: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt>
|
||||
40: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt>
|
||||
44: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt>
|
||||
48: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt>
|
||||
4c: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt>
|
||||
50: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt>
|
||||
54: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt>
|
||||
58: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt>
|
||||
5c: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt>
|
||||
60: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt>
|
||||
64: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt>
|
||||
68: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt>
|
||||
6c: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt>
|
||||
70: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt>
|
||||
74: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt>
|
||||
78: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt>
|
||||
7c: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt>
|
||||
80: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt>
|
||||
84: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt>
|
||||
88: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__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
|
||||
98: 0e 94 d9 00 call 0x1b2 ; 0x1b2 <main>
|
||||
9c: 0c 94 50 00 jmp 0xa0 ; 0xa0 <_exit>
|
||||
|
||||
000000a0 <_exit>:
|
||||
a0: f8 94 cli
|
||||
|
||||
000000a2 <__stop_program>:
|
||||
a2: ff cf rjmp .-2 ; 0xa2 <__stop_program>
|
||||
|
||||
Disassembly of section .text:
|
||||
|
||||
000001b8 <__bad_interrupt>:
|
||||
1b8: 0c 94 00 00 jmp 0 ; 0x0 <__TEXT_REGION_ORIGIN__>
|
||||
|
||||
Disassembly of section .text.sbi_portc:
|
||||
|
||||
0000018e <sbi_portc>:
|
||||
cbi_portc(LCD_E); // E low
|
||||
_delay_ms(1);
|
||||
}
|
||||
|
||||
void sbi_portc(int index){
|
||||
PORTC |= (1<<index);
|
||||
18e: 95 b3 in r25, 0x15 ; 21
|
||||
190: 21 e0 ldi r18, 0x01 ; 1
|
||||
192: 30 e0 ldi r19, 0x00 ; 0
|
||||
194: 02 c0 rjmp .+4 ; 0x19a <sbi_portc+0xc>
|
||||
196: 22 0f add r18, r18
|
||||
198: 33 1f adc r19, r19
|
||||
19a: 8a 95 dec r24
|
||||
19c: e2 f7 brpl .-8 ; 0x196 <sbi_portc+0x8>
|
||||
19e: 29 2b or r18, r25
|
||||
1a0: 25 bb out 0x15, r18 ; 21
|
||||
1a2: 08 95 ret
|
||||
|
||||
Disassembly of section .text.cbi_portc:
|
||||
|
||||
00000176 <cbi_portc>:
|
||||
}
|
||||
|
||||
void cbi_portc(int index){
|
||||
PORTC &= ~(1<<index);
|
||||
176: 95 b3 in r25, 0x15 ; 21
|
||||
178: 21 e0 ldi r18, 0x01 ; 1
|
||||
17a: 30 e0 ldi r19, 0x00 ; 0
|
||||
17c: 02 c0 rjmp .+4 ; 0x182 <cbi_portc+0xc>
|
||||
17e: 22 0f add r18, r18
|
||||
180: 33 1f adc r19, r19
|
||||
182: 8a 95 dec r24
|
||||
184: e2 f7 brpl .-8 ; 0x17e <cbi_portc+0x8>
|
||||
186: 20 95 com r18
|
||||
188: 29 23 and r18, r25
|
||||
18a: 25 bb out 0x15, r18 ; 21
|
||||
18c: 08 95 ret
|
||||
|
||||
Disassembly of section .text.lcd_strobe_lcd_e:
|
||||
|
||||
00000124 <lcd_strobe_lcd_e>:
|
||||
//TODO:: Please write your application code
|
||||
}
|
||||
}
|
||||
|
||||
void lcd_strobe_lcd_e(void) {
|
||||
sbi_portc(LCD_E); // E high
|
||||
124: 83 e0 ldi r24, 0x03 ; 3
|
||||
126: 90 e0 ldi r25, 0x00 ; 0
|
||||
128: 0e 94 c7 00 call 0x18e ; 0x18e <sbi_portc>
|
||||
#else
|
||||
//round up by default
|
||||
__ticks_dc = (uint32_t)(ceil(fabs(__tmp)));
|
||||
#endif
|
||||
|
||||
__builtin_avr_delay_cycles(__ticks_dc);
|
||||
12c: 83 ec ldi r24, 0xC3 ; 195
|
||||
12e: 99 e0 ldi r25, 0x09 ; 9
|
||||
130: 01 97 sbiw r24, 0x01 ; 1
|
||||
132: f1 f7 brne .-4 ; 0x130 <lcd_strobe_lcd_e+0xc>
|
||||
134: 00 c0 rjmp .+0 ; 0x136 <lcd_strobe_lcd_e+0x12>
|
||||
136: 00 00 nop
|
||||
_delay_ms(1);
|
||||
cbi_portc(LCD_E); // E low
|
||||
138: 83 e0 ldi r24, 0x03 ; 3
|
||||
13a: 90 e0 ldi r25, 0x00 ; 0
|
||||
13c: 0e 94 bb 00 call 0x176 ; 0x176 <cbi_portc>
|
||||
140: 83 ec ldi r24, 0xC3 ; 195
|
||||
142: 99 e0 ldi r25, 0x09 ; 9
|
||||
144: 01 97 sbiw r24, 0x01 ; 1
|
||||
146: f1 f7 brne .-4 ; 0x144 <lcd_strobe_lcd_e+0x20>
|
||||
148: 00 c0 rjmp .+0 ; 0x14a <lcd_strobe_lcd_e+0x26>
|
||||
14a: 00 00 nop
|
||||
14c: 08 95 ret
|
||||
|
||||
Disassembly of section .text.lcd_add_character:
|
||||
|
||||
0000014e <lcd_add_character>:
|
||||
lcd_strobe_lcd_e();
|
||||
|
||||
lcd_write_string("Pintebaas");
|
||||
}
|
||||
|
||||
void lcd_add_character(unsigned char byte){
|
||||
14e: cf 93 push r28
|
||||
150: c8 2f mov r28, r24
|
||||
|
||||
//upper nibble
|
||||
PORTC = byte;
|
||||
152: 85 bb out 0x15, r24 ; 21
|
||||
sbi_portc(LCD_RS);
|
||||
154: 82 e0 ldi r24, 0x02 ; 2
|
||||
156: 90 e0 ldi r25, 0x00 ; 0
|
||||
158: 0e 94 c7 00 call 0x18e ; 0x18e <sbi_portc>
|
||||
lcd_strobe_lcd_e();
|
||||
15c: 0e 94 92 00 call 0x124 ; 0x124 <lcd_strobe_lcd_e>
|
||||
|
||||
//lower nibble
|
||||
PORTC = (byte<<4);
|
||||
160: c2 95 swap r28
|
||||
162: c0 7f andi r28, 0xF0 ; 240
|
||||
164: c5 bb out 0x15, r28 ; 21
|
||||
sbi_portc(LCD_RS);
|
||||
166: 82 e0 ldi r24, 0x02 ; 2
|
||||
168: 90 e0 ldi r25, 0x00 ; 0
|
||||
16a: 0e 94 c7 00 call 0x18e ; 0x18e <sbi_portc>
|
||||
lcd_strobe_lcd_e();
|
||||
16e: 0e 94 92 00 call 0x124 ; 0x124 <lcd_strobe_lcd_e>
|
||||
}
|
||||
172: cf 91 pop r28
|
||||
174: 08 95 ret
|
||||
|
||||
Disassembly of section .text.lcd_write_string:
|
||||
|
||||
000000f6 <lcd_write_string>:
|
||||
PORTC = (byte<<4);
|
||||
cbi_portc(LCD_RS);
|
||||
lcd_strobe_lcd_e();
|
||||
}
|
||||
|
||||
void lcd_write_string(const char *str) {
|
||||
f6: cf 92 push r12
|
||||
f8: df 92 push r13
|
||||
fa: ef 92 push r14
|
||||
fc: 6b 01 movw r12, r22
|
||||
fe: e8 2e mov r14, r24
|
||||
|
||||
for(;*str; str++){
|
||||
100: 07 c0 rjmp .+14 ; 0x110 <lcd_write_string+0x1a>
|
||||
lcd_add_character(*str);
|
||||
102: 86 2f mov r24, r22
|
||||
104: 0e 94 a7 00 call 0x14e ; 0x14e <lcd_add_character>
|
||||
lcd_strobe_lcd_e();
|
||||
}
|
||||
|
||||
void lcd_write_string(const char *str) {
|
||||
|
||||
for(;*str; str++){
|
||||
108: 8f ef ldi r24, 0xFF ; 255
|
||||
10a: c8 1a sub r12, r24
|
||||
10c: d8 0a sbc r13, r24
|
||||
10e: e8 0a sbc r14, r24
|
||||
110: f6 01 movw r30, r12
|
||||
112: 5e 2d mov r21, r14
|
||||
114: 0e 94 d2 00 call 0x1a4 ; 0x1a4 <__xload_1>
|
||||
118: 61 11 cpse r22, r1
|
||||
11a: f3 cf rjmp .-26 ; 0x102 <lcd_write_string+0xc>
|
||||
lcd_add_character(*str);
|
||||
}
|
||||
}
|
||||
11c: ef 90 pop r14
|
||||
11e: df 90 pop r13
|
||||
120: cf 90 pop r12
|
||||
122: 08 95 ret
|
||||
|
||||
Disassembly of section .text.init_4bits_mode:
|
||||
|
||||
000000ae <init_4bits_mode>:
|
||||
|
||||
//lower nibble
|
||||
PORTC = (byte<<4);
|
||||
cbi_portc(LCD_RS);
|
||||
lcd_strobe_lcd_e();
|
||||
}
|
||||
ae: cf 93 push r28
|
||||
b0: 8f ef ldi r24, 0xFF ; 255
|
||||
b2: 84 bb out 0x14, r24 ; 20
|
||||
b4: 15 ba out 0x15, r1 ; 21
|
||||
b6: c0 e2 ldi r28, 0x20 ; 32
|
||||
b8: c5 bb out 0x15, r28 ; 21
|
||||
ba: 0e 94 92 00 call 0x124 ; 0x124 <lcd_strobe_lcd_e>
|
||||
be: c5 bb out 0x15, r28 ; 21
|
||||
c0: 0e 94 92 00 call 0x124 ; 0x124 <lcd_strobe_lcd_e>
|
||||
c4: 80 e8 ldi r24, 0x80 ; 128
|
||||
c6: 85 bb out 0x15, r24 ; 21
|
||||
c8: 0e 94 92 00 call 0x124 ; 0x124 <lcd_strobe_lcd_e>
|
||||
cc: 15 ba out 0x15, r1 ; 21
|
||||
ce: 0e 94 92 00 call 0x124 ; 0x124 <lcd_strobe_lcd_e>
|
||||
d2: 80 ef ldi r24, 0xF0 ; 240
|
||||
d4: 85 bb out 0x15, r24 ; 21
|
||||
d6: 0e 94 92 00 call 0x124 ; 0x124 <lcd_strobe_lcd_e>
|
||||
da: 15 ba out 0x15, r1 ; 21
|
||||
dc: 0e 94 92 00 call 0x124 ; 0x124 <lcd_strobe_lcd_e>
|
||||
e0: 80 e6 ldi r24, 0x60 ; 96
|
||||
e2: 85 bb out 0x15, r24 ; 21
|
||||
e4: 0e 94 92 00 call 0x124 ; 0x124 <lcd_strobe_lcd_e>
|
||||
e8: 64 ea ldi r22, 0xA4 ; 164
|
||||
ea: 70 e0 ldi r23, 0x00 ; 0
|
||||
ec: 80 e0 ldi r24, 0x00 ; 0
|
||||
ee: 0e 94 7b 00 call 0xf6 ; 0xf6 <lcd_write_string>
|
||||
f2: cf 91 pop r28
|
||||
f4: 08 95 ret
|
||||
|
||||
Disassembly of section .text.main:
|
||||
|
||||
000001b2 <main>:
|
||||
void lcd_add_character(unsigned char byte);
|
||||
void lcd_add_command(unsigned char byte);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
init_4bits_mode();
|
||||
1b2: 0e 94 57 00 call 0xae ; 0xae <init_4bits_mode>
|
||||
1b6: ff cf rjmp .-2 ; 0x1b6 <main+0x4>
|
||||
|
||||
Disassembly of section .text.libgcc:
|
||||
|
||||
000001a4 <__xload_1>:
|
||||
1a4: 57 fd sbrc r21, 7
|
||||
1a6: 03 c0 rjmp .+6 ; 0x1ae <__xload_1+0xa>
|
||||
1a8: 5b bf out 0x3b, r21 ; 59
|
||||
1aa: 67 91 elpm r22, Z+
|
||||
1ac: 08 95 ret
|
||||
1ae: 60 81 ld r22, Z
|
||||
1b0: 08 95 ret
|
||||
@@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#define F_CPU 8e6
|
||||
#define F_CPU 10e6
|
||||
#include <xc.h>
|
||||
#include <avr/io.h>
|
||||
#include <util/delay.h>
|
||||
@@ -15,24 +15,41 @@
|
||||
#define LCD_E 3
|
||||
#define LCD_RS 2
|
||||
|
||||
void _delay_ms(double __ms);
|
||||
void lcd_strobe_lcd_e(void);
|
||||
void sbi_portc(int index);
|
||||
void cbi_portc(int index);
|
||||
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_write_string(const char *str);
|
||||
void lcd_add_character(unsigned char byte);
|
||||
void lcd_add_command(unsigned char byte);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
init_4bits_mode();
|
||||
|
||||
|
||||
|
||||
while(1)
|
||||
{
|
||||
|
||||
//TODO:: Please write your application code
|
||||
}
|
||||
}
|
||||
|
||||
void lcd_strobe_lcd_e(void) {
|
||||
PORTC |= (1<<LCD_E); // E high
|
||||
sbi_portc(LCD_E); // E high
|
||||
_delay_ms(1);
|
||||
PORTC &= ~(1<<LCD_E); // E low
|
||||
cbi_portc(LCD_E); // E low
|
||||
_delay_ms(1);
|
||||
}
|
||||
|
||||
void sbi_portc(int index){
|
||||
PORTC |= (1<<index);
|
||||
}
|
||||
|
||||
void cbi_portc(int index){
|
||||
PORTC &= ~(1<<index);
|
||||
}
|
||||
|
||||
void init_4bits_mode(void) {
|
||||
@@ -58,4 +75,44 @@ void init_4bits_mode(void) {
|
||||
lcd_strobe_lcd_e();
|
||||
PORTC = 0x60; // Entry mode set low nibble
|
||||
lcd_strobe_lcd_e();
|
||||
|
||||
lcd_write_string("Pintebaas");
|
||||
}
|
||||
|
||||
void lcd_add_character(unsigned char byte){
|
||||
|
||||
//upper nibble
|
||||
PORTC = byte;
|
||||
sbi_portc(LCD_RS);
|
||||
lcd_strobe_lcd_e();
|
||||
|
||||
//lower nibble
|
||||
PORTC = (byte<<4);
|
||||
sbi_portc(LCD_RS);
|
||||
lcd_strobe_lcd_e();
|
||||
}
|
||||
|
||||
void lcd_add_command(unsigned char byte){
|
||||
|
||||
//upper nibble
|
||||
PORTC = byte;
|
||||
cbi_portc(LCD_RS);
|
||||
lcd_strobe_lcd_e();
|
||||
|
||||
//lower nibble
|
||||
PORTC = (byte<<4);
|
||||
cbi_portc(LCD_RS);
|
||||
lcd_strobe_lcd_e();
|
||||
}
|
||||
|
||||
void lcd_write_string(const char *str) {
|
||||
|
||||
for(;*str; str++){
|
||||
lcd_add_character(*str);
|
||||
}
|
||||
}
|
||||
|
||||
void lcd_move_right(void){
|
||||
|
||||
lcd_add_command(0x1E);
|
||||
}
|
||||
Reference in New Issue
Block a user