opdracht 2.5 probeersel

This commit is contained in:
Guilliam Lutz
2021-02-11 23:58:48 +01:00
parent 4fbfd5bac6
commit c6a652d2be
15 changed files with 611 additions and 589 deletions

View File

@@ -55,10 +55,10 @@ Global
{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.Build.0 = Release|AVR
{9154C165-89AB-43CF-8C28-23147BC26FDC}.Debug|AVR.ActiveCfg = Debug|AVR
{9154C165-89AB-43CF-8C28-23147BC26FDC}.Debug|AVR.Build.0 = Debug|AVR
{9154C165-89AB-43CF-8C28-23147BC26FDC}.Release|AVR.ActiveCfg = Release|AVR
{9154C165-89AB-43CF-8C28-23147BC26FDC}.Release|AVR.Build.0 = Release|AVR
{E0046CE4-D6F8-435F-9C6E-72E6EB89CCB3}.Debug|AVR.ActiveCfg = Debug|AVR
{E0046CE4-D6F8-435F-9C6E-72E6EB89CCB3}.Debug|AVR.Build.0 = Debug|AVR
{E0046CE4-D6F8-435F-9C6E-72E6EB89CCB3}.Release|AVR.ActiveCfg = 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.Build.0 = Debug|AVR
{C81B68AA-F4BB-4A5D-81F8-2737DCD1D4A7}.Release|AVR.ActiveCfg = Release|AVR

View File

@@ -1,242 +0,0 @@
Opdracht 2.2.elf: file format elf32-avr
Sections:
Idx Name Size VMA LMA File off Algn
0 .data 00000000 00800100 00800100 00000192 2**0
ALLOC, LOAD, DATA
1 .text 000000a4 00000000 00000000 00000054 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .comment 0000002f 00000000 00000000 00000192 2**0
CONTENTS, READONLY
3 .debug_aranges 00000038 00000000 00000000 000001c1 2**0
CONTENTS, READONLY, DEBUGGING
4 .debug_info 00000b2a 00000000 00000000 000001f9 2**0
CONTENTS, READONLY, DEBUGGING
5 .debug_abbrev 00000830 00000000 00000000 00000d23 2**0
CONTENTS, READONLY, DEBUGGING
6 .debug_line 000002e4 00000000 00000000 00001553 2**0
CONTENTS, READONLY, DEBUGGING
7 .debug_frame 00000074 00000000 00000000 00001838 2**2
CONTENTS, READONLY, DEBUGGING
8 .debug_str 0000027d 00000000 00000000 000018ac 2**0
CONTENTS, READONLY, DEBUGGING
9 .debug_loc 000000e2 00000000 00000000 00001b29 2**0
CONTENTS, READONLY, DEBUGGING
10 .debug_ranges 00000028 00000000 00000000 00001c0b 2**0
CONTENTS, READONLY, DEBUGGING
11 .text 00000004 0000013a 0000013a 0000018e 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
12 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 00001c34 2**2
CONTENTS, READONLY, DEBUGGING
13 .text.wait 0000001e 0000011c 0000011c 00000170 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
14 .text.__vector_2 00000028 000000a4 000000a4 000000f8 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
15 .text.__vector_3 00000028 000000cc 000000cc 00000120 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
16 .text.main 00000028 000000f4 000000f4 00000148 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 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
8: 0c 94 52 00 jmp 0xa4 ; 0xa4 <_etext>
c: 0c 94 66 00 jmp 0xcc ; 0xcc <__vector_3>
10: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
14: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
18: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
1c: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
20: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
24: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
28: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
2c: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
30: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
34: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
38: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
3c: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
40: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
44: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
48: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
4c: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
50: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
54: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
58: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
5c: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
60: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
64: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
68: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
6c: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
70: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
74: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
78: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
7c: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
80: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
84: 0c 94 9d 00 jmp 0x13a ; 0x13a <__bad_interrupt>
88: 0c 94 9d 00 jmp 0x13a ; 0x13a <__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 7a 00 call 0xf4 ; 0xf4 <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:
0000013a <__bad_interrupt>:
13a: 0c 94 00 00 jmp 0 ; 0x0 <__TEXT_REGION_ORIGIN__>
Disassembly of section .text.wait:
0000011c <wait>:
#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
void wait( int ms ) {
for (int i=0; i<ms; i++) {
11c: 20 e0 ldi r18, 0x00 ; 0
11e: 30 e0 ldi r19, 0x00 ; 0
120: 08 c0 rjmp .+16 ; 0x132 <wait+0x16>
#else
//round up by default
__ticks_dc = (uint32_t)(ceil(fabs(__tmp)));
#endif
__builtin_avr_delay_cycles(__ticks_dc);
122: e3 ec ldi r30, 0xC3 ; 195
124: f9 e0 ldi r31, 0x09 ; 9
126: 31 97 sbiw r30, 0x01 ; 1
128: f1 f7 brne .-4 ; 0x126 <wait+0xa>
12a: 00 c0 rjmp .+0 ; 0x12c <wait+0x10>
12c: 00 00 nop
12e: 2f 5f subi r18, 0xFF ; 255
130: 3f 4f sbci r19, 0xFF ; 255
132: 28 17 cp r18, r24
134: 39 07 cpc r19, r25
136: ac f3 brlt .-22 ; 0x122 <wait+0x6>
_delay_ms( 1 ); // library function (max 30 ms at 8MHz)
}
}
138: 08 95 ret
Disassembly of section .text.__vector_2:
000000a4 <__vector_2>:
ISR( INT1_vect ) {
a4: 1f 92 push r1
a6: 0f 92 push r0
a8: 0f b6 in r0, 0x3f ; 63
aa: 0f 92 push r0
ac: 11 24 eor r1, r1
ae: 8f 93 push r24
if (PORTC == 0b10000000)
b0: 85 b3 in r24, 0x15 ; 21
b2: 80 38 cpi r24, 0x80 ; 128
b4: 11 f4 brne .+4 ; 0xba <__vector_2+0x16>
{
PORTC == 0b00000001;
b6: 85 b3 in r24, 0x15 ; 21
b8: 03 c0 rjmp .+6 ; 0xc0 <__vector_2+0x1c>
} else {
PORTC = PORTC << 1;
ba: 85 b3 in r24, 0x15 ; 21
bc: 88 0f add r24, r24
be: 85 bb out 0x15, r24 ; 21
}
}
c0: 8f 91 pop r24
c2: 0f 90 pop r0
c4: 0f be out 0x3f, r0 ; 63
c6: 0f 90 pop r0
c8: 1f 90 pop r1
ca: 18 95 reti
Disassembly of section .text.__vector_3:
000000cc <__vector_3>:
ISR( INT2_vect ) {
cc: 1f 92 push r1
ce: 0f 92 push r0
d0: 0f b6 in r0, 0x3f ; 63
d2: 0f 92 push r0
d4: 11 24 eor r1, r1
d6: 8f 93 push r24
if (PORTC == 0b00000001)
d8: 85 b3 in r24, 0x15 ; 21
da: 81 30 cpi r24, 0x01 ; 1
dc: 11 f4 brne .+4 ; 0xe2 <__vector_3+0x16>
{
PORTC = 0b10000000;
de: 80 e8 ldi r24, 0x80 ; 128
e0: 85 bb out 0x15, r24 ; 21
}
PORTC = PORTC >> 1;
e2: 85 b3 in r24, 0x15 ; 21
e4: 86 95 lsr r24
e6: 85 bb out 0x15, r24 ; 21
}
e8: 8f 91 pop r24
ea: 0f 90 pop r0
ec: 0f be out 0x3f, r0 ; 63
ee: 0f 90 pop r0
f0: 1f 90 pop r1
f2: 18 95 reti
Disassembly of section .text.main:
000000f4 <main>:
int main(void)
{
/* Replace with your application code */
// Init I/O
DDRD = 0xF0; // PORTD (7:4) is output, (3:0) is input
f4: 80 ef ldi r24, 0xF0 ; 240
f6: 81 bb out 0x11, r24 ; 17
DDRC = 0xFF;
f8: 8f ef ldi r24, 0xFF ; 255
fa: 84 bb out 0x14, r24 ; 20
// Init Interrupt hardware
EICRA |= 0x2C; // INT2 falling edge, INT1 rising edge
fc: ea e6 ldi r30, 0x6A ; 106
fe: f0 e0 ldi r31, 0x00 ; 0
100: 80 81 ld r24, Z
102: 8c 62 ori r24, 0x2C ; 44
104: 80 83 st Z, r24
EIMSK |= 0x06; // Enable INT2 & INT1
106: 89 b7 in r24, 0x39 ; 57
108: 86 60 ori r24, 0x06 ; 6
10a: 89 bf out 0x39, r24 ; 57
PORTC = 0x01;
10c: 81 e0 ldi r24, 0x01 ; 1
10e: 85 bb out 0x15, r24 ; 21
sei();
110: 78 94 sei
while (1)
{
wait(500);
112: 84 ef ldi r24, 0xF4 ; 244
114: 91 e0 ldi r25, 0x01 ; 1
116: 0e 94 8e 00 call 0x11c ; 0x11c <wait>
11a: fb cf rjmp .-10 ; 0x112 <main+0x1e>

View File

@@ -11,7 +11,6 @@ Idx Name Size VMA LMA File off Algn
CONTENTS, READONLY
3 .debug_aranges 00000028 00000000 00000000 0000017f 2**0
CONTENTS, READONLY, DEBUGGING
<<<<<<< HEAD
4 .debug_info 00000b4d 00000000 00000000 000001a7 2**0
CONTENTS, READONLY, DEBUGGING
5 .debug_abbrev 00000830 00000000 00000000 00000cf4 2**0
@@ -29,25 +28,6 @@ Idx Name Size VMA LMA File off Algn
11 .text 00000004 000000f8 000000f8 0000014c 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
12 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 00001b28 2**2
=======
4 .debug_info 00000b26 00000000 00000000 000001a7 2**0
CONTENTS, READONLY, DEBUGGING
5 .debug_abbrev 00000830 00000000 00000000 00000ccd 2**0
CONTENTS, READONLY, DEBUGGING
6 .debug_line 000002ae 00000000 00000000 000014fd 2**0
CONTENTS, READONLY, DEBUGGING
7 .debug_frame 00000034 00000000 00000000 000017ac 2**2
CONTENTS, READONLY, DEBUGGING
8 .debug_str 0000027d 00000000 00000000 000017e0 2**0
CONTENTS, READONLY, DEBUGGING
9 .debug_loc 00000089 00000000 00000000 00001a5d 2**0
CONTENTS, READONLY, DEBUGGING
10 .debug_ranges 00000018 00000000 00000000 00001ae6 2**0
CONTENTS, READONLY, DEBUGGING
11 .text 00000004 000000f8 000000f8 0000014c 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
12 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 00001b00 2**2
>>>>>>> main
CONTENTS, READONLY, DEBUGGING
13 .text.wait 0000001e 000000da 000000da 0000012e 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
@@ -112,11 +92,7 @@ Disassembly of section .text:
Disassembly of section .text:
000000f8 <__bad_interrupt>:
<<<<<<< HEAD
f8: 0c 94 00 00 jmp 0 ; 0x0 <__vectors>
=======
f8: 0c 94 00 00 jmp 0 ; 0x0 <__TEXT_REGION_ORIGIN__>
>>>>>>> main
Disassembly of section .text.wait:

View File

@@ -11,7 +11,6 @@ Idx Name Size VMA LMA File off Algn
CONTENTS, READONLY
3 .debug_aranges 00000020 00000000 00000000 0000012d 2**0
CONTENTS, READONLY, DEBUGGING
<<<<<<< HEAD
4 .debug_info 000009fe 00000000 00000000 0000014d 2**0
CONTENTS, READONLY, DEBUGGING
5 .debug_abbrev 00000756 00000000 00000000 00000b4b 2**0
@@ -27,23 +26,6 @@ Idx Name Size VMA LMA File off Algn
10 .text 00000004 000000a4 000000a4 000000f8 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
11 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 000016fc 2**2
=======
4 .debug_info 000009d7 00000000 00000000 0000014d 2**0
CONTENTS, READONLY, DEBUGGING
5 .debug_abbrev 00000756 00000000 00000000 00000b24 2**0
CONTENTS, READONLY, DEBUGGING
6 .debug_line 000001a6 00000000 00000000 0000127a 2**0
CONTENTS, READONLY, DEBUGGING
7 .debug_frame 00000024 00000000 00000000 00001420 2**2
CONTENTS, READONLY, DEBUGGING
8 .debug_str 0000027d 00000000 00000000 00001444 2**0
CONTENTS, READONLY, DEBUGGING
9 .debug_ranges 00000010 00000000 00000000 000016c1 2**0
CONTENTS, READONLY, DEBUGGING
10 .text 00000004 000000a4 000000a4 000000f8 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
11 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 000016d4 2**2
>>>>>>> main
CONTENTS, READONLY, DEBUGGING
12 .text.main 00000002 000000a8 000000a8 000000fc 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
@@ -106,11 +88,7 @@ Disassembly of section .text:
Disassembly of section .text:
000000a4 <__bad_interrupt>:
<<<<<<< HEAD
a4: 0c 94 00 00 jmp 0 ; 0x0 <__TEXT_REGION_ORIGIN__>
=======
a4: 0c 94 00 00 jmp 0 ; 0x0 <__vectors>
>>>>>>> main
Disassembly of section .text.main:

View File

@@ -11,7 +11,6 @@ Idx Name Size VMA LMA File off Algn
CONTENTS, READONLY
3 .debug_aranges 00000050 00000000 00000000 000001eb 2**0
CONTENTS, READONLY, DEBUGGING
<<<<<<< HEAD
4 .debug_info 00000cfe 00000000 00000000 0000023b 2**0
CONTENTS, READONLY, DEBUGGING
5 .debug_abbrev 000008c5 00000000 00000000 00000f39 2**0
@@ -29,25 +28,6 @@ Idx Name Size VMA LMA File off Algn
11 .text 00000004 00000164 00000164 000001b8 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
12 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 00002098 2**2
=======
4 .debug_info 00000cd7 00000000 00000000 0000023b 2**0
CONTENTS, READONLY, DEBUGGING
5 .debug_abbrev 000008c5 00000000 00000000 00000f12 2**0
CONTENTS, READONLY, DEBUGGING
6 .debug_line 0000036f 00000000 00000000 000017d7 2**0
CONTENTS, READONLY, DEBUGGING
7 .debug_frame 0000008c 00000000 00000000 00001b48 2**2
CONTENTS, READONLY, DEBUGGING
8 .debug_str 0000027d 00000000 00000000 00001bd4 2**0
CONTENTS, READONLY, DEBUGGING
9 .debug_loc 000001dc 00000000 00000000 00001e51 2**0
CONTENTS, READONLY, DEBUGGING
10 .debug_ranges 00000040 00000000 00000000 0000202d 2**0
CONTENTS, READONLY, DEBUGGING
11 .text 00000004 00000164 00000164 000001b8 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
12 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 00002070 2**2
>>>>>>> main
CONTENTS, READONLY, DEBUGGING
13 .text.wait 0000001e 0000010e 0000010e 00000162 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
@@ -118,11 +98,7 @@ Disassembly of section .text:
Disassembly of section .text:
00000164 <__bad_interrupt>:
<<<<<<< HEAD
164: 0c 94 00 00 jmp 0 ; 0x0 <__vectors>
=======
164: 0c 94 00 00 jmp 0 ; 0x0 <__TEXT_REGION_ORIGIN__>
>>>>>>> main
Disassembly of section .text.wait:

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<executable name="opdracht 1.7a.elf">
<memory name="program">
<units>bytes</units>
<length>131072</length>
<used>168</used>
<free>130904</free>
</memory>
<memory name="data">
<units>bytes</units>
<length>4096</length>
<used>0</used>
<free>4096</free>
</memory>
</executable>
</project>

View File

@@ -1 +0,0 @@
:00000001FF

View File

@@ -1,227 +0,0 @@
opdracht 2.1.elf: file format elf32-avr
Sections:
Idx Name Size VMA LMA File off Algn
0 .data 00000000 00800100 00800100 0000017c 2**0
ALLOC, LOAD, DATA
1 .text 000000a4 00000000 00000000 00000054 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .comment 0000002f 00000000 00000000 0000017c 2**0
CONTENTS, READONLY
3 .debug_aranges 00000038 00000000 00000000 000001ab 2**0
CONTENTS, READONLY, DEBUGGING
4 .debug_info 00000b2a 00000000 00000000 000001e3 2**0
CONTENTS, READONLY, DEBUGGING
5 .debug_abbrev 00000830 00000000 00000000 00000d0d 2**0
CONTENTS, READONLY, DEBUGGING
6 .debug_line 000002cb 00000000 00000000 0000153d 2**0
CONTENTS, READONLY, DEBUGGING
7 .debug_frame 00000074 00000000 00000000 00001808 2**2
CONTENTS, READONLY, DEBUGGING
8 .debug_str 0000027d 00000000 00000000 0000187c 2**0
CONTENTS, READONLY, DEBUGGING
9 .debug_loc 000000e2 00000000 00000000 00001af9 2**0
CONTENTS, READONLY, DEBUGGING
10 .debug_ranges 00000028 00000000 00000000 00001bdb 2**0
CONTENTS, READONLY, DEBUGGING
11 .text 00000004 00000124 00000124 00000178 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
12 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 00001c04 2**2
CONTENTS, READONLY, DEBUGGING
13 .text.wait 0000001e 000000ca 000000ca 0000011e 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
14 .text.__vector_1 0000001e 000000e8 000000e8 0000013c 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
15 .text.__vector_2 0000001e 00000106 00000106 0000015a 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
16 .text.main 00000026 000000a4 000000a4 000000f8 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 74 00 jmp 0xe8 ; 0xe8 <__vector_1>
8: 0c 94 83 00 jmp 0x106 ; 0x106 <__vector_2>
c: 0c 94 92 00 jmp 0x124 ; 0x124 <__bad_interrupt>
10: 0c 94 92 00 jmp 0x124 ; 0x124 <__bad_interrupt>
14: 0c 94 92 00 jmp 0x124 ; 0x124 <__bad_interrupt>
18: 0c 94 92 00 jmp 0x124 ; 0x124 <__bad_interrupt>
1c: 0c 94 92 00 jmp 0x124 ; 0x124 <__bad_interrupt>
20: 0c 94 92 00 jmp 0x124 ; 0x124 <__bad_interrupt>
24: 0c 94 92 00 jmp 0x124 ; 0x124 <__bad_interrupt>
28: 0c 94 92 00 jmp 0x124 ; 0x124 <__bad_interrupt>
2c: 0c 94 92 00 jmp 0x124 ; 0x124 <__bad_interrupt>
30: 0c 94 92 00 jmp 0x124 ; 0x124 <__bad_interrupt>
34: 0c 94 92 00 jmp 0x124 ; 0x124 <__bad_interrupt>
38: 0c 94 92 00 jmp 0x124 ; 0x124 <__bad_interrupt>
3c: 0c 94 92 00 jmp 0x124 ; 0x124 <__bad_interrupt>
40: 0c 94 92 00 jmp 0x124 ; 0x124 <__bad_interrupt>
44: 0c 94 92 00 jmp 0x124 ; 0x124 <__bad_interrupt>
48: 0c 94 92 00 jmp 0x124 ; 0x124 <__bad_interrupt>
4c: 0c 94 92 00 jmp 0x124 ; 0x124 <__bad_interrupt>
50: 0c 94 92 00 jmp 0x124 ; 0x124 <__bad_interrupt>
54: 0c 94 92 00 jmp 0x124 ; 0x124 <__bad_interrupt>
58: 0c 94 92 00 jmp 0x124 ; 0x124 <__bad_interrupt>
5c: 0c 94 92 00 jmp 0x124 ; 0x124 <__bad_interrupt>
60: 0c 94 92 00 jmp 0x124 ; 0x124 <__bad_interrupt>
64: 0c 94 92 00 jmp 0x124 ; 0x124 <__bad_interrupt>
68: 0c 94 92 00 jmp 0x124 ; 0x124 <__bad_interrupt>
6c: 0c 94 92 00 jmp 0x124 ; 0x124 <__bad_interrupt>
70: 0c 94 92 00 jmp 0x124 ; 0x124 <__bad_interrupt>
74: 0c 94 92 00 jmp 0x124 ; 0x124 <__bad_interrupt>
78: 0c 94 92 00 jmp 0x124 ; 0x124 <__bad_interrupt>
7c: 0c 94 92 00 jmp 0x124 ; 0x124 <__bad_interrupt>
80: 0c 94 92 00 jmp 0x124 ; 0x124 <__bad_interrupt>
84: 0c 94 92 00 jmp 0x124 ; 0x124 <__bad_interrupt>
88: 0c 94 92 00 jmp 0x124 ; 0x124 <__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 52 00 call 0xa4 ; 0xa4 <_etext>
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:
00000124 <__bad_interrupt>:
124: 0c 94 00 00 jmp 0 ; 0x0 <__TEXT_REGION_ORIGIN__>
Disassembly of section .text.wait:
000000ca <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++) {
ca: 20 e0 ldi r18, 0x00 ; 0
cc: 30 e0 ldi r19, 0x00 ; 0
ce: 08 c0 rjmp .+16 ; 0xe0 <wait+0x16>
#else
//round up by default
__ticks_dc = (uint32_t)(ceil(fabs(__tmp)));
#endif
__builtin_avr_delay_cycles(__ticks_dc);
d0: ef ec ldi r30, 0xCF ; 207
d2: f7 e0 ldi r31, 0x07 ; 7
d4: 31 97 sbiw r30, 0x01 ; 1
d6: f1 f7 brne .-4 ; 0xd4 <wait+0xa>
d8: 00 c0 rjmp .+0 ; 0xda <wait+0x10>
da: 00 00 nop
dc: 2f 5f subi r18, 0xFF ; 255
de: 3f 4f sbci r19, 0xFF ; 255
e0: 28 17 cp r18, r24
e2: 39 07 cpc r19, r25
e4: ac f3 brlt .-22 ; 0xd0 <wait+0x6>
_delay_ms( 1 ); // library function (max 30 ms at 8MHz)
}
}
e6: 08 95 ret
Disassembly of section .text.__vector_1:
000000e8 <__vector_1>:
inputs:
outputs:
notes: Set PORTD.5
Version : DMK, Initial code
*******************************************************************/
ISR( INT0_vect ) {
e8: 1f 92 push r1
ea: 0f 92 push r0
ec: 0f b6 in r0, 0x3f ; 63
ee: 0f 92 push r0
f0: 11 24 eor r1, r1
f2: 8f 93 push r24
PORTD |= (1<<5);
f4: 82 b3 in r24, 0x12 ; 18
f6: 80 62 ori r24, 0x20 ; 32
f8: 82 bb out 0x12, r24 ; 18
}
fa: 8f 91 pop r24
fc: 0f 90 pop r0
fe: 0f be out 0x3f, r0 ; 63
100: 0f 90 pop r0
102: 1f 90 pop r1
104: 18 95 reti
Disassembly of section .text.__vector_2:
00000106 <__vector_2>:
inputs:
outputs:
notes: Clear PORTD.5
Version : DMK, Initial code
*******************************************************************/
ISR( INT1_vect ) {
106: 1f 92 push r1
108: 0f 92 push r0
10a: 0f b6 in r0, 0x3f ; 63
10c: 0f 92 push r0
10e: 11 24 eor r1, r1
110: 8f 93 push r24
PORTD &= ~(1<<5);
112: 82 b3 in r24, 0x12 ; 18
114: 8f 7d andi r24, 0xDF ; 223
116: 82 bb out 0x12, r24 ; 18
}
118: 8f 91 pop r24
11a: 0f 90 pop r0
11c: 0f be out 0x3f, r0 ; 63
11e: 0f 90 pop r0
120: 1f 90 pop r1
122: 18 95 reti
Disassembly of section .text.main:
000000a4 <main>:
notes: Slow background task after init ISR
Version : DMK, Initial code
*******************************************************************/
int main( void ) {
// Init I/O
DDRD = 0xF0; // PORTD(7:4) output, PORTD(3:0) input
a4: 80 ef ldi r24, 0xF0 ; 240
a6: 81 bb out 0x11, r24 ; 17
// Init Interrupt hardware
EICRA |= 0x0B; // INT1 falling edge, INT0 rising edge
a8: ea e6 ldi r30, 0x6A ; 106
aa: f0 e0 ldi r31, 0x00 ; 0
ac: 80 81 ld r24, Z
ae: 8b 60 ori r24, 0x0B ; 11
b0: 80 83 st Z, r24
EIMSK |= 0x03; // Enable INT1 & INT0
b2: 89 b7 in r24, 0x39 ; 57
b4: 83 60 ori r24, 0x03 ; 3
b6: 89 bf out 0x39, r24 ; 57
// Enable global interrupt system
//SREG = 0x80; // Of direct via SREG of via wrapper
sei();
b8: 78 94 sei
while (1) {
PORTD ^= (1<<7); // Toggle PORTD.7
ba: 82 b3 in r24, 0x12 ; 18
bc: 80 58 subi r24, 0x80 ; 128
be: 82 bb out 0x12, r24 ; 18
wait( 500 );
c0: 84 ef ldi r24, 0xF4 ; 244
c2: 91 e0 ldi r25, 0x01 ; 1
c4: 0e 94 65 00 call 0xca ; 0xca <wait>
c8: f8 cf rjmp .-16 ; 0xba <main+0x16>

View File

@@ -28,54 +28,66 @@
<ResetRule>0</ResetRule>
<eraseonlaunchrule>0</eraseonlaunchrule>
<EraseKey />
<AsfFrameworkConfig>
<framework-data xmlns="">
<options />
<configurations />
<files />
<documentation help="" />
<offline-documentation help="" />
<dependencies>
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.49.1" />
</dependencies>
</framework-data>
</AsfFrameworkConfig>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<ToolchainSettings>
<com.microchip.xc8>
<com.microchip.xc8.common.optimization.RelaxBranches>True</com.microchip.xc8.common.optimization.RelaxBranches>
<com.microchip.xc8.compiler.general.ChangeDefaultCharTypeUnsigned>True</com.microchip.xc8.compiler.general.ChangeDefaultCharTypeUnsigned>
<com.microchip.xc8.compiler.general.ChangeDefaultBitFieldUnsigned>True</com.microchip.xc8.compiler.general.ChangeDefaultBitFieldUnsigned>
<com.microchip.xc8.compiler.symbols.DefSymbols>
<ListValues>
<Value>(%24DeviceMacro)</Value>
<Value>NDEBUG</Value>
</ListValues>
</com.microchip.xc8.compiler.symbols.DefSymbols>
<com.microchip.xc8.compiler.optimization.level>Optimize for size (-Os)</com.microchip.xc8.compiler.optimization.level>
<com.microchip.xc8.compiler.optimization.PackStructureMembers>True</com.microchip.xc8.compiler.optimization.PackStructureMembers>
<com.microchip.xc8.compiler.optimization.AllocateBytesNeededForEnum>True</com.microchip.xc8.compiler.optimization.AllocateBytesNeededForEnum>
<com.microchip.xc8.compiler.warnings.AllWarnings>True</com.microchip.xc8.compiler.warnings.AllWarnings>
<com.microchip.xc8.linker.libraries.Libraries>
<ListValues>
<Value>libm</Value>
</ListValues>
</com.microchip.xc8.linker.libraries.Libraries>
</com.microchip.xc8>
<com.microchip.xc8.common.optimization.RelaxBranches>True</com.microchip.xc8.common.optimization.RelaxBranches>
<com.microchip.xc8.compiler.general.ChangeDefaultCharTypeUnsigned>True</com.microchip.xc8.compiler.general.ChangeDefaultCharTypeUnsigned>
<com.microchip.xc8.compiler.general.ChangeDefaultBitFieldUnsigned>True</com.microchip.xc8.compiler.general.ChangeDefaultBitFieldUnsigned>
<com.microchip.xc8.compiler.symbols.DefSymbols>
<ListValues>
<Value>(%24DeviceMacro)</Value>
<Value>NDEBUG</Value>
</ListValues>
</com.microchip.xc8.compiler.symbols.DefSymbols>
<com.microchip.xc8.compiler.optimization.level>Optimize for size (-Os)</com.microchip.xc8.compiler.optimization.level>
<com.microchip.xc8.compiler.optimization.PackStructureMembers>True</com.microchip.xc8.compiler.optimization.PackStructureMembers>
<com.microchip.xc8.compiler.optimization.AllocateBytesNeededForEnum>True</com.microchip.xc8.compiler.optimization.AllocateBytesNeededForEnum>
<com.microchip.xc8.compiler.warnings.AllWarnings>True</com.microchip.xc8.compiler.warnings.AllWarnings>
<com.microchip.xc8.linker.libraries.Libraries>
<ListValues>
<Value>libm</Value>
</ListValues>
</com.microchip.xc8.linker.libraries.Libraries>
</com.microchip.xc8>
</ToolchainSettings>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<ToolchainSettings>
<com.microchip.xc8>
<com.microchip.xc8.compiler.general.ChangeDefaultCharTypeUnsigned>True</com.microchip.xc8.compiler.general.ChangeDefaultCharTypeUnsigned>
<com.microchip.xc8.compiler.general.ChangeDefaultBitFieldUnsigned>True</com.microchip.xc8.compiler.general.ChangeDefaultBitFieldUnsigned>
<com.microchip.xc8.compiler.symbols.DefSymbols>
<ListValues>
<Value>(%24DeviceMacro)</Value>
<Value>DEBUG</Value>
</ListValues>
</com.microchip.xc8.compiler.symbols.DefSymbols>
<com.microchip.xc8.compiler.optimization.level>Optimize debugging experience (-Og)</com.microchip.xc8.compiler.optimization.level>
<com.microchip.xc8.compiler.optimization.PackStructureMembers>True</com.microchip.xc8.compiler.optimization.PackStructureMembers>
<com.microchip.xc8.compiler.optimization.AllocateBytesNeededForEnum>True</com.microchip.xc8.compiler.optimization.AllocateBytesNeededForEnum>
<com.microchip.xc8.compiler.optimization.DebugLevel>Default (-g2)</com.microchip.xc8.compiler.optimization.DebugLevel>
<com.microchip.xc8.compiler.warnings.AllWarnings>True</com.microchip.xc8.compiler.warnings.AllWarnings>
<com.microchip.xc8.linker.libraries.Libraries>
<ListValues>
<Value>libm</Value>
</ListValues>
</com.microchip.xc8.linker.libraries.Libraries>
<com.microchip.xc8.assembler.debugging.DebugLevel>Default (-Wa,-g)</com.microchip.xc8.assembler.debugging.DebugLevel>
</com.microchip.xc8>
<com.microchip.xc8.compiler.general.ChangeDefaultCharTypeUnsigned>True</com.microchip.xc8.compiler.general.ChangeDefaultCharTypeUnsigned>
<com.microchip.xc8.compiler.general.ChangeDefaultBitFieldUnsigned>True</com.microchip.xc8.compiler.general.ChangeDefaultBitFieldUnsigned>
<com.microchip.xc8.compiler.symbols.DefSymbols>
<ListValues>
<Value>(%24DeviceMacro)</Value>
<Value>DEBUG</Value>
</ListValues>
</com.microchip.xc8.compiler.symbols.DefSymbols>
<com.microchip.xc8.compiler.optimization.level>Optimize debugging experience (-Og)</com.microchip.xc8.compiler.optimization.level>
<com.microchip.xc8.compiler.optimization.PackStructureMembers>True</com.microchip.xc8.compiler.optimization.PackStructureMembers>
<com.microchip.xc8.compiler.optimization.AllocateBytesNeededForEnum>True</com.microchip.xc8.compiler.optimization.AllocateBytesNeededForEnum>
<com.microchip.xc8.compiler.optimization.DebugLevel>Default (-g2)</com.microchip.xc8.compiler.optimization.DebugLevel>
<com.microchip.xc8.compiler.warnings.AllWarnings>True</com.microchip.xc8.compiler.warnings.AllWarnings>
<com.microchip.xc8.linker.libraries.Libraries>
<ListValues>
<Value>libm</Value>
</ListValues>
</com.microchip.xc8.linker.libraries.Libraries>
<com.microchip.xc8.assembler.debugging.DebugLevel>Default (-Wa,-g)</com.microchip.xc8.assembler.debugging.DebugLevel>
</com.microchip.xc8>
</ToolchainSettings>
</PropertyGroup>
<ItemGroup>

View 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"

View File

@@ -0,0 +1,6 @@
################################################################################
# Automatically-generated file. Do not edit or delete the file
################################################################################
main.c

View 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>

View 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

View File

@@ -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);
}