This commit is contained in:
Sem van der Hoeven
2021-02-24 11:50:32 +01:00
parent 4a6d4a5728
commit 0625ca1ccb
5 changed files with 304 additions and 288 deletions

View File

@@ -17,17 +17,11 @@ Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "opdracht 2.1", "opdracht 2.
EndProject EndProject
Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "Opdracht 2.2", "Opdracht 2.2\Opdracht 2.2.cproj", "{7328E66F-4181-4553-9542-DA5CC2A74A4E}" Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "Opdracht 2.2", "Opdracht 2.2\Opdracht 2.2.cproj", "{7328E66F-4181-4553-9542-DA5CC2A74A4E}"
EndProject EndProject
Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "opdracht 2.3", "opdracht 2.3\opdracht 2.3.cproj", "{9154C165-89AB-43CF-8C28-23147BC26FDC}" Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "opdracht 2.3", "opdracht 2.3\opdracht 2.3.cproj", "{E0046CE4-D6F8-435F-9C6E-72E6EB89CCB3}"
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
<<<<<<< HEAD
Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "testlcd", "testlcd\testlcd.cproj", "{B964892D-A92F-44D4-AF99-3ADC61820917}" Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "testlcd", "testlcd\testlcd.cproj", "{B964892D-A92F-44D4-AF99-3ADC61820917}"
=======
Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "opdracht 2.4", "opdracht 2.4\opdracht 2.4.cproj", "{0FA0C637-5AC0-44F3-999B-49C114B97183}"
EndProject
Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "opdracht 3.3", "opdracht 3.3\opdracht 3.3.cproj", "{985D5C75-F61E-49F1-A532-66A1E6141552}"
>>>>>>> 12029c15d35456f0080287d83bbdee63f625a09b
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -63,29 +57,18 @@ Global
{7328E66F-4181-4553-9542-DA5CC2A74A4E}.Debug|AVR.Build.0 = Debug|AVR {7328E66F-4181-4553-9542-DA5CC2A74A4E}.Debug|AVR.Build.0 = Debug|AVR
{7328E66F-4181-4553-9542-DA5CC2A74A4E}.Release|AVR.ActiveCfg = Release|AVR {7328E66F-4181-4553-9542-DA5CC2A74A4E}.Release|AVR.ActiveCfg = Release|AVR
{7328E66F-4181-4553-9542-DA5CC2A74A4E}.Release|AVR.Build.0 = Release|AVR {7328E66F-4181-4553-9542-DA5CC2A74A4E}.Release|AVR.Build.0 = Release|AVR
{9154C165-89AB-43CF-8C28-23147BC26FDC}.Debug|AVR.ActiveCfg = Debug|AVR {E0046CE4-D6F8-435F-9C6E-72E6EB89CCB3}.Debug|AVR.ActiveCfg = Debug|AVR
{9154C165-89AB-43CF-8C28-23147BC26FDC}.Debug|AVR.Build.0 = Debug|AVR {E0046CE4-D6F8-435F-9C6E-72E6EB89CCB3}.Debug|AVR.Build.0 = Debug|AVR
{9154C165-89AB-43CF-8C28-23147BC26FDC}.Release|AVR.ActiveCfg = Release|AVR {E0046CE4-D6F8-435F-9C6E-72E6EB89CCB3}.Release|AVR.ActiveCfg = Release|AVR
{9154C165-89AB-43CF-8C28-23147BC26FDC}.Release|AVR.Build.0 = Release|AVR {E0046CE4-D6F8-435F-9C6E-72E6EB89CCB3}.Release|AVR.Build.0 = Release|AVR
{C81B68AA-F4BB-4A5D-81F8-2737DCD1D4A7}.Debug|AVR.ActiveCfg = Debug|AVR {C81B68AA-F4BB-4A5D-81F8-2737DCD1D4A7}.Debug|AVR.ActiveCfg = Debug|AVR
{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
<<<<<<< HEAD
{B964892D-A92F-44D4-AF99-3ADC61820917}.Debug|AVR.ActiveCfg = Debug|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}.Debug|AVR.Build.0 = Debug|AVR
{B964892D-A92F-44D4-AF99-3ADC61820917}.Release|AVR.ActiveCfg = Release|AVR {B964892D-A92F-44D4-AF99-3ADC61820917}.Release|AVR.ActiveCfg = Release|AVR
{B964892D-A92F-44D4-AF99-3ADC61820917}.Release|AVR.Build.0 = Release|AVR {B964892D-A92F-44D4-AF99-3ADC61820917}.Release|AVR.Build.0 = Release|AVR
=======
{0FA0C637-5AC0-44F3-999B-49C114B97183}.Debug|AVR.ActiveCfg = Debug|AVR
{0FA0C637-5AC0-44F3-999B-49C114B97183}.Debug|AVR.Build.0 = Debug|AVR
{0FA0C637-5AC0-44F3-999B-49C114B97183}.Release|AVR.ActiveCfg = Release|AVR
{0FA0C637-5AC0-44F3-999B-49C114B97183}.Release|AVR.Build.0 = Release|AVR
{985D5C75-F61E-49F1-A532-66A1E6141552}.Debug|AVR.ActiveCfg = Debug|AVR
{985D5C75-F61E-49F1-A532-66A1E6141552}.Debug|AVR.Build.0 = Debug|AVR
{985D5C75-F61E-49F1-A532-66A1E6141552}.Release|AVR.ActiveCfg = Release|AVR
{985D5C75-F61E-49F1-A532-66A1E6141552}.Release|AVR.Build.0 = Release|AVR
>>>>>>> 12029c15d35456f0080287d83bbdee63f625a09b
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@@ -4,7 +4,7 @@
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
<ProjectVersion>7.0</ProjectVersion> <ProjectVersion>7.0</ProjectVersion>
<ToolchainName>com.microchip.xc8</ToolchainName> <ToolchainName>com.microchip.xc8</ToolchainName>
<ProjectGuid>{9154c165-89ab-43cf-8c28-23147bc26fdc}</ProjectGuid> <ProjectGuid>{e0046ce4-d6f8-435f-9c6e-72e6eb89ccb3}</ProjectGuid>
<avrdevice>ATmega128</avrdevice> <avrdevice>ATmega128</avrdevice>
<avrdeviceseries>none</avrdeviceseries> <avrdeviceseries>none</avrdeviceseries>
<OutputType>Executable</OutputType> <OutputType>Executable</OutputType>

View File

@@ -4,8 +4,8 @@
<memory name="program"> <memory name="program">
<units>bytes</units> <units>bytes</units>
<length>131072</length> <length>131072</length>
<used>444</used> <used>544</used>
<free>130628</free> <free>130528</free>
</memory> </memory>
<memory name="data"> <memory name="data">
<units>bytes</units> <units>bytes</units>

View File

@@ -3,89 +3,93 @@ opdracht 2.5.elf: file format elf32-avr
Sections: Sections:
Idx Name Size VMA LMA File off Algn Idx Name Size VMA LMA File off Algn
0 .data 00000000 00800100 00800100 00000210 2**0 0 .data 00000000 00800100 00800100 00000274 2**0
ALLOC, LOAD, DATA ALLOC, LOAD, DATA
1 .text 000000a4 00000000 00000000 00000054 2**1 1 .text 000000a4 00000000 00000000 00000054 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .comment 0000002f 00000000 00000000 00000210 2**0 2 .comment 0000002f 00000000 00000000 00000274 2**0
CONTENTS, READONLY CONTENTS, READONLY
3 .debug_aranges 00000060 00000000 00000000 0000023f 2**0 3 .debug_aranges 00000078 00000000 00000000 000002a3 2**0
CONTENTS, READONLY, DEBUGGING CONTENTS, READONLY, DEBUGGING
4 .debug_info 00000dbf 00000000 00000000 0000029f 2**0 4 .debug_info 00000ed8 00000000 00000000 0000031b 2**0
CONTENTS, READONLY, DEBUGGING CONTENTS, READONLY, DEBUGGING
5 .debug_abbrev 00000878 00000000 00000000 0000105e 2**0 5 .debug_abbrev 00000890 00000000 00000000 000011f3 2**0
CONTENTS, READONLY, DEBUGGING CONTENTS, READONLY, DEBUGGING
6 .debug_line 000003d5 00000000 00000000 000018d6 2**0 6 .debug_line 00000463 00000000 00000000 00001a83 2**0
CONTENTS, READONLY, DEBUGGING CONTENTS, READONLY, DEBUGGING
7 .debug_frame 000000cc 00000000 00000000 00001cac 2**2 7 .debug_frame 000000fc 00000000 00000000 00001ee8 2**2
CONTENTS, READONLY, DEBUGGING CONTENTS, READONLY, DEBUGGING
8 .debug_str 0000027d 00000000 00000000 00001d78 2**0 8 .debug_str 00000283 00000000 00000000 00001fe4 2**0
CONTENTS, READONLY, DEBUGGING CONTENTS, READONLY, DEBUGGING
9 .debug_loc 000001b4 00000000 00000000 00001ff5 2**0 9 .debug_loc 00000242 00000000 00000000 00002267 2**0
CONTENTS, READONLY, DEBUGGING CONTENTS, READONLY, DEBUGGING
10 .debug_ranges 00000050 00000000 00000000 000021a9 2**0 10 .debug_ranges 00000068 00000000 00000000 000024a9 2**0
CONTENTS, READONLY, DEBUGGING CONTENTS, READONLY, DEBUGGING
11 .text 00000004 000001b8 000001b8 0000020c 2**1 11 .text 00000004 0000021c 0000021c 00000270 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE CONTENTS, ALLOC, LOAD, READONLY, CODE
12 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 000021fc 2**2 12 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 00002514 2**2
CONTENTS, READONLY, DEBUGGING CONTENTS, READONLY, DEBUGGING
13 .text.sbi_portc 00000016 0000018e 0000018e 000001e2 2**1 13 .text.sbi_porta 00000016 000001f8 000001f8 0000024c 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE CONTENTS, ALLOC, LOAD, READONLY, CODE
14 .text.cbi_portc 00000018 00000176 00000176 000001ca 2**1 14 .text.cbi_porta 00000018 000001e0 000001e0 00000234 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE CONTENTS, ALLOC, LOAD, READONLY, CODE
15 .text.lcd_strobe_lcd_e 0000002a 00000124 00000124 00000178 2**1 15 .text.lcd_strobe_lcd_e 0000002a 0000012c 0000012c 00000180 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE CONTENTS, ALLOC, LOAD, READONLY, CODE
16 .text.lcd_add_character 00000028 0000014e 0000014e 000001a2 2**1 16 .text.lcd_write_character 00000028 00000156 00000156 000001aa 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE CONTENTS, ALLOC, LOAD, READONLY, CODE
17 .text.lcd_write_string 0000002e 000000f6 000000f6 0000014a 2**1 17 .text.lcd_write_command 00000028 0000017e 0000017e 000001d2 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE CONTENTS, ALLOC, LOAD, READONLY, CODE
18 .progmemx.data 0000000a 000000a4 000000a4 000000f8 2**0 18 .text.lcd_clear 0000001a 000001c6 000001c6 0000021a 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
19 .text.init_4bits_mode 00000050 000000ae 000000ae 00000102 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
20 .text.lcd_write_string 0000002e 000000fe 000000fe 00000152 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
21 .progmemx.data 0000000a 000000a4 000000a4 000000f8 2**0
CONTENTS, ALLOC, LOAD, READONLY, PROGMEMX CONTENTS, ALLOC, LOAD, READONLY, PROGMEMX
19 .text.init_4bits_mode 00000048 000000ae 000000ae 00000102 2**1 22 .text.main 00000020 000001a6 000001a6 000001fa 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE CONTENTS, ALLOC, LOAD, READONLY, CODE
20 .text.main 00000006 000001b2 000001b2 00000206 2**1 23 .text.libgcc 0000000e 0000020e 0000020e 00000262 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
21 .text.libgcc 0000000e 000001a4 000001a4 000001f8 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE CONTENTS, ALLOC, LOAD, READONLY, CODE
Disassembly of section .text: Disassembly of section .text:
00000000 <__vectors>: 00000000 <__vectors>:
0: 0c 94 46 00 jmp 0x8c ; 0x8c <__ctors_end> 0: 0c 94 46 00 jmp 0x8c ; 0x8c <__ctors_end>
4: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt> 4: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
8: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt> 8: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
c: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt> c: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
10: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt> 10: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
14: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt> 14: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
18: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt> 18: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
1c: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt> 1c: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
20: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt> 20: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
24: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt> 24: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
28: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt> 28: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
2c: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt> 2c: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
30: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt> 30: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
34: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt> 34: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
38: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt> 38: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
3c: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt> 3c: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
40: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt> 40: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
44: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt> 44: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
48: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt> 48: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
4c: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt> 4c: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
50: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt> 50: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
54: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt> 54: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
58: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt> 58: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
5c: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt> 5c: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
60: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt> 60: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
64: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt> 64: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
68: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt> 68: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
6c: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt> 6c: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
70: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt> 70: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
74: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt> 74: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
78: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt> 78: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
7c: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt> 7c: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
80: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt> 80: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
84: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt> 84: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
88: 0c 94 dc 00 jmp 0x1b8 ; 0x1b8 <__bad_interrupt> 88: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
0000008c <__ctors_end>: 0000008c <__ctors_end>:
8c: 11 24 eor r1, r1 8c: 11 24 eor r1, r1
@@ -94,7 +98,7 @@ Disassembly of section .text:
92: d0 e1 ldi r29, 0x10 ; 16 92: d0 e1 ldi r29, 0x10 ; 16
94: de bf out 0x3e, r29 ; 62 94: de bf out 0x3e, r29 ; 62
96: cd bf out 0x3d, r28 ; 61 96: cd bf out 0x3d, r28 ; 61
98: 0e 94 d9 00 call 0x1b2 ; 0x1b2 <main> 98: 0e 94 d3 00 call 0x1a6 ; 0x1a6 <main>
9c: 0c 94 50 00 jmp 0xa0 ; 0xa0 <_exit> 9c: 0c 94 50 00 jmp 0xa0 ; 0xa0 <_exit>
000000a0 <_exit>: 000000a0 <_exit>:
@@ -105,224 +109,214 @@ Disassembly of section .text:
Disassembly of section .text: Disassembly of section .text:
000001b8 <__bad_interrupt>: 0000021c <__bad_interrupt>:
1b8: 0c 94 00 00 jmp 0 ; 0x0 <__TEXT_REGION_ORIGIN__> 21c: 0c 94 00 00 jmp 0 ; 0x0 <__TEXT_REGION_ORIGIN__>
Disassembly of section .text.sbi_portc: Disassembly of section .text.sbi_porta:
0000018e <sbi_portc>: 000001f8 <sbi_porta>:
cbi_portc(LCD_E); // E low void cbi_portc(int index){
_delay_ms(1); PORTC &= ~(1<<index);
} }
void sbi_portc(int index){ void sbi_porta(int index){
PORTA |= (1<<index);
1f8: 9b b3 in r25, 0x1b ; 27
1fa: 21 e0 ldi r18, 0x01 ; 1
1fc: 30 e0 ldi r19, 0x00 ; 0
1fe: 02 c0 rjmp .+4 ; 0x204 <sbi_porta+0xc>
200: 22 0f add r18, r18
202: 33 1f adc r19, r19
204: 8a 95 dec r24
206: e2 f7 brpl .-8 ; 0x200 <sbi_porta+0x8>
208: 29 2b or r18, r25
20a: 2b bb out 0x1b, r18 ; 27
20c: 08 95 ret
Disassembly of section .text.cbi_porta:
000001e0 <cbi_porta>:
PORTC |= (1<<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){ void cbi_portc(int index){
PORTC &= ~(1<<index); PORTC &= ~(1<<index);
176: 95 b3 in r25, 0x15 ; 21 1e0: 9b b3 in r25, 0x1b ; 27
178: 21 e0 ldi r18, 0x01 ; 1 1e2: 21 e0 ldi r18, 0x01 ; 1
17a: 30 e0 ldi r19, 0x00 ; 0 1e4: 30 e0 ldi r19, 0x00 ; 0
17c: 02 c0 rjmp .+4 ; 0x182 <cbi_portc+0xc> 1e6: 02 c0 rjmp .+4 ; 0x1ec <cbi_porta+0xc>
17e: 22 0f add r18, r18 1e8: 22 0f add r18, r18
180: 33 1f adc r19, r19 1ea: 33 1f adc r19, r19
182: 8a 95 dec r24 1ec: 8a 95 dec r24
184: e2 f7 brpl .-8 ; 0x17e <cbi_portc+0x8> 1ee: e2 f7 brpl .-8 ; 0x1e8 <cbi_porta+0x8>
186: 20 95 com r18 1f0: 20 95 com r18
188: 29 23 and r18, r25 1f2: 29 23 and r18, r25
18a: 25 bb out 0x15, r18 ; 21 1f4: 2b bb out 0x1b, r18 ; 27
18c: 08 95 ret 1f6: 08 95 ret
Disassembly of section .text.lcd_strobe_lcd_e: Disassembly of section .text.lcd_strobe_lcd_e:
00000124 <lcd_strobe_lcd_e>: 0000012c <lcd_strobe_lcd_e>:
//TODO:: Please write your application code 12c: 86 e0 ldi r24, 0x06 ; 6
} 12e: 90 e0 ldi r25, 0x00 ; 0
} 130: 0e 94 fc 00 call 0x1f8 ; 0x1f8 <sbi_porta>
134: 83 ec ldi r24, 0xC3 ; 195
136: 99 e0 ldi r25, 0x09 ; 9
138: 01 97 sbiw r24, 0x01 ; 1
13a: f1 f7 brne .-4 ; 0x138 <lcd_strobe_lcd_e+0xc>
13c: 00 c0 rjmp .+0 ; 0x13e <lcd_strobe_lcd_e+0x12>
13e: 00 00 nop
140: 86 e0 ldi r24, 0x06 ; 6
142: 90 e0 ldi r25, 0x00 ; 0
144: 0e 94 f0 00 call 0x1e0 ; 0x1e0 <cbi_porta>
148: 83 ec ldi r24, 0xC3 ; 195
14a: 99 e0 ldi r25, 0x09 ; 9
14c: 01 97 sbiw r24, 0x01 ; 1
14e: f1 f7 brne .-4 ; 0x14c <lcd_strobe_lcd_e+0x20>
150: 00 c0 rjmp .+0 ; 0x152 <lcd_strobe_lcd_e+0x26>
152: 00 00 nop
154: 08 95 ret
void lcd_strobe_lcd_e(void) { Disassembly of section .text.lcd_write_character:
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); 00000156 <lcd_write_character>:
12c: 83 ec ldi r24, 0xC3 ; 195 156: cf 93 push r28
12e: 99 e0 ldi r25, 0x09 ; 9 158: c8 2f mov r28, r24
130: 01 97 sbiw r24, 0x01 ; 1 15a: 85 bb out 0x15, r24 ; 21
132: f1 f7 brne .-4 ; 0x130 <lcd_strobe_lcd_e+0xc> 15c: 84 e0 ldi r24, 0x04 ; 4
134: 00 c0 rjmp .+0 ; 0x136 <lcd_strobe_lcd_e+0x12> 15e: 90 e0 ldi r25, 0x00 ; 0
136: 00 00 nop 160: 0e 94 fc 00 call 0x1f8 ; 0x1f8 <sbi_porta>
_delay_ms(1); 164: 0e 94 96 00 call 0x12c ; 0x12c <lcd_strobe_lcd_e>
cbi_portc(LCD_E); // E low 168: c2 95 swap r28
138: 83 e0 ldi r24, 0x03 ; 3 16a: c0 7f andi r28, 0xF0 ; 240
13a: 90 e0 ldi r25, 0x00 ; 0 16c: c5 bb out 0x15, r28 ; 21
13c: 0e 94 bb 00 call 0x176 ; 0x176 <cbi_portc> 16e: 84 e0 ldi r24, 0x04 ; 4
140: 83 ec ldi r24, 0xC3 ; 195 170: 90 e0 ldi r25, 0x00 ; 0
142: 99 e0 ldi r25, 0x09 ; 9 172: 0e 94 fc 00 call 0x1f8 ; 0x1f8 <sbi_porta>
144: 01 97 sbiw r24, 0x01 ; 1 176: 0e 94 96 00 call 0x12c ; 0x12c <lcd_strobe_lcd_e>
146: f1 f7 brne .-4 ; 0x144 <lcd_strobe_lcd_e+0x20> 17a: cf 91 pop r28
148: 00 c0 rjmp .+0 ; 0x14a <lcd_strobe_lcd_e+0x26> 17c: 08 95 ret
14a: 00 00 nop
14c: 08 95 ret
Disassembly of section .text.lcd_add_character: Disassembly of section .text.lcd_write_command:
0000014e <lcd_add_character>: 0000017e <lcd_write_command>:
lcd_strobe_lcd_e(); 17e: cf 93 push r28
180: c8 2f mov r28, r24
182: 85 bb out 0x15, r24 ; 21
184: 84 e0 ldi r24, 0x04 ; 4
186: 90 e0 ldi r25, 0x00 ; 0
188: 0e 94 f0 00 call 0x1e0 ; 0x1e0 <cbi_porta>
18c: 0e 94 96 00 call 0x12c ; 0x12c <lcd_strobe_lcd_e>
190: c2 95 swap r28
192: c0 7f andi r28, 0xF0 ; 240
194: c5 bb out 0x15, r28 ; 21
196: 84 e0 ldi r24, 0x04 ; 4
198: 90 e0 ldi r25, 0x00 ; 0
19a: 0e 94 f0 00 call 0x1e0 ; 0x1e0 <cbi_porta>
19e: 0e 94 96 00 call 0x12c ; 0x12c <lcd_strobe_lcd_e>
1a2: cf 91 pop r28
1a4: 08 95 ret
lcd_write_string("Pintebaas"); Disassembly of section .text.lcd_clear:
}
void lcd_add_character(unsigned char byte){ 000001c6 <lcd_clear>:
14e: cf 93 push r28 1c6: 81 e0 ldi r24, 0x01 ; 1
150: c8 2f mov r28, r24 1c8: 0e 94 bf 00 call 0x17e ; 0x17e <lcd_write_command>
1cc: 87 e8 ldi r24, 0x87 ; 135
//upper nibble 1ce: 93 e1 ldi r25, 0x13 ; 19
PORTC = byte; 1d0: 01 97 sbiw r24, 0x01 ; 1
152: 85 bb out 0x15, r24 ; 21 1d2: f1 f7 brne .-4 ; 0x1d0 <lcd_clear+0xa>
sbi_portc(LCD_RS); 1d4: 00 c0 rjmp .+0 ; 0x1d6 <lcd_clear+0x10>
154: 82 e0 ldi r24, 0x02 ; 2 1d6: 00 00 nop
156: 90 e0 ldi r25, 0x00 ; 0 1d8: 80 e8 ldi r24, 0x80 ; 128
158: 0e 94 c7 00 call 0x18e ; 0x18e <sbi_portc> 1da: 0e 94 bf 00 call 0x17e ; 0x17e <lcd_write_command>
lcd_strobe_lcd_e(); 1de: 08 95 ret
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: Disassembly of section .text.init_4bits_mode:
000000ae <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 ae: cf 93 push r28
b0: 8f ef ldi r24, 0xFF ; 255 b0: 8f ef ldi r24, 0xFF ; 255
b2: 84 bb out 0x14, r24 ; 20 b2: 84 bb out 0x14, r24 ; 20
b4: 15 ba out 0x15, r1 ; 21 b4: 85 bb out 0x15, r24 ; 21
b6: c0 e2 ldi r28, 0x20 ; 32 b6: 81 bb out 0x11, r24 ; 17
b8: c5 bb out 0x15, r28 ; 21 b8: 8a bb out 0x1a, r24 ; 26
ba: 0e 94 92 00 call 0x124 ; 0x124 <lcd_strobe_lcd_e> ba: 15 ba out 0x15, r1 ; 21
be: c5 bb out 0x15, r28 ; 21 bc: 1b ba out 0x1b, r1 ; 27
c0: 0e 94 92 00 call 0x124 ; 0x124 <lcd_strobe_lcd_e> be: c0 e2 ldi r28, 0x20 ; 32
c4: 80 e8 ldi r24, 0x80 ; 128 c0: c5 bb out 0x15, r28 ; 21
c6: 85 bb out 0x15, r24 ; 21 c2: 0e 94 96 00 call 0x12c ; 0x12c <lcd_strobe_lcd_e>
c8: 0e 94 92 00 call 0x124 ; 0x124 <lcd_strobe_lcd_e> c6: c5 bb out 0x15, r28 ; 21
cc: 15 ba out 0x15, r1 ; 21 c8: 0e 94 96 00 call 0x12c ; 0x12c <lcd_strobe_lcd_e>
ce: 0e 94 92 00 call 0x124 ; 0x124 <lcd_strobe_lcd_e> cc: 80 e8 ldi r24, 0x80 ; 128
d2: 80 ef ldi r24, 0xF0 ; 240 ce: 85 bb out 0x15, r24 ; 21
d4: 85 bb out 0x15, r24 ; 21 d0: 0e 94 96 00 call 0x12c ; 0x12c <lcd_strobe_lcd_e>
d6: 0e 94 92 00 call 0x124 ; 0x124 <lcd_strobe_lcd_e> d4: 15 ba out 0x15, r1 ; 21
da: 15 ba out 0x15, r1 ; 21 d6: 0e 94 96 00 call 0x12c ; 0x12c <lcd_strobe_lcd_e>
dc: 0e 94 92 00 call 0x124 ; 0x124 <lcd_strobe_lcd_e> da: 80 ef ldi r24, 0xF0 ; 240
e0: 80 e6 ldi r24, 0x60 ; 96 dc: 85 bb out 0x15, r24 ; 21
e2: 85 bb out 0x15, r24 ; 21 de: 0e 94 96 00 call 0x12c ; 0x12c <lcd_strobe_lcd_e>
e4: 0e 94 92 00 call 0x124 ; 0x124 <lcd_strobe_lcd_e> e2: 15 ba out 0x15, r1 ; 21
e8: 64 ea ldi r22, 0xA4 ; 164 e4: 0e 94 96 00 call 0x12c ; 0x12c <lcd_strobe_lcd_e>
ea: 70 e0 ldi r23, 0x00 ; 0 e8: 80 e6 ldi r24, 0x60 ; 96
ec: 80 e0 ldi r24, 0x00 ; 0 ea: 85 bb out 0x15, r24 ; 21
ee: 0e 94 7b 00 call 0xf6 ; 0xf6 <lcd_write_string> ec: 0e 94 96 00 call 0x12c ; 0x12c <lcd_strobe_lcd_e>
f2: cf 91 pop r28 f0: 82 e0 ldi r24, 0x02 ; 2
f4: 08 95 ret f2: 0e 94 bf 00 call 0x17e ; 0x17e <lcd_write_command>
f6: 0e 94 96 00 call 0x12c ; 0x12c <lcd_strobe_lcd_e>
fa: cf 91 pop r28
fc: 08 95 ret
Disassembly of section .text.lcd_write_string:
000000fe <lcd_write_string>:
fe: cf 92 push r12
100: df 92 push r13
102: ef 92 push r14
104: 6b 01 movw r12, r22
106: e8 2e mov r14, r24
108: 07 c0 rjmp .+14 ; 0x118 <lcd_write_string+0x1a>
10a: 86 2f mov r24, r22
10c: 0e 94 ab 00 call 0x156 ; 0x156 <lcd_write_character>
110: 8f ef ldi r24, 0xFF ; 255
112: c8 1a sub r12, r24
114: d8 0a sbc r13, r24
116: e8 0a sbc r14, r24
118: f6 01 movw r30, r12
11a: 5e 2d mov r21, r14
11c: 0e 94 07 01 call 0x20e ; 0x20e <__xload_1>
120: 61 11 cpse r22, r1
122: f3 cf rjmp .-26 ; 0x10a <lcd_write_string+0xc>
124: ef 90 pop r14
126: df 90 pop r13
128: cf 90 pop r12
12a: 08 95 ret
Disassembly of section .text.main: Disassembly of section .text.main:
000001b2 <main>: 000001a6 <main>:
void lcd_add_character(unsigned char byte); 1a6: 0e 94 57 00 call 0xae ; 0xae <init_4bits_mode>
void lcd_add_command(unsigned char byte); 1aa: 87 ea ldi r24, 0xA7 ; 167
1ac: 91 e6 ldi r25, 0x61 ; 97
int main(void) 1ae: 01 97 sbiw r24, 0x01 ; 1
{ 1b0: f1 f7 brne .-4 ; 0x1ae <main+0x8>
init_4bits_mode(); 1b2: 00 c0 rjmp .+0 ; 0x1b4 <main+0xe>
1b2: 0e 94 57 00 call 0xae ; 0xae <init_4bits_mode> 1b4: 00 00 nop
1b6: ff cf rjmp .-2 ; 0x1b6 <main+0x4> 1b6: 0e 94 e3 00 call 0x1c6 ; 0x1c6 <lcd_clear>
1ba: 64 ea ldi r22, 0xA4 ; 164
1bc: 70 e0 ldi r23, 0x00 ; 0
1be: 80 e0 ldi r24, 0x00 ; 0
1c0: 0e 94 7f 00 call 0xfe ; 0xfe <lcd_write_string>
1c4: ff cf rjmp .-2 ; 0x1c4 <main+0x1e>
Disassembly of section .text.libgcc: Disassembly of section .text.libgcc:
000001a4 <__xload_1>: 0000020e <__xload_1>:
1a4: 57 fd sbrc r21, 7 20e: 57 fd sbrc r21, 7
1a6: 03 c0 rjmp .+6 ; 0x1ae <__xload_1+0xa> 210: 03 c0 rjmp .+6 ; 0x218 <__xload_1+0xa>
1a8: 5b bf out 0x3b, r21 ; 59 212: 5b bf out 0x3b, r21 ; 59
1aa: 67 91 elpm r22, Z+ 214: 67 91 elpm r22, Z+
1ac: 08 95 ret 216: 08 95 ret
1ae: 60 81 ld r22, Z 218: 60 81 ld r22, Z
1b0: 08 95 ret 21a: 08 95 ret

View File

@@ -12,23 +12,32 @@
#include <util/delay.h> #include <util/delay.h>
#include <avr/interrupt.h> #include <avr/interrupt.h>
#define LCD_E 3 #define LCD_E 6
#define LCD_RS 2 #define LCD_RS 4
void _delay_ms(double __ms); void _delay_ms(double __ms);
void lcd_strobe_lcd_e(void); void lcd_strobe_lcd_e(void);
void sbi_portc(int index); void sbi_portc(int index);
void cbi_portc(int index); void cbi_portc(int index);
void sbi_porta(int index);
void cbi_porta(int index);
void init_4bits_mode(void); void init_4bits_mode(void);
void lcd_write_string(const char *str); void lcd_write_string(const char *str);
void lcd_add_character(unsigned char byte); void lcd_write_character(unsigned char byte);
void lcd_add_command(unsigned char byte); void lcd_write_command(unsigned char byte);
void lcd_clear();
int main(void) int main(void)
{ {
init_4bits_mode(); init_4bits_mode();
_delay_ms(10);
lcd_clear();
lcd_write_string("Pintebaas");
while(1) while(1)
{ {
@@ -37,26 +46,51 @@ int main(void)
} }
} }
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) { void lcd_strobe_lcd_e(void) {
sbi_portc(LCD_E); // E high
sbi_porta(LCD_E); // E high
_delay_ms(1); _delay_ms(1);
cbi_portc(LCD_E); // E low cbi_porta(LCD_E); // E low
_delay_ms(1); _delay_ms(1);
} }
void sbi_portc(int index){ void sbi_portc(int index){
PORTC |= (1<<index); PORTC |= (1<<index);
} }
void cbi_portc(int index){ void cbi_portc(int index){
PORTC &= ~(1<<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) { void init_4bits_mode(void) {
// PORTC output mode and all low (also E and RS pin) // PORTC output mode and all low (also E and RS pin)
DDRC = 0xFF;
// Init I/O
DDRC = 0xFF; // PORTD(7) output, PORTD(6:0) input
PORTC = 0xFF;
DDRD = 0xFF;
DDRA = 0xFF;
PORTC = 0x00; PORTC = 0x00;
PORTA = 0x00;
PORTC = 0x20; // function for 4-bit 1 row PORTC = 0x20; // function for 4-bit 1 row
lcd_strobe_lcd_e(); lcd_strobe_lcd_e();
@@ -76,43 +110,48 @@ void init_4bits_mode(void) {
PORTC = 0x60; // Entry mode set low nibble PORTC = 0x60; // Entry mode set low nibble
lcd_strobe_lcd_e(); lcd_strobe_lcd_e();
lcd_write_string("Pintebaas"); // return home
lcd_write_command(0x02);
lcd_strobe_lcd_e();
} }
void lcd_add_character(unsigned char byte){ void lcd_write_character(unsigned char byte){
//upper nibble //upper nibble
PORTC = byte; PORTC = byte;
sbi_portc(LCD_RS); sbi_porta(LCD_RS);
lcd_strobe_lcd_e(); lcd_strobe_lcd_e();
//lower nibble //lower nibble
PORTC = (byte<<4); PORTC = (byte<<4);
sbi_portc(LCD_RS); sbi_porta(LCD_RS);
lcd_strobe_lcd_e(); lcd_strobe_lcd_e();
} }
void lcd_add_command(unsigned char byte){ void lcd_write_command(unsigned char byte){
//upper nibble //upper nibble
PORTC = byte; PORTC = byte;
cbi_portc(LCD_RS); cbi_porta(LCD_RS);
lcd_strobe_lcd_e(); lcd_strobe_lcd_e();
//lower nibble //lower nibble
PORTC = (byte<<4); PORTC = (byte<<4);
cbi_portc(LCD_RS); cbi_porta(LCD_RS);
lcd_strobe_lcd_e(); lcd_strobe_lcd_e();
} }
void lcd_write_string(const char *str) { void lcd_write_string(const char *str) {
for(;*str; str++){ for(;*str; str++){
lcd_add_character(*str); lcd_write_character(*str);
} }
} }
void lcd_move_right(void){ void lcd_move_right(void){
lcd_add_command(0x1E); lcd_write_command(0x1E);
} }