39 Commits

Author SHA1 Message Date
Sem van der Hoeven
26f0fff87a [ADD] ultrasonic sensor c and h file 2021-03-24 13:24:13 +01:00
Sem van der Hoeven
366e504bf0 [ADD] made driver for ultrasonic sensor 2021-03-24 13:23:54 +01:00
Sem van der Hoeven
fa20a79a22 [FIX] remove weird portd output in lcd 2021-03-24 11:32:03 +01:00
Sem van der Hoeven
956f42b129 [EDIT] port d input isr 2021-03-24 10:35:34 +01:00
Sem van der Hoeven
a8e6900132 interrupt doesn't generate -____- 2021-03-18 20:24:12 +01:00
Sem van der Hoeven
c7aefdc95d interrupt doesn't generate -____- 2021-03-18 20:24:04 +01:00
Sem van der Hoeven
9f96c762fc [ADD] timer, but I don't think it works yet 2021-03-18 20:11:44 +01:00
Sem van der Hoeven
7a3180019e [ADD] interrupt setting enums 2021-03-18 19:32:51 +01:00
Sem van der Hoeven
25da06b589 [ADD] interrupt isr 2021-03-18 19:21:10 +01:00
Sem van der Hoeven
2e07ed8d89 [ADD] explanation in comments 2021-03-17 12:17:27 +01:00
Sem van der Hoeven
c8839a017d [ADD] reading echo in oscilloscope 2021-03-17 12:02:02 +01:00
stijn
547a4f7053 Merge remote-tracking branch 'origin/main' into main 2021-03-10 09:15:34 +01:00
stijn
ab4bf87190 [add] opdracht 4.1 2021-03-10 09:15:31 +01:00
Sem van der Hoeven
3196b86762 finished 4.b1 2021-03-03 11:55:41 +01:00
stijn
f31018f8f1 Merge remote-tracking branch 'origin/main' into main 2021-03-03 11:26:32 +01:00
stijn
5ca12382c4 [add] 4.1 not done yet 2021-03-03 11:26:28 +01:00
Sem van der Hoeven
bd2a5e6091 added start for 4.b1 2021-03-03 11:22:43 +01:00
Sem van der Hoeven
4d57eddb8f [EDIT] fix 3.2 2021-03-03 09:44:08 +01:00
stijn
06e9ab9260 Auto stash before merge of "main" and "origin/main" 2021-03-03 09:20:17 +01:00
Sem van der Hoeven
0a1a3fd47f added 3.2 2021-02-24 12:50:50 +01:00
Sem van der Hoeven
0625ca1ccb lcd done 2021-02-24 11:50:32 +01:00
Sem van der Hoeven
4a6d4a5728 merge conflicts 2021-02-24 11:20:24 +01:00
Sem van der Hoeven
80909212ad added test lcd project 2021-02-24 11:19:54 +01:00
stijn
12029c15d3 opdracht 3.3 beter 2021-02-24 10:55:26 +01:00
stijn
4904c6afcb opdracht 3.3 2021-02-24 10:32:59 +01:00
Guilliam Lutz
c6a652d2be opdracht 2.5 probeersel 2021-02-11 23:58:48 +01:00
stijn
4fbfd5bac6 Merge remote-tracking branch 'origin/main' into main 2021-02-11 23:03:23 +01:00
stijn
e6b527ccfc [add] opdradcht 2.5 2021-02-11 23:03:01 +01:00
Sem van der Hoeven
f1418a3c8e add comments 2021-02-10 20:24:39 +01:00
Sem van der Hoeven
0c2250f044 remove comment 2021-02-10 20:20:32 +01:00
Sem van der Hoeven
c2b532b8ae added opdr 2.4 2021-02-10 20:17:58 +01:00
Sem van der Hoeven
a26e370acb added opdr 2.4 2021-02-10 20:17:23 +01:00
Guilliam Lutz
b99a4646ec begin 2.5 2021-02-10 17:46:27 +01:00
stijn
093ffec420 fix 2021-02-10 14:11:25 +01:00
stijn
31610eb739 add opdracht 2.3 2021-02-10 12:40:32 +01:00
Sem van der Hoeven
35ce5510a0 added opdracht 2.3 folder 2021-02-10 11:46:53 +01:00
Sem van der Hoeven
9e1445737d Merge branch 'opdr2-B2' into main 2021-02-10 11:36:20 +01:00
stijn
90b0ad4e30 Merge remote-tracking branch 'origin/main' into main 2021-02-10 10:06:08 +01:00
stijn
7673bb3bbf Auto stash before merge of "main" and "origin/main" 2021-02-10 10:06:04 +01:00
92 changed files with 11158 additions and 608 deletions

View File

@@ -17,6 +17,22 @@ Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "opdracht 2.1", "opdracht 2.
EndProject
Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "Opdracht 2.2", "Opdracht 2.2\Opdracht 2.2.cproj", "{7328E66F-4181-4553-9542-DA5CC2A74A4E}"
EndProject
Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "opdracht 2.3", "opdracht 2.3\opdracht 2.3.cproj", "{E0046CE4-D6F8-435F-9C6E-72E6EB89CCB3}"
EndProject
Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "opdracht 2.5", "opdracht 2.5\opdracht 2.5.cproj", "{C81B68AA-F4BB-4A5D-81F8-2737DCD1D4A7}"
EndProject
Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "testlcd", "testlcd\testlcd.cproj", "{B964892D-A92F-44D4-AF99-3ADC61820917}"
EndProject
Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "opdracht 3.2", "opdracht 3.2\opdracht 3.2.cproj", "{EB7415C6-2130-46AD-9842-612C67ADE6D4}"
EndProject
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}"
EndProject
Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "opdracht 4.b1", "opdracht 4.b1\opdracht 4.b1.cproj", "{314FE495-A311-499D-B63E-4B5E7B7F2054}"
EndProject
Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "ultrasonicSensor", "ultrasonicSensor\ultrasonicSensor.cproj", "{26DA64DE-DD48-4718-94B5-81F9EC5D4B33}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|AVR = Debug|AVR
@@ -51,6 +67,38 @@ 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
{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
{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
{EB7415C6-2130-46AD-9842-612C67ADE6D4}.Debug|AVR.ActiveCfg = Debug|AVR
{EB7415C6-2130-46AD-9842-612C67ADE6D4}.Debug|AVR.Build.0 = Debug|AVR
{EB7415C6-2130-46AD-9842-612C67ADE6D4}.Release|AVR.ActiveCfg = Release|AVR
{EB7415C6-2130-46AD-9842-612C67ADE6D4}.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
{314FE495-A311-499D-B63E-4B5E7B7F2054}.Debug|AVR.ActiveCfg = Debug|AVR
{314FE495-A311-499D-B63E-4B5E7B7F2054}.Debug|AVR.Build.0 = Debug|AVR
{314FE495-A311-499D-B63E-4B5E7B7F2054}.Release|AVR.ActiveCfg = Release|AVR
{314FE495-A311-499D-B63E-4B5E7B7F2054}.Release|AVR.Build.0 = Release|AVR
{26DA64DE-DD48-4718-94B5-81F9EC5D4B33}.Debug|AVR.ActiveCfg = Debug|AVR
{26DA64DE-DD48-4718-94B5-81F9EC5D4B33}.Debug|AVR.Build.0 = Debug|AVR
{26DA64DE-DD48-4718-94B5-81F9EC5D4B33}.Release|AVR.ActiveCfg = Release|AVR
{26DA64DE-DD48-4718-94B5-81F9EC5D4B33}.Release|AVR.Build.0 = Release|AVR
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@@ -3,79 +3,77 @@ 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
0 .data 00000000 00800100 00800100 0000016c 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
2 .comment 0000002f 00000000 00000000 0000016c 2**0
CONTENTS, READONLY
3 .debug_aranges 00000038 00000000 00000000 000001c1 2**0
3 .debug_aranges 00000038 00000000 00000000 0000019b 2**0
CONTENTS, READONLY, DEBUGGING
4 .debug_info 00000b2a 00000000 00000000 000001f9 2**0
4 .debug_info 00000b13 00000000 00000000 000001d3 2**0
CONTENTS, READONLY, DEBUGGING
5 .debug_abbrev 00000830 00000000 00000000 00000d23 2**0
5 .debug_abbrev 00000819 00000000 00000000 00000ce6 2**0
CONTENTS, READONLY, DEBUGGING
6 .debug_line 000002e4 00000000 00000000 00001553 2**0
6 .debug_line 000002da 00000000 00000000 000014ff 2**0
CONTENTS, READONLY, DEBUGGING
7 .debug_frame 00000074 00000000 00000000 00001838 2**2
7 .debug_frame 00000074 00000000 00000000 000017dc 2**2
CONTENTS, READONLY, DEBUGGING
8 .debug_str 0000027d 00000000 00000000 000018ac 2**0
8 .debug_str 0000027d 00000000 00000000 00001850 2**0
CONTENTS, READONLY, DEBUGGING
9 .debug_loc 000000e2 00000000 00000000 00001b29 2**0
9 .debug_loc 000000e2 00000000 00000000 00001acd 2**0
CONTENTS, READONLY, DEBUGGING
10 .debug_ranges 00000028 00000000 00000000 00001c0b 2**0
10 .debug_ranges 00000028 00000000 00000000 00001baf 2**0
CONTENTS, READONLY, DEBUGGING
11 .text 00000004 0000013a 0000013a 0000018e 2**1
11 .text 00000004 00000114 00000114 00000168 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
12 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 00001c34 2**2
12 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 00001bd8 2**2
CONTENTS, READONLY, DEBUGGING
13 .text.wait 0000001e 0000011c 0000011c 00000170 2**1
13 .text.__vector_2 00000028 000000a4 000000a4 000000f8 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
14 .text.__vector_2 00000028 000000a4 000000a4 000000f8 2**1
14 .text.__vector_3 00000028 000000cc 000000cc 00000120 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
15 .text.main 00000020 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>
4: 0c 94 8a 00 jmp 0x114 ; 0x114 <__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>
10: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt>
14: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt>
18: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt>
1c: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt>
20: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt>
24: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt>
28: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt>
2c: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt>
30: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt>
34: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt>
38: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt>
3c: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt>
40: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt>
44: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt>
48: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt>
4c: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt>
50: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt>
54: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt>
58: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt>
5c: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt>
60: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt>
64: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt>
68: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt>
6c: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt>
70: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt>
74: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt>
78: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt>
7c: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt>
80: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt>
84: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt>
88: 0c 94 8a 00 jmp 0x114 ; 0x114 <__bad_interrupt>
0000008c <__ctors_end>:
8c: 11 24 eor r1, r1
@@ -95,47 +93,17 @@ Disassembly of section .text:
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
00000114 <__bad_interrupt>:
114: 0c 94 00 00 jmp 0 ; 0x0 <__TEXT_REGION_ORIGIN__>
Disassembly of section .text.__vector_2:
000000a4 <__vector_2>:
}
/************************************************************************/
/* interrupt 1
walk the light 1 down */
/************************************************************************/
ISR( INT1_vect ) {
a4: 1f 92 push r1
a6: 0f 92 push r0
@@ -171,6 +139,10 @@ Disassembly of section .text.__vector_3:
000000cc <__vector_3>:
/************************************************************************/
/* interrupt 2
walk the light 1 up */
/************************************************************************/
ISR( INT2_vect ) {
cc: 1f 92 push r1
ce: 0f 92 push r0
@@ -226,17 +198,10 @@ int main(void)
108: 86 60 ori r24, 0x06 ; 6
10a: 89 bf out 0x39, r24 ; 57
PORTC = 0x01;
PORTC = 0x01; // init the first bit
10c: 81 e0 ldi r24, 0x01 ; 1
10e: 85 bb out 0x15, r24 ; 21
sei();
sei(); // enable input mechanism
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>
112: ff cf rjmp .-2 ; 0x112 <main+0x1e>

View File

@@ -4,8 +4,8 @@
<memory name="program">
<units>bytes</units>
<length>131072</length>
<used>318</used>
<free>130754</free>
<used>280</used>
<free>130792</free>
</memory>
<memory name="data">
<units>bytes</units>

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

@@ -14,7 +14,10 @@ void wait( int ms ) {
_delay_ms( 1 ); // library function (max 30 ms at 8MHz)
}
}
/************************************************************************/
/* interrupt 1
walk the light 1 down */
/************************************************************************/
ISR( INT1_vect ) {
if (PORTC == 0b10000000)
{
@@ -26,6 +29,10 @@ ISR( INT1_vect ) {
}
/************************************************************************/
/* interrupt 2
walk the light 1 up */
/************************************************************************/
ISR( INT2_vect ) {
if (PORTC == 0b00000001)
{
@@ -47,13 +54,15 @@ int main(void)
EICRA |= 0x2C; // INT2 falling edge, INT1 rising edge
EIMSK |= 0x06; // Enable INT2 & INT1
PORTC = 0x01;
PORTC = 0x01; // init the first bit
sei();
sei(); // enable input mechanism
while (1)
{
wait(500);
}
}

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

@@ -20,74 +20,74 @@
<OverrideVtor>false</OverrideVtor>
<CacheFlash>true</CacheFlash>
<ProgFlashFromRam>true</ProgFlashFromRam>
<RamSnippetAddress />
<RamSnippetAddress>0x20000000</RamSnippetAddress>
<UncachedRange />
<preserveEEPROM>true</preserveEEPROM>
<OverrideVtorValue />
<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>
<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,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,104 +1,104 @@
/*
* main.c
*
* Created: 08-Feb-21 10:03:33 AM
* Author: lemms
*/
# define F_CPU 10000000UL
#include <util/delay.h>
#include <xc.h>
typedef enum {
IDLE,
PERPARE_COFFEE_POWDER,
BOIL_WATER,
POUR_COFFEE
} state ;
typedef enum {
false = 0,
true = 1
} bool;
state current_state;
void wait( int ms )
{
for (int i=0; i<ms; i++)
{
_delay_ms( 1 ); // library function (max 30 ms at 8MHz)
}
}
void setPulveriserState(bool state){
// set coffee powder mill on or off;
}
bool checkCoffeePowderLevel(){
// check sensor
return true;
}
void updateScreen(){
// update its display;
if(...){
current_state = PERPARE_COFFEE_POWDER;
}
}
void setBoilerState(bool state){
// set boiler on or off;
}
bool checkWaterTemp(){
// check sensor
return true;
}
long milisPouring;
void setPourPumpState(bool state){
// set pump on or off;
}
int main(void)
{
while(1)
{
switch(state){
case IDLE:
updateScreen();
break;
case PERPARE_COFFEE_POWDER:
bool coffeeLevel = checkCoffeePowderLevel();
setPulveriserState(!coffeeLevel);
if(coffeeLevel){
current_state = BOIL_WATER;
}
break;
case BOIL_WATER:
bool waterTemp = checkWaterTemp();
setBoilerState(!waterTemp);
if(waterTemp){
current_state = POUR_COFFEE;
}
break;
case POUR_COFFEE:
bool shouldPour = !(milisPouring => 2000);
setPourPumpState(shouldPour);
milisPouring++;
if(!shouldPour){
milisPouring = 0;
}
break;
}
wait(1);
}
}
// /*
// * main.c
// *
// * Created: 08-Feb-21 10:03:33 AM
// * Author: lemms
// */
// # define F_CPU 10000000UL
//
// #include <util/delay.h>
// #include <xc.h>
//
// typedef enum {
// IDLE,
// PERPARE_COFFEE_POWDER,
// BOIL_WATER,
// POUR_COFFEE
// } state ;
//
// typedef enum {
// false = 0,
// true = 1
// } bool;
//
// state current_state;
//
// void wait( int ms )
// {
// for (int i=0; i<ms; i++)
// {
// _delay_ms( 1 ); // library function (max 30 ms at 8MHz)
// }
// }
//
// void setPulveriserState(bool state){
// // set coffee powder mill on or off;
// }
//
// bool checkCoffeePowderLevel(){
// // check sensor
// return true;
// }
//
// void updateScreen(){
// // update its display;
// if(...){
// current_state = PERPARE_COFFEE_POWDER;
// }
// }
//
// void setBoilerState(bool state){
// // set boiler on or off;
// }
//
// bool checkWaterTemp(){
// // check sensor
// return true;
// }
//
// long milisPouring;
//
// void setPourPumpState(bool state){
// // set pump on or off;
// }
//
// int main(void)
// {
// while(1)
// {
// switch(state){
// case IDLE:
// updateScreen();
// break;
//
// case PERPARE_COFFEE_POWDER:
// bool coffeeLevel = checkCoffeePowderLevel();
// setPulveriserState(!coffeeLevel);
//
// if(coffeeLevel){
// current_state = BOIL_WATER;
// }
// break;
//
// case BOIL_WATER:
// bool waterTemp = checkWaterTemp();
// setBoilerState(!waterTemp);
// if(waterTemp){
// current_state = POUR_COFFEE;
// }
// break;
//
// case POUR_COFFEE:
// bool shouldPour = !(milisPouring => 2000);
// setPourPumpState(shouldPour);
//
// milisPouring++;
//
// if(!shouldPour){
// milisPouring = 0;
// }
// break;
// }
// wait(1);
// }
// }

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

@@ -14,7 +14,7 @@
** Author: dkroeske@gmail.com
** -------------------------------------------------------------------------*/
#define F_CPU 8e6
#define F_CPU 10e6
#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
@@ -44,18 +44,7 @@ notes: Set PORTD.5
Version : DMK, Initial code
*******************************************************************/
ISR( INT0_vect ) {
PORTD |= (1<<5);
}
/******************************************************************
short: ISR INT1
inputs:
outputs:
notes: Clear PORTD.5
Version : DMK, Initial code
*******************************************************************/
ISR( INT1_vect ) {
PORTD &= ~(1<<5);
PORTC
}
/******************************************************************
@@ -70,7 +59,7 @@ int main( void ) {
DDRD = 0xF0; // PORTD(7:4) output, PORTD(3:0) input
// Init Interrupt hardware
EICRA |= 0x0B; // INT1 falling edge, INT0 rising edge
EICRA |= 0x00000010; // INT0 falling edge
EIMSK |= 0x03; // Enable INT1 & INT0
// Enable global interrupt system
@@ -78,8 +67,7 @@ int main( void ) {
sei();
while (1) {
PORTD ^= (1<<7); // Toggle PORTD.7
wait( 500 );
}
return 1;

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.3.elf
OUTPUT_FILE_PATH_AS_ARGS +="opdracht 2.3.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 -mext=cci -D__ATmega128__ -O0 -ffunction-sections -fdata-sections -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.3.map" -Wl,--start-group -Wl,--end-group -Wl,--gc-sections -O0 -ffunction-sections -fdata-sections --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.3.elf" "opdracht 2.3.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.3.elf" "opdracht 2.3.eep" || exit 0
"C:\Program Files\Microchip\xc8\v2.31\bin\avr-objdump.exe" -h -S "opdracht 2.3.elf" > "opdracht 2.3.lss"
# Other Targets
clean:
-$(RM) $(OBJS_AS_ARGS) $(EXECUTABLES)
-$(RM) $(C_DEPS_AS_ARGS)
rm -rf "opdracht 2.3.elf" "opdracht 2.3.hex" "opdracht 2.3.eep" "opdracht 2.3.map" "opdracht 2.3.usersignatures" "opdracht 2.3.a" "opdracht 2.3.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.3.elf">
<memory name="program">
<units>bytes</units>
<length>131072</length>
<used>769</used>
<free>130303</free>
</memory>
<memory name="data">
<units>bytes</units>
<length>4096</length>
<used>2</used>
<free>4094</free>
</memory>
</executable>
</project>

View File

@@ -0,0 +1,390 @@
opdracht 2.3.elf: file format elf32-avr
Sections:
Idx Name Size VMA LMA File off Algn
0 .data 00000000 00800100 00800100 00000396 2**0
ALLOC, LOAD, DATA
1 .text 000000ea 00000000 00000000 00000094 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .bss 00000002 00800100 00800100 00000396 2**0
ALLOC
3 .comment 0000002f 00000000 00000000 00000396 2**0
CONTENTS, READONLY
4 .debug_info 00000780 00000000 00000000 000003c5 2**0
CONTENTS, READONLY, DEBUGGING
5 .debug_abbrev 00000718 00000000 00000000 00000b45 2**0
CONTENTS, READONLY, DEBUGGING
6 .debug_line 0000016d 00000000 00000000 0000125d 2**0
CONTENTS, READONLY, DEBUGGING
7 .debug_str 0000027d 00000000 00000000 000013ca 2**0
CONTENTS, READONLY, DEBUGGING
8 .text 00000004 000002fe 000002fe 00000392 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
9 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 00001648 2**2
CONTENTS, READONLY, DEBUGGING
10 .text.__vector_1 00000080 000000fa 000000fa 0000018e 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
11 .text.__vector_2 00000080 0000017a 0000017a 0000020e 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
12 .progmemx.data.Characters 0000000f 000000ea 000000ea 0000017e 2**0
CONTENTS, ALLOC, LOAD, READONLY, PROGMEMX
13 .text.initDisplay 0000001a 000002d6 000002d6 0000036a 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
14 .text.setDisplay 00000062 00000274 00000274 00000308 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
15 .text.main 0000007a 000001fa 000001fa 0000028e 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
16 .text.libgcc 0000000e 000002f0 000002f0 00000384 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
Disassembly of section .text:
00000000 <__vectors>:
0: 0c 94 49 00 jmp 0x92 ; 0x92 <__ctors_end>
4: 0c 94 7d 00 jmp 0xfa ; 0xfa <__vector_1>
8: 0c 94 bd 00 jmp 0x17a ; 0x17a <__vector_2>
c: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
10: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
14: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
18: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
1c: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
20: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
24: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
28: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
2c: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
30: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
34: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
38: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
3c: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
40: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
44: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
48: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
4c: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
50: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
54: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
58: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
5c: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
60: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
64: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
68: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
6c: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
70: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
74: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
78: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
7c: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
80: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
84: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
88: 0c 94 7f 01 jmp 0x2fe ; 0x2fe <__bad_interrupt>
0000008c <.dinit>:
8c: 01 00 .word 0x0001 ; ????
8e: 01 02 muls r16, r17
90: 80 00 .word 0x0080 ; ????
00000092 <__ctors_end>:
92: 11 24 eor r1, r1
94: 1f be out 0x3f, r1 ; 63
96: cf ef ldi r28, 0xFF ; 255
98: d0 e1 ldi r29, 0x10 ; 16
9a: de bf out 0x3e, r29 ; 62
9c: cd bf out 0x3d, r28 ; 61
0000009e <__do_copy_data>:
9e: ec e8 ldi r30, 0x8C ; 140
a0: f0 e0 ldi r31, 0x00 ; 0
a2: 40 e0 ldi r20, 0x00 ; 0
a4: 19 c0 rjmp .+50 ; 0xd8 <__do_clear_bss+0x8>
a6: b7 91 elpm r27, Z+
a8: a7 91 elpm r26, Z+
aa: 37 91 elpm r19, Z+
ac: 27 91 elpm r18, Z+
ae: 07 91 elpm r16, Z+
b0: 07 fd sbrc r16, 7
b2: 0e c0 rjmp .+28 ; 0xd0 <__do_clear_bss>
b4: 97 91 elpm r25, Z+
b6: 87 91 elpm r24, Z+
b8: ef 01 movw r28, r30
ba: f9 2f mov r31, r25
bc: e8 2f mov r30, r24
be: 0b bf out 0x3b, r16 ; 59
c0: 07 90 elpm r0, Z+
c2: 0d 92 st X+, r0
c4: a2 17 cp r26, r18
c6: b3 07 cpc r27, r19
c8: d9 f7 brne .-10 ; 0xc0 <__do_copy_data+0x22>
ca: fe 01 movw r30, r28
cc: 1b be out 0x3b, r1 ; 59
ce: 04 c0 rjmp .+8 ; 0xd8 <__do_clear_bss+0x8>
000000d0 <__do_clear_bss>:
d0: 1d 92 st X+, r1
d2: a2 17 cp r26, r18
d4: b3 07 cpc r27, r19
d6: e1 f7 brne .-8 ; 0xd0 <__do_clear_bss>
d8: e1 39 cpi r30, 0x91 ; 145
da: f4 07 cpc r31, r20
dc: 21 f7 brne .-56 ; 0xa6 <__do_copy_data+0x8>
de: 0e 94 fd 00 call 0x1fa ; 0x1fa <main>
e2: 0c 94 73 00 jmp 0xe6 ; 0xe6 <_exit>
000000e6 <_exit>:
e6: f8 94 cli
000000e8 <__stop_program>:
e8: ff cf rjmp .-2 ; 0xe8 <__stop_program>
Disassembly of section .text:
000002fe <__bad_interrupt>:
2fe: 0c 94 00 00 jmp 0 ; 0x0 <__vectors>
Disassembly of section .text.__vector_1:
000000fa <__vector_1>:
fa: 1f 92 push r1
fc: 0f 92 push r0
fe: 00 90 5f 00 lds r0, 0x005F ; 0x80005f <__TEXT_REGION_LENGTH__+0x7e005f>
102: 0f 92 push r0
104: 11 24 eor r1, r1
106: 00 90 5b 00 lds r0, 0x005B ; 0x80005b <__TEXT_REGION_LENGTH__+0x7e005b>
10a: 0f 92 push r0
10c: 2f 93 push r18
10e: 3f 93 push r19
110: 4f 93 push r20
112: 5f 93 push r21
114: 6f 93 push r22
116: 7f 93 push r23
118: 8f 93 push r24
11a: 9f 93 push r25
11c: af 93 push r26
11e: bf 93 push r27
120: ef 93 push r30
122: ff 93 push r31
124: cf 93 push r28
126: df 93 push r29
128: cd b7 in r28, 0x3d ; 61
12a: de b7 in r29, 0x3e ; 62
12c: 80 91 00 01 lds r24, 0x0100 ; 0x800100 <_edata>
130: 90 91 01 01 lds r25, 0x0101 ; 0x800101 <_edata+0x1>
134: 01 96 adiw r24, 0x01 ; 1
136: 90 93 01 01 sts 0x0101, r25 ; 0x800101 <_edata+0x1>
13a: 80 93 00 01 sts 0x0100, r24 ; 0x800100 <_edata>
13e: 80 91 00 01 lds r24, 0x0100 ; 0x800100 <_edata>
142: 90 91 01 01 lds r25, 0x0101 ; 0x800101 <_edata+0x1>
146: 0e 94 3a 01 call 0x274 ; 0x274 <setDisplay>
14a: 00 00 nop
14c: df 91 pop r29
14e: cf 91 pop r28
150: ff 91 pop r31
152: ef 91 pop r30
154: bf 91 pop r27
156: af 91 pop r26
158: 9f 91 pop r25
15a: 8f 91 pop r24
15c: 7f 91 pop r23
15e: 6f 91 pop r22
160: 5f 91 pop r21
162: 4f 91 pop r20
164: 3f 91 pop r19
166: 2f 91 pop r18
168: 0f 90 pop r0
16a: 00 92 5b 00 sts 0x005B, r0 ; 0x80005b <__TEXT_REGION_LENGTH__+0x7e005b>
16e: 0f 90 pop r0
170: 00 92 5f 00 sts 0x005F, r0 ; 0x80005f <__TEXT_REGION_LENGTH__+0x7e005f>
174: 0f 90 pop r0
176: 1f 90 pop r1
178: 18 95 reti
Disassembly of section .text.__vector_2:
0000017a <__vector_2>:
17a: 1f 92 push r1
17c: 0f 92 push r0
17e: 00 90 5f 00 lds r0, 0x005F ; 0x80005f <__TEXT_REGION_LENGTH__+0x7e005f>
182: 0f 92 push r0
184: 11 24 eor r1, r1
186: 00 90 5b 00 lds r0, 0x005B ; 0x80005b <__TEXT_REGION_LENGTH__+0x7e005b>
18a: 0f 92 push r0
18c: 2f 93 push r18
18e: 3f 93 push r19
190: 4f 93 push r20
192: 5f 93 push r21
194: 6f 93 push r22
196: 7f 93 push r23
198: 8f 93 push r24
19a: 9f 93 push r25
19c: af 93 push r26
19e: bf 93 push r27
1a0: ef 93 push r30
1a2: ff 93 push r31
1a4: cf 93 push r28
1a6: df 93 push r29
1a8: cd b7 in r28, 0x3d ; 61
1aa: de b7 in r29, 0x3e ; 62
1ac: 80 91 00 01 lds r24, 0x0100 ; 0x800100 <_edata>
1b0: 90 91 01 01 lds r25, 0x0101 ; 0x800101 <_edata+0x1>
1b4: 01 97 sbiw r24, 0x01 ; 1
1b6: 90 93 01 01 sts 0x0101, r25 ; 0x800101 <_edata+0x1>
1ba: 80 93 00 01 sts 0x0100, r24 ; 0x800100 <_edata>
1be: 80 91 00 01 lds r24, 0x0100 ; 0x800100 <_edata>
1c2: 90 91 01 01 lds r25, 0x0101 ; 0x800101 <_edata+0x1>
1c6: 0e 94 3a 01 call 0x274 ; 0x274 <setDisplay>
1ca: 00 00 nop
1cc: df 91 pop r29
1ce: cf 91 pop r28
1d0: ff 91 pop r31
1d2: ef 91 pop r30
1d4: bf 91 pop r27
1d6: af 91 pop r26
1d8: 9f 91 pop r25
1da: 8f 91 pop r24
1dc: 7f 91 pop r23
1de: 6f 91 pop r22
1e0: 5f 91 pop r21
1e2: 4f 91 pop r20
1e4: 3f 91 pop r19
1e6: 2f 91 pop r18
1e8: 0f 90 pop r0
1ea: 00 92 5b 00 sts 0x005B, r0 ; 0x80005b <__TEXT_REGION_LENGTH__+0x7e005b>
1ee: 0f 90 pop r0
1f0: 00 92 5f 00 sts 0x005F, r0 ; 0x80005f <__TEXT_REGION_LENGTH__+0x7e005f>
1f4: 0f 90 pop r0
1f6: 1f 90 pop r1
1f8: 18 95 reti
Disassembly of section .text.initDisplay:
000002d6 <initDisplay>:
2d6: cf 93 push r28
2d8: df 93 push r29
2da: cd b7 in r28, 0x3d ; 61
2dc: de b7 in r29, 0x3e ; 62
2de: 8a e3 ldi r24, 0x3A ; 58
2e0: 90 e0 ldi r25, 0x00 ; 0
2e2: 2f ef ldi r18, 0xFF ; 255
2e4: fc 01 movw r30, r24
2e6: 20 83 st Z, r18
2e8: 00 00 nop
2ea: df 91 pop r29
2ec: cf 91 pop r28
2ee: 08 95 ret
Disassembly of section .text.setDisplay:
00000274 <setDisplay>:
274: 0f 93 push r16
276: 1f 93 push r17
278: cf 93 push r28
27a: df 93 push r29
27c: 00 d0 rcall .+0 ; 0x27e <setDisplay+0xa>
27e: cd b7 in r28, 0x3d ; 61
280: de b7 in r29, 0x3e ; 62
282: 9a 83 std Y+2, r25 ; 0x02
284: 89 83 std Y+1, r24 ; 0x01
286: 89 81 ldd r24, Y+1 ; 0x01
288: 9a 81 ldd r25, Y+2 ; 0x02
28a: 40 97 sbiw r24, 0x10 ; 16
28c: 24 f4 brge .+8 ; 0x296 <setDisplay+0x22>
28e: 89 81 ldd r24, Y+1 ; 0x01
290: 9a 81 ldd r25, Y+2 ; 0x02
292: 99 23 and r25, r25
294: 24 f4 brge .+8 ; 0x29e <setDisplay+0x2a>
296: 8e e0 ldi r24, 0x0E ; 14
298: 90 e0 ldi r25, 0x00 ; 0
29a: 9a 83 std Y+2, r25 ; 0x02
29c: 89 83 std Y+1, r24 ; 0x01
29e: 0b e3 ldi r16, 0x3B ; 59
2a0: 10 e0 ldi r17, 0x00 ; 0
2a2: 2a ee ldi r18, 0xEA ; 234
2a4: 30 e0 ldi r19, 0x00 ; 0
2a6: 40 e0 ldi r20, 0x00 ; 0
2a8: 89 81 ldd r24, Y+1 ; 0x01
2aa: 9a 81 ldd r25, Y+2 ; 0x02
2ac: 09 2e mov r0, r25
2ae: 00 0c add r0, r0
2b0: aa 0b sbc r26, r26
2b2: 82 0f add r24, r18
2b4: 93 1f adc r25, r19
2b6: a4 1f adc r26, r20
2b8: fc 01 movw r30, r24
2ba: 5a 2f mov r21, r26
2bc: 0e 94 78 01 call 0x2f0 ; 0x2f0 <__xload_1>
2c0: 86 2f mov r24, r22
2c2: f8 01 movw r30, r16
2c4: 80 83 st Z, r24
2c6: 00 00 nop
2c8: 0f 90 pop r0
2ca: 0f 90 pop r0
2cc: df 91 pop r29
2ce: cf 91 pop r28
2d0: 1f 91 pop r17
2d2: 0f 91 pop r16
2d4: 08 95 ret
Disassembly of section .text.main:
000001fa <main>:
1fa: cf 93 push r28
1fc: df 93 push r29
1fe: cd b7 in r28, 0x3d ; 61
200: de b7 in r29, 0x3e ; 62
202: 0e 94 6b 01 call 0x2d6 ; 0x2d6 <initDisplay>
206: 80 e0 ldi r24, 0x00 ; 0
208: 90 e0 ldi r25, 0x00 ; 0
20a: 0e 94 3a 01 call 0x274 ; 0x274 <setDisplay>
20e: 81 e3 ldi r24, 0x31 ; 49
210: 90 e0 ldi r25, 0x00 ; 0
212: fc 01 movw r30, r24
214: 10 82 st Z, r1
216: 8a e6 ldi r24, 0x6A ; 106
218: 90 e0 ldi r25, 0x00 ; 0
21a: 2a e6 ldi r18, 0x6A ; 106
21c: 30 e0 ldi r19, 0x00 ; 0
21e: f9 01 movw r30, r18
220: 20 81 ld r18, Z
222: 2a 60 ori r18, 0x0A ; 10
224: fc 01 movw r30, r24
226: 20 83 st Z, r18
228: 89 e5 ldi r24, 0x59 ; 89
22a: 90 e0 ldi r25, 0x00 ; 0
22c: 29 e5 ldi r18, 0x59 ; 89
22e: 30 e0 ldi r19, 0x00 ; 0
230: f9 01 movw r30, r18
232: 20 81 ld r18, Z
234: 23 60 ori r18, 0x03 ; 3
236: fc 01 movw r30, r24
238: 20 83 st Z, r18
23a: 85 e3 ldi r24, 0x35 ; 53
23c: 90 e0 ldi r25, 0x00 ; 0
23e: 21 e0 ldi r18, 0x01 ; 1
240: fc 01 movw r30, r24
242: 20 83 st Z, r18
244: 78 94 sei
246: 80 91 00 01 lds r24, 0x0100 ; 0x800100 <_edata>
24a: 90 91 01 01 lds r25, 0x0101 ; 0x800101 <_edata+0x1>
24e: 89 2b or r24, r25
250: d1 f3 breq .-12 ; 0x246 <main+0x4c>
252: 80 e3 ldi r24, 0x30 ; 48
254: 90 e0 ldi r25, 0x00 ; 0
256: fc 01 movw r30, r24
258: 80 81 ld r24, Z
25a: 83 30 cpi r24, 0x03 ; 3
25c: a1 f7 brne .-24 ; 0x246 <main+0x4c>
25e: 10 92 01 01 sts 0x0101, r1 ; 0x800101 <_edata+0x1>
262: 10 92 00 01 sts 0x0100, r1 ; 0x800100 <_edata>
266: 80 91 00 01 lds r24, 0x0100 ; 0x800100 <_edata>
26a: 90 91 01 01 lds r25, 0x0101 ; 0x800101 <_edata+0x1>
26e: 0e 94 3a 01 call 0x274 ; 0x274 <setDisplay>
272: e9 cf rjmp .-46 ; 0x246 <main+0x4c>
Disassembly of section .text.libgcc:
000002f0 <__xload_1>:
2f0: 57 fd sbrc r21, 7
2f2: 03 c0 rjmp .+6 ; 0x2fa <__xload_1+0xa>
2f4: 5b bf out 0x3b, r21 ; 59
2f6: 67 91 elpm r22, Z+
2f8: 08 95 ret
2fa: 60 81 ld r22, Z
2fc: 08 95 ret

View File

@@ -0,0 +1,92 @@
/*
* main.c
*
* Created: 2/10/2021 11:45:42 AM
* Author: Sem
*/
#include <avr/interrupt.h>
#include <xc.h>
#include <avr/io.h>
#include <util/delay.h>
void wait( int ms ) {
for (int i=0; i<ms; i++) {
_delay_ms( 1 ); // library function (max 30 ms at 8MHz)
}
}
int count;
/************************************************************************/
/* interrupt 1
walk the light 1 down */
/************************************************************************/
ISR( INT0_vect ) {
setDisplay(++count);
}
/************************************************************************/
/* interrupt 2
walk the light 1 up */
/************************************************************************/
ISR( INT1_vect ) {
setDisplay(--count);
}
const unsigned char Characters [15] = {
0b00111111, // 0
0b00000110, // 1
0b01011011, // 2
0b01001111, // 3
0b01100110, // 4
0b01101101, // 5
0b01111101, // 6
0b00000111, // 7
0b01111111, // 8
0b01101111, // 9
0b01110111, // A
0b01111100, // B
0b00111001, // C
0b01011110, // D
0b01111001, // E
0b01110001, // F
};
void initDisplay(){
DDRA = 0b11111111;
}
void setDisplay(int num){
if(num > 15 || num < 0)
num = 14;
PORTA = Characters[num];
}
int main(void)
{
initDisplay();
setDisplay(0);
/* Replace with your application code */
// Init I/O
DDRD = 0b00000000;
// Init Interrupt hardware
EICRA |= 0b00001010; // INT2 falling edge, INT1 rising edge
EIMSK |= 0b00000011; // Enable INT1 & INT0
PORTC = 0x01; // init the first bit
sei(); // enable input mechanism
while(1)
{
if((count != 0) && (PIND == 0b00000011)){
count = 0;
setDisplay(count);
}
}
}

View File

@@ -0,0 +1,42 @@
<?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\xc8\avr\include\avr\iom128.h</AbsolutePath>
<Attribute></Attribute>
<Category>header</Category>
<Condition>XC</Condition>
<FileContentHash>JdJ7J9I/SJh965SEyyyVYw==</FileContentHash>
<FileVersion></FileVersion>
<Name>xc8/avr/include/avr/iom128.h</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>

View File

@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
<ProjectVersion>7.0</ProjectVersion>
<ToolchainName>com.microchip.xc8</ToolchainName>
<ProjectGuid>{e0046ce4-d6f8-435f-9c6e-72e6eb89ccb3}</ProjectGuid>
<avrdevice>ATmega128</avrdevice>
<avrdeviceseries>none</avrdeviceseries>
<OutputType>Executable</OutputType>
<Language>C</Language>
<OutputFileName>$(MSBuildProjectName)</OutputFileName>
<OutputFileExtension>.elf</OutputFileExtension>
<OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory>
<AssemblyName>opdracht 2.3</AssemblyName>
<Name>opdracht 2.3</Name>
<RootNamespace>opdracht 2.3</RootNamespace>
<ToolchainFlavour>XC8_2.31</ToolchainFlavour>
<KeepTimersRunning>true</KeepTimersRunning>
<OverrideVtor>false</OverrideVtor>
<CacheFlash>true</CacheFlash>
<ProgFlashFromRam>true</ProgFlashFromRam>
<RamSnippetAddress />
<UncachedRange />
<preserveEEPROM>true</preserveEEPROM>
<OverrideVtorValue />
<BootSegment>2</BootSegment>
<ResetRule>0</ResetRule>
<eraseonlaunchrule>0</eraseonlaunchrule>
<EraseKey />
<AsfFrameworkConfig>
<framework-data xmlns="">
<options />
<configurations />
<files />
<documentation help="" />
<offline-documentation help="" />
<dependencies>
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.49.1" />
</dependencies>
</framework-data>
</AsfFrameworkConfig>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<ToolchainSettings />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<ToolchainSettings />
</PropertyGroup>
<ItemGroup>
<Compile Include="main.c">
<SubType>compile</SubType>
</Compile>
</ItemGroup>
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
</Project>

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.4.elf
OUTPUT_FILE_PATH_AS_ARGS +="opdracht 2.4.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.4.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.4.elf" "opdracht 2.4.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.4.elf" "opdracht 2.4.eep" || exit 0
"C:\Program Files\Microchip\xc8\v2.31\bin\avr-objdump.exe" -h -S "opdracht 2.4.elf" > "opdracht 2.4.lss"
# Other Targets
clean:
-$(RM) $(OBJS_AS_ARGS) $(EXECUTABLES)
-$(RM) $(C_DEPS_AS_ARGS)
rm -rf "opdracht 2.4.elf" "opdracht 2.4.hex" "opdracht 2.4.eep" "opdracht 2.4.map" "opdracht 2.4.usersignatures" "opdracht 2.4.a" "opdracht 2.4.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.4.elf">
<memory name="program">
<units>bytes</units>
<length>131072</length>
<used>468</used>
<free>130604</free>
</memory>
<memory name="data">
<units>bytes</units>
<length>4096</length>
<used>144</used>
<free>3952</free>
</memory>
</executable>
</project>

View File

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

View File

@@ -0,0 +1,235 @@
opdracht 2.4.elf: file format elf32-avr
Sections:
Idx Name Size VMA LMA File off Algn
0 .data 00000000 00800100 000001d4 00000248 2**0
ALLOC, LOAD, DATA
1 .text 000000ec 00000000 00000000 00000074 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .comment 0000002f 00000000 00000000 00000248 2**0
CONTENTS, READONLY
3 .debug_aranges 00000028 00000000 00000000 00000277 2**0
CONTENTS, READONLY, DEBUGGING
4 .debug_info 00000b85 00000000 00000000 0000029f 2**0
CONTENTS, READONLY, DEBUGGING
5 .debug_abbrev 00000854 00000000 00000000 00000e24 2**0
CONTENTS, READONLY, DEBUGGING
6 .debug_line 000002b1 00000000 00000000 00001678 2**0
CONTENTS, READONLY, DEBUGGING
7 .debug_frame 00000034 00000000 00000000 0000192c 2**2
CONTENTS, READONLY, DEBUGGING
8 .debug_str 0000027d 00000000 00000000 00001960 2**0
CONTENTS, READONLY, DEBUGGING
9 .debug_loc 000000b2 00000000 00000000 00001bdd 2**0
CONTENTS, READONLY, DEBUGGING
10 .debug_ranges 00000030 00000000 00000000 00001c8f 2**0
CONTENTS, READONLY, DEBUGGING
11 .text 00000004 00000140 00000140 000001b4 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
12 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 00001cc0 2**2
CONTENTS, READONLY, DEBUGGING
13 .text.wait 0000001e 00000122 00000122 00000196 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
14 .text.main 00000036 000000ec 000000ec 00000160 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
15 .data.segments 00000090 00800100 00000144 000001b8 2**0
CONTENTS, ALLOC, LOAD, DATA
Disassembly of section .text:
00000000 <__vectors>:
0: 0c 94 4a 00 jmp 0x94 ; 0x94 <__ctors_end>
4: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
8: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
c: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
10: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
14: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
18: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
1c: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
20: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
24: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
28: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
2c: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
30: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
34: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
38: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
3c: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
40: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
44: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
48: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
4c: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
50: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
54: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
58: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
5c: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
60: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
64: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
68: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
6c: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
70: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
74: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
78: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
7c: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
80: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
84: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
88: 0c 94 a0 00 jmp 0x140 ; 0x140 <__bad_interrupt>
0000008c <.dinit>:
8c: 01 00 .word 0x0001 ; ????
8e: 01 90 ld r0, Z+
90: 00 01 movw r0, r0
92: 44 00 .word 0x0044 ; ????
00000094 <__ctors_end>:
94: 11 24 eor r1, r1
96: 1f be out 0x3f, r1 ; 63
98: cf ef ldi r28, 0xFF ; 255
9a: d0 e1 ldi r29, 0x10 ; 16
9c: de bf out 0x3e, r29 ; 62
9e: cd bf out 0x3d, r28 ; 61
000000a0 <__do_copy_data>:
a0: ec e8 ldi r30, 0x8C ; 140
a2: f0 e0 ldi r31, 0x00 ; 0
a4: 40 e0 ldi r20, 0x00 ; 0
a6: 19 c0 rjmp .+50 ; 0xda <__do_clear_bss+0x8>
a8: b7 91 elpm r27, Z+
aa: a7 91 elpm r26, Z+
ac: 37 91 elpm r19, Z+
ae: 27 91 elpm r18, Z+
b0: 07 91 elpm r16, Z+
b2: 07 fd sbrc r16, 7
b4: 0e c0 rjmp .+28 ; 0xd2 <__do_clear_bss>
b6: 97 91 elpm r25, Z+
b8: 87 91 elpm r24, Z+
ba: ef 01 movw r28, r30
bc: f9 2f mov r31, r25
be: e8 2f mov r30, r24
c0: 0b bf out 0x3b, r16 ; 59
c2: 07 90 elpm r0, Z+
c4: 0d 92 st X+, r0
c6: a2 17 cp r26, r18
c8: b3 07 cpc r27, r19
ca: d9 f7 brne .-10 ; 0xc2 <__do_copy_data+0x22>
cc: fe 01 movw r30, r28
ce: 1b be out 0x3b, r1 ; 59
d0: 04 c0 rjmp .+8 ; 0xda <__do_clear_bss+0x8>
000000d2 <__do_clear_bss>:
d2: 1d 92 st X+, r1
d4: a2 17 cp r26, r18
d6: b3 07 cpc r27, r19
d8: e1 f7 brne .-8 ; 0xd2 <__do_clear_bss>
da: e3 39 cpi r30, 0x93 ; 147
dc: f4 07 cpc r31, r20
de: 21 f7 brne .-56 ; 0xa8 <__do_copy_data+0x8>
e0: 0e 94 76 00 call 0xec ; 0xec <_etext>
e4: 0c 94 74 00 jmp 0xe8 ; 0xe8 <_exit>
000000e8 <_exit>:
e8: f8 94 cli
000000ea <__stop_program>:
ea: ff cf rjmp .-2 ; 0xea <__stop_program>
Disassembly of section .text:
00000140 <__bad_interrupt>:
140: 0c 94 00 00 jmp 0 ; 0x0 <__TEXT_REGION_ORIGIN__>
Disassembly of section .text.wait:
00000122 <wait>:
waits a specific amount of miliseconds */
/************************************************************************/
void wait( int ms )
{
for (int i=0; i<ms; i++)
122: 20 e0 ldi r18, 0x00 ; 0
124: 30 e0 ldi r19, 0x00 ; 0
126: 08 c0 rjmp .+16 ; 0x138 <wait+0x16>
#else
//round up by default
__ticks_dc = (uint32_t)(ceil(fabs(__tmp)));
#endif
__builtin_avr_delay_cycles(__ticks_dc);
128: e3 ec ldi r30, 0xC3 ; 195
12a: f9 e0 ldi r31, 0x09 ; 9
12c: 31 97 sbiw r30, 0x01 ; 1
12e: f1 f7 brne .-4 ; 0x12c <wait+0xa>
130: 00 c0 rjmp .+0 ; 0x132 <wait+0x10>
132: 00 00 nop
134: 2f 5f subi r18, 0xFF ; 255
136: 3f 4f sbci r19, 0xFF ; 255
138: 28 17 cp r18, r24
13a: 39 07 cpc r19, r25
13c: ac f3 brlt .-22 ; 0x128 <wait+0x6>
{
_delay_ms( 1 ); // library function (max 30 ms at 8MHz)
}
}
13e: 08 95 ret
Disassembly of section .text.main:
000000ec <main>:
int main( void )
{
DDRA = 0xFF;
ec: 8f ef ldi r24, 0xFF ; 255
ee: 8a bb out 0x1a, r24 ; 26
while (1==1)
{
// Set index to begin of pattern array
int index = 0;
// as long as delay has meaningful content
for (int i = 0; i < sizeof(segments)/sizeof(segments[0]); i++)
f0: 00 e0 ldi r16, 0x00 ; 0
f2: 10 e0 ldi r17, 0x00 ; 0
while (1==1)
{
// Set index to begin of pattern array
int index = 0;
f4: c0 e0 ldi r28, 0x00 ; 0
f6: d0 e0 ldi r29, 0x00 ; 0
// as long as delay has meaningful content
for (int i = 0; i < sizeof(segments)/sizeof(segments[0]); i++)
f8: 10 c0 rjmp .+32 ; 0x11a <main+0x2e>
{
// Write data to PORTA
PORTA = segments[index].data;
fa: fe 01 movw r30, r28
fc: ee 0f add r30, r30
fe: ff 1f adc r31, r31
100: ec 0f add r30, r28
102: fd 1f adc r31, r29
104: e0 50 subi r30, 0x00 ; 0
106: ff 4f sbci r31, 0xFF ; 255
108: 80 81 ld r24, Z
10a: 8b bb out 0x1b, r24 ; 27
// wait
wait(segments[index].delay);
10c: 81 81 ldd r24, Z+1 ; 0x01
10e: 92 81 ldd r25, Z+2 ; 0x02
110: 0e 94 91 00 call 0x122 ; 0x122 <wait>
// increment for next round
index++;
114: 21 96 adiw r28, 0x01 ; 1
while (1==1)
{
// Set index to begin of pattern array
int index = 0;
// as long as delay has meaningful content
for (int i = 0; i < sizeof(segments)/sizeof(segments[0]); i++)
116: 0f 5f subi r16, 0xFF ; 255
118: 1f 4f sbci r17, 0xFF ; 255
11a: 00 33 cpi r16, 0x30 ; 48
11c: 11 05 cpc r17, r1
11e: 68 f3 brcs .-38 ; 0xfa <main+0xe>
120: e7 cf rjmp .-50 ; 0xf0 <main+0x4>

View File

@@ -0,0 +1,79 @@
/* ---------------------------------------------------------------------------
** 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.
**
** lookup.c
**
** Beschrijving: Ledpatroon op PORTD dmv table lookup (scheiding logica en data)
** Target: AVR mcu
** Build: avr-gcc -std=c99 -Wall -O3 -mmcu=atmega128 -D F_CPU=8000000UL -c switch.c
** avr-gcc -g -mmcu=atmega128 -o lookup.elf lookup.o
** avr-objcopy -O ihex lookup.elf lookup.hex
** or type 'make'
** Author: dkroeske@gmail.com
** -------------------------------------------------------------------------*/
#define F_CPU 10e6
#include <avr/io.h>
#include <util/delay.h>
#include <stdlib.h>
typedef struct {
unsigned char data;
unsigned int delay;
} SEGMENT_DELAY;
SEGMENT_DELAY segments[] = {
/* go around the outer layer twice */
// 0 a b c d e f
{0x00,100},{0x01,100},{0x02,100},{0x04,100},{0x08,100},{0x10,100},{0x20,100},{0x01,100},{0x02,100},{0x04,100},{0x08,100},{0x10,100},{0x20,100},
/* then fill it starting at a */
{0x01,100},{0x03,100},{0x07,100},{0x0F,100},{0x1F,100},{0x3F,100},{0b00111110,100},{0b00111100,100},{0b00111000,100},{0b00110000,100},{0b00100000,100},
/* blink the 3 horizontal bars 2 times from top to bottom*/
{0x01,50},{0x00,50},{0x01,50},{0x00,50},{0x01,50},{0x00,50},{0x01,50},{0x00,50},
{0b01000000,50},{0x00,50},{0b01000000,50},{0x00,50},{0b01000000,50},{0x00,50},{0b01000000,50},{0x00,50},
{0x08,50},{0x00,50},{0x08,50},{0x00,50},{0x08,50},{0x00,50},{0x08,50},{0x00,50}
};
/************************************************************************/
/* wait method
waits a specific amount of miliseconds */
/************************************************************************/
void wait( int ms )
{
for (int i=0; i<ms; i++)
{
_delay_ms( 1 ); // library function (max 30 ms at 8MHz)
}
}
int main( void )
{
DDRA = 0xFF; // set PORTA to all output
while (1==1)
{
// Set index to begin of pattern array
int index = 0;
// loop through the array
for (int i = 0; i < sizeof(segments)/sizeof(segments[0]); i++)
{
// Write data to PORTA
PORTA = segments[index].data;
// wait
wait(segments[index].delay);
// increment for next round
index++;
}
}
/*we need to free the memory taken up by the array, otherwise it won't clear properly*/
free(segments);
return 1;
}

View File

@@ -0,0 +1,42 @@
<?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\xc8\avr\include\avr\iom128.h</AbsolutePath>
<Attribute></Attribute>
<Category>header</Category>
<Condition>XC</Condition>
<FileContentHash>JdJ7J9I/SJh965SEyyyVYw==</FileContentHash>
<FileVersion></FileVersion>
<Name>xc8/avr/include/avr/iom128.h</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>

View File

@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
<ProjectVersion>7.0</ProjectVersion>
<ToolchainName>com.microchip.xc8</ToolchainName>
<ProjectGuid>{0fa0c637-5ac0-44f3-999b-49c114b97183}</ProjectGuid>
<avrdevice>ATmega128</avrdevice>
<avrdeviceseries>none</avrdeviceseries>
<OutputType>Executable</OutputType>
<Language>C</Language>
<OutputFileName>$(MSBuildProjectName)</OutputFileName>
<OutputFileExtension>.elf</OutputFileExtension>
<OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory>
<AssemblyName>opdracht 2.4</AssemblyName>
<Name>opdracht 2.4</Name>
<RootNamespace>opdracht 2.4</RootNamespace>
<ToolchainFlavour>XC8_2.31</ToolchainFlavour>
<KeepTimersRunning>true</KeepTimersRunning>
<OverrideVtor>false</OverrideVtor>
<CacheFlash>true</CacheFlash>
<ProgFlashFromRam>true</ProgFlashFromRam>
<RamSnippetAddress />
<UncachedRange />
<preserveEEPROM>true</preserveEEPROM>
<OverrideVtorValue />
<BootSegment>2</BootSegment>
<ResetRule>0</ResetRule>
<eraseonlaunchrule>0</eraseonlaunchrule>
<EraseKey />
<AsfFrameworkConfig>
<framework-data xmlns="">
<options />
<configurations />
<files />
<documentation help="" />
<offline-documentation help="" />
<dependencies>
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.49.1" />
</dependencies>
</framework-data>
</AsfFrameworkConfig>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<ToolchainSettings>
<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>
</ToolchainSettings>
</PropertyGroup>
<ItemGroup>
<Compile Include="main.c">
<SubType>compile</SubType>
</Compile>
</ItemGroup>
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
</Project>

View File

@@ -0,0 +1,137 @@
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
SHELL := cmd.exe
RM := rm -rf
USER_OBJS :=
LIBS :=
PROJ :=
O_SRCS :=
C_SRCS :=
S_SRCS :=
S_UPPER_SRCS :=
OBJ_SRCS :=
ASM_SRCS :=
PREPROCESSING_SRCS :=
OBJS :=
OBJS_AS_ARGS :=
C_DEPS :=
C_DEPS_AS_ARGS :=
EXECUTABLES :=
OUTPUT_FILE_PATH :=
OUTPUT_FILE_PATH_AS_ARGS :=
AVR_APP_PATH :=$$$AVR_APP_PATH$$$
QUOTE := "
ADDITIONAL_DEPENDENCIES:=
OUTPUT_FILE_DEP:=
LIB_DEP:=
LINKER_SCRIPT_DEP:=
# Every subdirectory with source files must be described here
SUBDIRS :=
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../lcd_control.c \
../main.c
PREPROCESSING_SRCS +=
ASM_SRCS +=
OBJS += \
lcd_control.o \
main.o
OBJS_AS_ARGS += \
lcd_control.o \
main.o
C_DEPS += \
lcd_control.d \
main.d
C_DEPS_AS_ARGS += \
lcd_control.d \
main.d
OUTPUT_FILE_PATH +=opdracht\ 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
./lcd_control.o: .././lcd_control.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: $<
./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,8 @@
################################################################################
# Automatically-generated file. Do not edit or delete the file
################################################################################
lcd_control.c
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>544</used>
<free>130528</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 @@
:00000001FF

View File

@@ -0,0 +1,341 @@
opdracht 2.5.elf: file format elf32-avr
Sections:
Idx Name Size VMA LMA File off Algn
0 .data 00000000 00800100 00800100 00000274 2**0
ALLOC, LOAD, DATA
1 .text 000000a4 00000000 00000000 00000054 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .comment 0000002f 00000000 00000000 00000274 2**0
CONTENTS, READONLY
3 .debug_aranges 00000090 00000000 00000000 000002a3 2**0
CONTENTS, READONLY, DEBUGGING
4 .debug_info 00001209 00000000 00000000 00000333 2**0
CONTENTS, READONLY, DEBUGGING
5 .debug_abbrev 0000095a 00000000 00000000 0000153c 2**0
CONTENTS, READONLY, DEBUGGING
6 .debug_line 00000526 00000000 00000000 00001e96 2**0
CONTENTS, READONLY, DEBUGGING
7 .debug_frame 00000110 00000000 00000000 000023bc 2**2
CONTENTS, READONLY, DEBUGGING
8 .debug_str 000002ae 00000000 00000000 000024cc 2**0
CONTENTS, READONLY, DEBUGGING
9 .debug_loc 00000242 00000000 00000000 0000277a 2**0
CONTENTS, READONLY, DEBUGGING
10 .debug_ranges 00000070 00000000 00000000 000029bc 2**0
CONTENTS, READONLY, DEBUGGING
11 .text 00000004 0000021c 0000021c 00000270 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
12 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 00002a2c 2**2
CONTENTS, READONLY, DEBUGGING
13 .text.sbi_porta 00000016 000001f8 000001f8 0000024c 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
14 .text.cbi_porta 00000018 000001e0 000001e0 00000234 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
15 .text.lcd_strobe_lcd_e 0000002a 0000012c 0000012c 00000180 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
16 .text.lcd_write_character 00000028 00000156 00000156 000001aa 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
17 .text.lcd_write_command 00000028 0000017e 0000017e 000001d2 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
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
22 .text.main 00000020 000001a6 000001a6 000001fa 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
23 .text.libgcc 0000000e 0000020e 0000020e 00000262 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 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
8: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
c: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
10: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
14: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
18: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
1c: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
20: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
24: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
28: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
2c: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
30: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
34: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
38: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
3c: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
40: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
44: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
48: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
4c: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
50: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
54: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
58: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
5c: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
60: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
64: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
68: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
6c: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
70: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
74: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
78: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
7c: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
80: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
84: 0c 94 0e 01 jmp 0x21c ; 0x21c <__bad_interrupt>
88: 0c 94 0e 01 jmp 0x21c ; 0x21c <__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 d3 00 call 0x1a6 ; 0x1a6 <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:
0000021c <__bad_interrupt>:
21c: 0c 94 00 00 jmp 0 ; 0x0 <__vectors>
Disassembly of section .text.sbi_porta:
000001f8 <sbi_porta>:
void cbi_portc(int index){
PORTC &= ~(1<<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);
}
void cbi_portc(int index){
PORTC &= ~(1<<index);
1e0: 9b b3 in r25, 0x1b ; 27
1e2: 21 e0 ldi r18, 0x01 ; 1
1e4: 30 e0 ldi r19, 0x00 ; 0
1e6: 02 c0 rjmp .+4 ; 0x1ec <cbi_porta+0xc>
1e8: 22 0f add r18, r18
1ea: 33 1f adc r19, r19
1ec: 8a 95 dec r24
1ee: e2 f7 brpl .-8 ; 0x1e8 <cbi_porta+0x8>
1f0: 20 95 com r18
1f2: 29 23 and r18, r25
1f4: 2b bb out 0x1b, r18 ; 27
1f6: 08 95 ret
Disassembly of section .text.lcd_strobe_lcd_e:
0000012c <lcd_strobe_lcd_e>:
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
Disassembly of section .text.lcd_write_character:
00000156 <lcd_write_character>:
156: cf 93 push r28
158: c8 2f mov r28, r24
15a: 85 bb out 0x15, r24 ; 21
15c: 84 e0 ldi r24, 0x04 ; 4
15e: 90 e0 ldi r25, 0x00 ; 0
160: 0e 94 fc 00 call 0x1f8 ; 0x1f8 <sbi_porta>
164: 0e 94 96 00 call 0x12c ; 0x12c <lcd_strobe_lcd_e>
168: c2 95 swap r28
16a: c0 7f andi r28, 0xF0 ; 240
16c: c5 bb out 0x15, r28 ; 21
16e: 84 e0 ldi r24, 0x04 ; 4
170: 90 e0 ldi r25, 0x00 ; 0
172: 0e 94 fc 00 call 0x1f8 ; 0x1f8 <sbi_porta>
176: 0e 94 96 00 call 0x12c ; 0x12c <lcd_strobe_lcd_e>
17a: cf 91 pop r28
17c: 08 95 ret
Disassembly of section .text.lcd_write_command:
0000017e <lcd_write_command>:
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
Disassembly of section .text.lcd_clear:
000001c6 <lcd_clear>:
1c6: 81 e0 ldi r24, 0x01 ; 1
1c8: 0e 94 bf 00 call 0x17e ; 0x17e <lcd_write_command>
1cc: 87 e8 ldi r24, 0x87 ; 135
1ce: 93 e1 ldi r25, 0x13 ; 19
1d0: 01 97 sbiw r24, 0x01 ; 1
1d2: f1 f7 brne .-4 ; 0x1d0 <lcd_clear+0xa>
1d4: 00 c0 rjmp .+0 ; 0x1d6 <lcd_clear+0x10>
1d6: 00 00 nop
1d8: 80 e8 ldi r24, 0x80 ; 128
1da: 0e 94 bf 00 call 0x17e ; 0x17e <lcd_write_command>
1de: 08 95 ret
Disassembly of section .text.init_4bits_mode:
000000ae <init_4bits_mode>:
ae: cf 93 push r28
b0: 8f ef ldi r24, 0xFF ; 255
b2: 84 bb out 0x14, r24 ; 20
b4: 85 bb out 0x15, r24 ; 21
b6: 81 bb out 0x11, r24 ; 17
b8: 8a bb out 0x1a, r24 ; 26
ba: 15 ba out 0x15, r1 ; 21
bc: 1b ba out 0x1b, r1 ; 27
be: c0 e2 ldi r28, 0x20 ; 32
c0: c5 bb out 0x15, r28 ; 21
c2: 0e 94 96 00 call 0x12c ; 0x12c <lcd_strobe_lcd_e>
c6: c5 bb out 0x15, r28 ; 21
c8: 0e 94 96 00 call 0x12c ; 0x12c <lcd_strobe_lcd_e>
cc: 80 e8 ldi r24, 0x80 ; 128
ce: 85 bb out 0x15, r24 ; 21
d0: 0e 94 96 00 call 0x12c ; 0x12c <lcd_strobe_lcd_e>
d4: 15 ba out 0x15, r1 ; 21
d6: 0e 94 96 00 call 0x12c ; 0x12c <lcd_strobe_lcd_e>
da: 80 ef ldi r24, 0xF0 ; 240
dc: 85 bb out 0x15, r24 ; 21
de: 0e 94 96 00 call 0x12c ; 0x12c <lcd_strobe_lcd_e>
e2: 15 ba out 0x15, r1 ; 21
e4: 0e 94 96 00 call 0x12c ; 0x12c <lcd_strobe_lcd_e>
e8: 80 e6 ldi r24, 0x60 ; 96
ea: 85 bb out 0x15, r24 ; 21
ec: 0e 94 96 00 call 0x12c ; 0x12c <lcd_strobe_lcd_e>
f0: 82 e0 ldi r24, 0x02 ; 2
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:
000001a6 <main>:
int main(void)
{
init_4bits_mode();
1a6: 0e 94 57 00 call 0xae ; 0xae <init_4bits_mode>
#else
//round up by default
__ticks_dc = (uint32_t)(ceil(fabs(__tmp)));
#endif
__builtin_avr_delay_cycles(__ticks_dc);
1aa: 87 ea ldi r24, 0xA7 ; 167
1ac: 91 e6 ldi r25, 0x61 ; 97
1ae: 01 97 sbiw r24, 0x01 ; 1
1b0: f1 f7 brne .-4 ; 0x1ae <main+0x8>
1b2: 00 c0 rjmp .+0 ; 0x1b4 <main+0xe>
1b4: 00 00 nop
_delay_ms(10);
lcd_clear();
1b6: 0e 94 e3 00 call 0x1c6 ; 0x1c6 <lcd_clear>
lcd_write_string("Pintebaas");
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:
0000020e <__xload_1>:
20e: 57 fd sbrc r21, 7
210: 03 c0 rjmp .+6 ; 0x218 <__xload_1+0xa>
212: 5b bf out 0x3b, r21 ; 59
214: 67 91 elpm r22, Z+
216: 08 95 ret
218: 60 81 ld r22, Z
21a: 08 95 ret

View File

@@ -0,0 +1,123 @@
/*
* lcd_controlc.c
*
* Created: 24-2-2021 11:55:12
* Author: Sem
*/
#define F_CPU 10e6
#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#include "lcd_control.h"
void _delay_ms(double __ms);
void lcd_clear() {
lcd_write_command (0x01); //Leeg display
_delay_ms(2);
lcd_write_command (0x80); //Cursor terug naar start
}
void lcd_strobe_lcd_e(void) {
sbi_porta(LCD_E); // E high
_delay_ms(1);
cbi_porta(LCD_E); // E low
_delay_ms(1);
}
void sbi_portc(int index){
PORTC |= (1<<index);
}
void cbi_portc(int index){
PORTC &= ~(1<<index);
}
void sbi_porta(int index){
PORTA |= (1<<index);
}
void cbi_porta(int index){
PORTA &= ~(1<<index);
}
void init_4bits_mode(void) {
// PORTC output mode and all low (also E and RS pin)
// Init I/O
DDRC = 0xFF; // PORTD(7) output, PORTD(6:0) input
PORTC = 0xFF;
DDRD = 0xFF;
DDRA = 0xFF;
PORTC = 0x00;
PORTA = 0x00;
PORTC = 0x20; // function for 4-bit 1 row
lcd_strobe_lcd_e();
PORTC = 0x20; // function high nibble 4-bit 2 row
lcd_strobe_lcd_e();
PORTC = 0x80; // function low nibble 4-bit 2 row
lcd_strobe_lcd_e();
PORTC = 0x00; // function high nibble turn on visible blinking-block cursor
lcd_strobe_lcd_e();
PORTC = 0xF0; // function low nibble turn on visible blinking-block cursor
lcd_strobe_lcd_e();
PORTC = 0x00; // Entry mode set high nibble
lcd_strobe_lcd_e();
PORTC = 0x60; // Entry mode set low nibble
lcd_strobe_lcd_e();
// return home
lcd_write_command(0x02);
lcd_strobe_lcd_e();
}
void lcd_write_character(unsigned char byte){
//upper nibble
PORTC = byte;
sbi_porta(LCD_RS);
lcd_strobe_lcd_e();
//lower nibble
PORTC = (byte<<4);
sbi_porta(LCD_RS);
lcd_strobe_lcd_e();
}
void lcd_write_command(unsigned char byte){
//upper nibble
PORTC = byte;
cbi_porta(LCD_RS);
lcd_strobe_lcd_e();
//lower nibble
PORTC = (byte<<4);
cbi_porta(LCD_RS);
lcd_strobe_lcd_e();
}
void lcd_write_string(const char *str) {
for(;*str; str++){
lcd_write_character(*str);
}
}
void lcd_move_right(void){
lcd_write_command(0x1E);
}

View File

@@ -0,0 +1,29 @@
/*
* lcd_control.h
*
* Created: 24-2-2021 11:56:16
* Author: Sem
*/
#ifndef LCD_CONTROL_H_
#define LCD_CONTROL_H_
#define LCD_E 6
#define LCD_RS 4
void _delay_ms(double __ms);
void lcd_strobe_lcd_e(void);
void sbi_portc(int index);
void cbi_portc(int index);
void sbi_porta(int index);
void cbi_porta(int index);
void init_4bits_mode(void);
void lcd_write_string(const char *str);
void lcd_write_character(unsigned char byte);
void lcd_write_command(unsigned char byte);
void lcd_clear();
#endif /* LCD_CONTROL_H_ */

View File

@@ -0,0 +1,16 @@
/*
* main.c
*
* Created: 2/10/2021 2:04:13 PM
* Author: User
*/
#include <xc.h>
int main(void)
{
while(1)
{
//TODO:: Please write your application code
}
}

View File

@@ -0,0 +1,6 @@
/*
* ldc.h
*
* Created: 10-2-2021 14:06:38
* Author: User
*/

View File

@@ -0,0 +1,35 @@
/*
* main.c
*
* Created: 11-Feb-21 11:01:07 PM
* Author: lemms
*/
#define F_CPU 10e6
#include <xc.h>
#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#include "lcd_control.h"
int main(void)
{
init_4bits_mode();
_delay_ms(10);
lcd_clear();
lcd_write_string("Pintebaas");
while(1)
{
//TODO:: Please write your application code
}
}

View File

@@ -0,0 +1,42 @@
<?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\xc8\avr\include\avr\iom128.h</AbsolutePath>
<Attribute></Attribute>
<Category>header</Category>
<Condition>XC</Condition>
<FileContentHash>JdJ7J9I/SJh965SEyyyVYw==</FileContentHash>
<FileVersion></FileVersion>
<Name>xc8/avr/include/avr/iom128.h</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>

View File

@@ -0,0 +1,105 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
<ProjectVersion>7.0</ProjectVersion>
<ToolchainName>com.microchip.xc8</ToolchainName>
<ProjectGuid>{c81b68aa-f4bb-4a5d-81f8-2737dcd1d4a7}</ProjectGuid>
<avrdevice>ATmega128</avrdevice>
<avrdeviceseries>none</avrdeviceseries>
<OutputType>Executable</OutputType>
<Language>C</Language>
<OutputFileName>$(MSBuildProjectName)</OutputFileName>
<OutputFileExtension>.elf</OutputFileExtension>
<OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory>
<AssemblyName>opdracht 2.5</AssemblyName>
<Name>opdracht 2.5</Name>
<RootNamespace>opdracht 2.5</RootNamespace>
<ToolchainFlavour>XC8_2.31</ToolchainFlavour>
<KeepTimersRunning>true</KeepTimersRunning>
<OverrideVtor>false</OverrideVtor>
<CacheFlash>true</CacheFlash>
<ProgFlashFromRam>true</ProgFlashFromRam>
<RamSnippetAddress />
<UncachedRange />
<preserveEEPROM>true</preserveEEPROM>
<OverrideVtorValue />
<BootSegment>2</BootSegment>
<ResetRule>0</ResetRule>
<eraseonlaunchrule>0</eraseonlaunchrule>
<EraseKey />
<AsfFrameworkConfig>
<framework-data xmlns="">
<options />
<configurations />
<files />
<documentation help="" />
<offline-documentation help="" />
<dependencies>
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.49.1" />
</dependencies>
</framework-data>
</AsfFrameworkConfig>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<ToolchainSettings>
<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>
</ToolchainSettings>
</PropertyGroup>
<ItemGroup>
<Compile Include="lcd_control.c">
<SubType>compile</SubType>
</Compile>
<Compile Include="lcd_control.h">
<SubType>compile</SubType>
</Compile>
<Compile Include="main.c">
<SubType>compile</SubType>
</Compile>
</ItemGroup>
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
</Project>

View File

@@ -0,0 +1,139 @@
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
SHELL := cmd.exe
RM := rm -rf
USER_OBJS :=
LIBS :=
PROJ :=
O_SRCS :=
C_SRCS :=
S_SRCS :=
S_UPPER_SRCS :=
OBJ_SRCS :=
ASM_SRCS :=
PREPROCESSING_SRCS :=
OBJS :=
OBJS_AS_ARGS :=
C_DEPS :=
C_DEPS_AS_ARGS :=
EXECUTABLES :=
OUTPUT_FILE_PATH :=
OUTPUT_FILE_PATH_AS_ARGS :=
AVR_APP_PATH :=$$$AVR_APP_PATH$$$
QUOTE := "
ADDITIONAL_DEPENDENCIES:=
OUTPUT_FILE_DEP:=
LIB_DEP:=
LINKER_SCRIPT_DEP:=
# Every subdirectory with source files must be described here
SUBDIRS :=
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../lcd_control.c \
../main.c
PREPROCESSING_SRCS +=
ASM_SRCS +=
OBJS += \
lcd_control.o \
main.o
OBJS_AS_ARGS += \
lcd_control.o \
main.o
C_DEPS += \
lcd_control.d \
main.d
C_DEPS_AS_ARGS += \
lcd_control.d \
main.d
OUTPUT_FILE_PATH +=opdracht\ 3.2.elf
OUTPUT_FILE_PATH_AS_ARGS +="opdracht 3.2.elf"
ADDITIONAL_DEPENDENCIES:=
OUTPUT_FILE_DEP:= ./makedep.mk
LIB_DEP+=
LINKER_SCRIPT_DEP+=
# AVR32/GNU C Compiler
./lcd_control.o: .././lcd_control.c
@echo Building file: $<
@echo Invoking: AVR/GNU C Compiler : 5.4.0
$(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -x c -funsigned-char -funsigned-bitfields -DDEBUG -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\include" -Og -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=atmega128 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\gcc\dev\atmega128" -c -std=gnu99 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<"
@echo Finished building: $<
./main.o: .././main.c
@echo Building file: $<
@echo Invoking: AVR/GNU C Compiler : 5.4.0
$(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -x c -funsigned-char -funsigned-bitfields -DDEBUG -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\include" -Og -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=atmega128 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\gcc\dev\atmega128" -c -std=gnu99 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<"
@echo Finished building: $<
# AVR32/GNU Preprocessing Assembler
# AVR32/GNU Assembler
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS)
endif
endif
# Add inputs and outputs from these tool invocations to the build variables
# All Target
all: $(OUTPUT_FILE_PATH) $(ADDITIONAL_DEPENDENCIES)
$(OUTPUT_FILE_PATH): $(OBJS) $(USER_OBJS) $(OUTPUT_FILE_DEP) $(LIB_DEP) $(LINKER_SCRIPT_DEP)
@echo Building target: $@
@echo Invoking: AVR/GNU Linker : 5.4.0
$(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -o$(OUTPUT_FILE_PATH_AS_ARGS) $(OBJS_AS_ARGS) $(USER_OBJS) $(LIBS) -Wl,-Map="opdracht 3.2.map" -Wl,--start-group -Wl,-lm -Wl,--end-group -Wl,--gc-sections -mrelax -mmcu=atmega128 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\gcc\dev\atmega128"
@echo Finished building target: $@
"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objcopy.exe" -O ihex -R .eeprom -R .fuse -R .lock -R .signature -R .user_signatures "opdracht 3.2.elf" "opdracht 3.2.hex"
"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objcopy.exe" -j .eeprom --set-section-flags=.eeprom=alloc,load --change-section-lma .eeprom=0 --no-change-warnings -O ihex "opdracht 3.2.elf" "opdracht 3.2.eep" || exit 0
"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objdump.exe" -h -S "opdracht 3.2.elf" > "opdracht 3.2.lss"
"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objcopy.exe" -O srec -R .eeprom -R .fuse -R .lock -R .signature -R .user_signatures "opdracht 3.2.elf" "opdracht 3.2.srec"
"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-size.exe" "opdracht 3.2.elf"
# Other Targets
clean:
-$(RM) $(OBJS_AS_ARGS) $(EXECUTABLES)
-$(RM) $(C_DEPS_AS_ARGS)
rm -rf "opdracht 3.2.elf" "opdracht 3.2.a" "opdracht 3.2.hex" "opdracht 3.2.lss" "opdracht 3.2.eep" "opdracht 3.2.map" "opdracht 3.2.srec" "opdracht 3.2.usersignatures"

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,150 @@
S01400006F7064726163687420332E322E7372656308
S113000045C0000060C000005EC000005CC000008D
S11300105AC0000058C0000056C0000054C0000080
S113002052C0000050C00000DDC000004CC0000001
S11300304AC0000048C0000046C0000044C00000A0
S113004042C0000040C000003EC000003CC00000B0
S11300503AC0000038C0000036C0000034C00000C0
S113006032C0000030C000002EC000002CC00000D0
S11300702AC0000028C0000026C0000024C00000E0
S113008022C0000020C000001EC0000011241FBEBA
S1130090CFEFD0E1DEBFCDBF11E0A0E0B1E0E2E2FE
S11300A0F9E000E00BBF02C007900D92AA30B1073F
S11300B0D9F721E0AAE0B1E001C01D92AC30B2074B
S11300C0E1F729D12CC49CCF9BB321E030E002C0DE
S11300D0220F331F8A95E2F7292B2BBB08959BB37C
S11300E021E030E002C0220F331F8A95E2F7209509
S11300F029232BBB089586E090E0E6DF83EC99E0AA
S11301000197F1F700C0000086E090E0E8DF83EC9F
S113011099E00197F1F700C000000895CF93C82F2C
S113012085BB84E090E0D0DFE6DFC295C07FC5BB2D
S113013084E090E0C9DFDFDFCF910895CF93C82F2B
S113014085BB84E090E0CBDFD6DFC295C07FC5BB22
S113015084E090E0C4DFCFDFCF91089581E0EEDF4B
S113016087E893E10197F1F700C0000080E8E6CF4B
S11301700895CF938FEF84BB85BB8ABB15BA1BBA96
S1130180C0E2C5BBB8DFC5BBB6DF80E885BBB3DF63
S113019015BAB1DF80EF85BBAEDF15BAACDF80E600
S11301A085BBA9DF82E0CADFA6DFCF910895CF9394
S11301B0DF93EC0102C0B2DF219688818111FBCF6D
S11301C0DF91CF91089520E030E008C0EFECF7E034
S11301D03197F1F700C000002F5F3F4F2817390710
S11301E0ACF308951F920F920FB60F9211240BB621
S11301F00F92CF92DF92EF92FF920F931F932F9360
S11302003F934F935F936F937F938F939F93AF939A
S1130210BF93EF93FF93CF93DF93CDB7DEB7CDB604
S1130220DEB68091000184BD80910A0190910B019A
S1130230019690930B0180930A0190DF80910A014B
S113024090910B0101969F938F930F2EF2E0EF2E66
S1130250F1E0FF2EF02DFF92EF921F921F921F925A
S11302601F9274D001962DB73EB7285F3F4F0FB64B
S1130270F8943EBF0FBE2DBF281B390B0FB6F89460
S11302803EBF0FBE2DBF0DB71EB70F5F1F4F20918E
S11302900A0130910B012F5F3F4F3F932F93FF9241
S11302A0EF929F938F931F930F9350D0802F912F92
S11302B07EDF8DB79EB708960FB6F8949EBF0FBE2B
S11302C08DBF0FB6F894DEBE0FBECDBEDF91CF91C9
S11302D0FF91EF91BF91AF919F918F917F916F911A
S11302E05F914F913F912F911F910F91FF90EF904C
S11302F0DF90CF900F900BBE0F900FBE0F901F900A
S113030018958091000184BD87B7806487BF789475
S113031087E085BD089581B38F7781BB8FEF8ABB5A
S113032087BB27DF8FE19EE40197F1F700C000004F
S113033015DF85E091E03BDFE4DF84B58BBB809182
S11303400A0188BB8AE090E03EDFF7CF0F931F934A
S1130350CF93DF93CDB7DEB72E970FB6F894DEBFF9
S11303600FBECDBF0D891E898F89988D26E02C8301
S11303701A83098397FF02C080E090E801979E8367
S11303808D83AE01455E5F4F698D7A8DCE010196F6
S113039019D04D815E8157FD0AC02F8138854217DF
S11303A053070CF49A01F801E20FF31F10822E9602
S11303B00FB6F894DEBF0FBECDBFDF91CF911F9172
S11303C00F9108952F923F924F925F926F927F9276
S11303D08F929F92AF92BF92CF92DF92EF92FF9251
S11303E00F931F93CF93DF93CDB7DEB72B970FB641
S11303F0F894DEBF0FBECDBF6C017B018A01FC0106
S113040017821682838181FFBFC1CE0101963C0110
S1130410F6019381F70193FD859193FF81917F010B
S1130420882309F4ADC1853239F493FD859193FF96
S113043081917F01853221F4B60190E0D6D1E8CFD5
S1130440912C212C312CFFE1F315D8F08B3279F06B
S113045038F4803279F08332A1F4232D20611DC059
S11304608D3261F0803369F4232D216016C0832D11
S11304708260382EE32DE4603E2E2AC0F32DF8600E
S11304801DC037FC2DC020ED280F2A3040F08E32DD
S1130490B9F436FC75C1232D2064322E19C036FE02
S11304A006C08AE0989E200D1124922E11C0EAE025
S11304B02E9E200D1124222EF32DF0623F2E08C013
S11304C08C3621F4832D8068382E02C0883641F49E
S11304D0F70193FD859193FF81917F018111B3CF42
S11304E0982F9F7D9554933028F40C5F1F4F9FE302
S11304F099830DC0833631F0833771F0833509F069
S113050055C020C0F801808189830E5F1F4F882465
S11305108394912C530112C02801F2E04F0E511C18
S1130520F801A080B18036FE03C0692D70E002C0DE
S11305306FEF7FEFC5014ED14C018201F32DFF77A0
S11305403F2E15C0280122E0420E511CF801A08064
S1130550B18036FE03C0692D70E002C06FEF7FEFFB
S1130560C5012DD14C01F32DF0683F2E820133FCDF
S113057019C0822D90E088169906A0F4B60180E295
S113058090E033D12A94F5CFF50137FC859137FEFD
S113059081915F01B60190E028D121102A9421E0D5
S11305A0821A91088114910479F7E1C0843611F01C
S11305B0893639F5F80137FE07C06081718182817F
S11305C093810C5F1F4F08C060817181072E000C5E
S11305D0880B990B0E5F1F4FF32DFF763F2E97FF6D
S11305E009C090958095709561957F4F8F4F9F4F6F
S11305F0F0683F2E2AE030E0A30133D1882E86181C
S113060044C0853731F4232D2F7EB22E2AE030E00A
S113061025C0932D997FB92E8F36C1F018F48835F3
S113062079F0AEC0803719F0883721F0A9C0E92FDE
S1130630E061BE2EB4FE0DC0FB2DF460BF2E09C0D8
S113064034FE0AC0292F2660B22E06C028E030E00E
S113065005C020E130E002C020E132E0F801B7FE3D
S113066007C060817181828193810C5F1F4F06C036
S11306706081718180E090E00E5F1F4FA301F1D093
S1130680882E8618FB2DFF773F2E36FE0DC0232DB6
S11306902E7FA22E891458F434FE0BC032FC09C0FC
S11306A0832D8E7EA82E05C0B82CA32C03C0B82C95
S11306B001C0B92CA4FE0FC0FE01E80DF11D80811C
S11306C0803321F49A2D997EA92E09C0A2FE06C07A
S11306D0B394B39404C08A2D867809F0B394A3FC30
S11306E010C0A0FE06C0B21480F4280C922C9B18F3
S11306F00DC0B21458F4B60180E290E076D0B39401
S1130700F8CFB21418F42B1802C0982C212CA4FE94
S11307100FC0B60180E390E068D0A2FE16C0A1FC31
S113072003C088E790E002C088E590E0B6010CC001
S11307308A2D867851F0A1FE02C08BE201C080E2CE
S1130740A7FC8DE2B60190E050D0891430F4B601D4
S113075080E390E04AD09A94F8CF8A94F301E80DAC
S1130760F11D8081B60190E040D08110F6CF2220A7
S113077009F44ECEB60180E290E037D02A94F7CF48
S1130780F6018681978102C08FEF9FEF2B960FB6FB
S1130790F894DEBF0FBECDBFDF91CF911F910F91B3
S11307A0FF90EF90DF90CF90BF90AF909F908F908D
S11307B07F906F905F904F903F902F900895FC0131
S11307C00590615070400110D8F7809590958E0F78
S11307D09F1F0895FC016150704001900110D8F7EB
S11307E0809590958E0F9F1F08950F931F93CF931D
S11307F0DF93FB01238121FD03C08FEF9FEF2CC00A
S113080022FF16C046815781248135814217530740
S113081044F4A081B1819D012F5F3F4F3183208338
S11308208C93268137812F5F3F4F3783268314C0F3
S11308308B01EC01FB010084F185E02D0995892BE6
S1130840E1F6D80116968D919C911797019617960B
S11308509C938E931697CE01DF91CF911F910F91A8
S11308600895FA01AA27283051F1203181F1E89442
S11308706F936E7F6E5F7F4F8F4F9F4FAF4FB1E08F
S11308803ED0B4E03CD0670F781F891F9A1FA11D8A
S1130890680F791F8A1F911DA11D6A0F711D811D8B
S11308A0911DA11D20D009F468943F912AE0269F50
S11308B011243019305D3193DEF6CF010895462FAF
S11308C04770405D4193B3E00FD0C9F7F6CF462F90
S11308D04F70405D4A3318F0495D31FD40524193F9
S11308E002D0A9F7EACFB4E0A695979587957795B6
S11308F06795BA95C9F700976105710508959B013D
S1130900AC010A2E06945795479537952795BA95C5
S1130910C9F7620F731F841F951FA01D0895F894D3
S1050920FFCF03
S10D0922FFFF256400796565740089
S9030000FC

View File

@@ -0,0 +1,122 @@
/*
* lcd_controlc.c
*
* Created: 24-2-2021 11:55:12
* Author: Sem
*/
#define F_CPU 10e6
#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#include "lcd_control.h"
void _delay_ms(double __ms);
void lcd_clear() {
lcd_write_command (0x01); //Leeg display
_delay_ms(2);
lcd_write_command (0x80); //Cursor terug naar start
}
void lcd_strobe_lcd_e(void) {
sbi_porta(LCD_E); // E high
_delay_ms(1);
cbi_porta(LCD_E); // E low
_delay_ms(1);
}
void sbi_portc(int index){
PORTC |= (1<<index);
}
void cbi_portc(int index){
PORTC &= ~(1<<index);
}
void sbi_porta(int index){
PORTA |= (1<<index);
}
void cbi_porta(int index){
PORTA &= ~(1<<index);
}
void init_4bits_mode(void) {
// PORTC output mode and all low (also E and RS pin)
// Init I/O
DDRC = 0xFF; // PORTD(7) output, PORTD(6:0) input
PORTC = 0xFF;
DDRA = 0xFF;
PORTC = 0x00;
PORTA = 0x00;
PORTC = 0x20; // function for 4-bit 1 row
lcd_strobe_lcd_e();
PORTC = 0x20; // function high nibble 4-bit 2 row
lcd_strobe_lcd_e();
PORTC = 0x80; // function low nibble 4-bit 2 row
lcd_strobe_lcd_e();
PORTC = 0x00; // function high nibble turn on visible blinking-block cursor
lcd_strobe_lcd_e();
PORTC = 0xF0; // function low nibble turn on visible blinking-block cursor
lcd_strobe_lcd_e();
PORTC = 0x00; // Entry mode set high nibble
lcd_strobe_lcd_e();
PORTC = 0x60; // Entry mode set low nibble
lcd_strobe_lcd_e();
// return home
lcd_write_command(0x02);
lcd_strobe_lcd_e();
}
void lcd_write_character(unsigned char byte){
//upper nibble
PORTC = byte;
sbi_porta(LCD_RS);
lcd_strobe_lcd_e();
//lower nibble
PORTC = (byte<<4);
sbi_porta(LCD_RS);
lcd_strobe_lcd_e();
}
void lcd_write_command(unsigned char byte){
//upper nibble
PORTC = byte;
cbi_porta(LCD_RS);
lcd_strobe_lcd_e();
//lower nibble
PORTC = (byte<<4);
cbi_porta(LCD_RS);
lcd_strobe_lcd_e();
}
void lcd_write_string(const char *str) {
for(;*str; str++){
lcd_write_character(*str);
}
}
void lcd_move_right(void){
lcd_write_command(0x1E);
}

View File

@@ -0,0 +1,29 @@
/*
* lcd_control.h
*
* Created: 24-2-2021 11:56:16
* Author: Sem
*/
#ifndef LCD_CONTROL_H_
#define LCD_CONTROL_H_
#define LCD_E 6
#define LCD_RS 4
void _delay_ms(double __ms);
void lcd_strobe_lcd_e(void);
void sbi_portc(int index);
void cbi_portc(int index);
void sbi_porta(int index);
void cbi_porta(int index);
void init_4bits_mode(void);
void lcd_write_string(const char *str);
void lcd_write_character(unsigned char byte);
void lcd_write_command(unsigned char byte);
void lcd_clear();
#endif /* LCD_CONTROL_H_ */

View File

@@ -0,0 +1,81 @@
/*
* counter_t2_interrupt.c
*
* Created: 21/02/2021 13:00:25
* Author : Etienne
*/
#define F_CPU 8e6
#include <stdlib.h>
#include <stdio.h>
#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#include "lcd_control.h"
#define BIT(x) (1 << (x))
// wait(): busy waiting for 'ms' millisecond
// Used library: util/delay.h
void wait( int ms ) {
for (int tms=0; tms<ms; tms++) {
_delay_ms( 1 ); // library function (max 30 ms at 8MHz)
}
}
char * toArray(int number)
{
int n = log10(number) + 1;
int i;
char *numberArray = calloc(n, sizeof(char));
for (i = n-1; i >= 0; --i, number /= 10)
{
numberArray[i] = (number % 10) + '0';
}
return numberArray;
}
int TimerPreset = -1; // 0xF6, 10 till overflow
int number = 0;
// Interrupt routine timer2 overflow
ISR( TIMER2_OVF_vect ) {
TCNT2 = TimerPreset; // Preset value
number++; // Increment counter
lcd_clear();
int length = snprintf(NULL, 0, "%d", number + 1);
char str[length + 1];
snprintf(str, length + 1, "%d", number + 1);
lcd_write_string(str);
}
// Initialize timer2
void timer2Init( void ) {
TCNT2 = TimerPreset; // Preset value of counter 2
TIMSK |= BIT(6); // T2 overflow interrupt enable
sei(); // turn_on intr all
TCCR2 = 0x07; // Initialize T2: ext.counting, rising edge, run
}
int main(void) {
DDRD &= ~BIT(7); // PD7 op input: DDRD=xxxx xxx0
DDRA = 0xFF; // set PORTA for output (shows countregister)
DDRB = 0xFF; // set PORTB for output (shows tenthvalue)
init_4bits_mode();
_delay_ms(10);
lcd_clear();
lcd_write_string("yeet");
timer2Init();
while (1) {
PORTA = TCNT2; // show value counter 2
PORTB = number; // show value tenth counter
wait(10);
}
}

View 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>jmg1Ivqg0tP1uOL2/aRLyg==</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>

View File

@@ -0,0 +1,136 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
<ProjectVersion>7.0</ProjectVersion>
<ToolchainName>com.Atmel.AVRGCC8.C</ToolchainName>
<ProjectGuid>{eb7415c6-2130-46ad-9842-612c67ade6d4}</ProjectGuid>
<avrdevice>ATmega128</avrdevice>
<avrdeviceseries>none</avrdeviceseries>
<OutputType>Executable</OutputType>
<Language>C</Language>
<OutputFileName>$(MSBuildProjectName)</OutputFileName>
<OutputFileExtension>.elf</OutputFileExtension>
<OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory>
<AssemblyName>opdracht 3.2</AssemblyName>
<Name>opdracht 3.2</Name>
<RootNamespace>opdracht 3.2</RootNamespace>
<ToolchainFlavour>Native</ToolchainFlavour>
<KeepTimersRunning>true</KeepTimersRunning>
<OverrideVtor>false</OverrideVtor>
<CacheFlash>true</CacheFlash>
<ProgFlashFromRam>true</ProgFlashFromRam>
<RamSnippetAddress />
<UncachedRange />
<preserveEEPROM>true</preserveEEPROM>
<OverrideVtorValue />
<BootSegment>2</BootSegment>
<ResetRule>0</ResetRule>
<eraseonlaunchrule>0</eraseonlaunchrule>
<EraseKey />
<AsfFrameworkConfig>
<framework-data xmlns="">
<options />
<configurations />
<files />
<documentation help="" />
<offline-documentation help="" />
<dependencies>
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.49.1" />
</dependencies>
</framework-data>
</AsfFrameworkConfig>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<ToolchainSettings>
<AvrGcc>
<avrgcc.common.Device>-mmcu=atmega128 -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\gcc\dev\atmega128"</avrgcc.common.Device>
<avrgcc.common.optimization.RelaxBranches>True</avrgcc.common.optimization.RelaxBranches>
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
<avrgcc.compiler.symbols.DefSymbols>
<ListValues>
<Value>NDEBUG</Value>
</ListValues>
</avrgcc.compiler.symbols.DefSymbols>
<avrgcc.compiler.directories.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\include\</Value>
</ListValues>
</avrgcc.compiler.directories.IncludePaths>
<avrgcc.compiler.optimization.level>Optimize for size (-Os)</avrgcc.compiler.optimization.level>
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
<avrgcc.linker.libraries.Libraries>
<ListValues>
<Value>libm</Value>
</ListValues>
</avrgcc.linker.libraries.Libraries>
<avrgcc.assembler.general.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\include\</Value>
</ListValues>
</avrgcc.assembler.general.IncludePaths>
</AvrGcc>
</ToolchainSettings>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<ToolchainSettings>
<AvrGcc>
<avrgcc.common.Device>-mmcu=atmega128 -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\gcc\dev\atmega128"</avrgcc.common.Device>
<avrgcc.common.optimization.RelaxBranches>True</avrgcc.common.optimization.RelaxBranches>
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
<avrgcc.compiler.symbols.DefSymbols>
<ListValues>
<Value>DEBUG</Value>
</ListValues>
</avrgcc.compiler.symbols.DefSymbols>
<avrgcc.compiler.directories.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\include\</Value>
</ListValues>
</avrgcc.compiler.directories.IncludePaths>
<avrgcc.compiler.optimization.level>Optimize debugging experience (-Og)</avrgcc.compiler.optimization.level>
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
<avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel>
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
<avrgcc.linker.libraries.Libraries>
<ListValues>
<Value>libm</Value>
</ListValues>
</avrgcc.linker.libraries.Libraries>
<avrgcc.assembler.general.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\include\</Value>
</ListValues>
</avrgcc.assembler.general.IncludePaths>
<avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel>
</AvrGcc>
</ToolchainSettings>
</PropertyGroup>
<ItemGroup>
<Compile Include="lcd_control.c">
<SubType>compile</SubType>
</Compile>
<Compile Include="lcd_control.h">
<SubType>compile</SubType>
</Compile>
<Compile Include="main.c">
<SubType>compile</SubType>
</Compile>
</ItemGroup>
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
</Project>

View 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 +=opdracht\ 3.3.elf
OUTPUT_FILE_PATH_AS_ARGS +="opdracht 3.3.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="opdracht 3.3.map" -Wl,--start-group -Wl,-lm -Wl,--end-group -Wl,--gc-sections -mrelax -mmcu=atmega128 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\gcc\dev\atmega128"
@echo Finished building target: $@
"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objcopy.exe" -O ihex -R .eeprom -R .fuse -R .lock -R .signature -R .user_signatures "opdracht 3.3.elf" "opdracht 3.3.hex"
"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objcopy.exe" -j .eeprom --set-section-flags=.eeprom=alloc,load --change-section-lma .eeprom=0 --no-change-warnings -O ihex "opdracht 3.3.elf" "opdracht 3.3.eep" || exit 0
"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objdump.exe" -h -S "opdracht 3.3.elf" > "opdracht 3.3.lss"
"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objcopy.exe" -O srec -R .eeprom -R .fuse -R .lock -R .signature -R .user_signatures "opdracht 3.3.elf" "opdracht 3.3.srec"
"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-size.exe" "opdracht 3.3.elf"
# Other Targets
clean:
-$(RM) $(OBJS_AS_ARGS) $(EXECUTABLES)
-$(RM) $(C_DEPS_AS_ARGS)
rm -rf "opdracht 3.3.elf" "opdracht 3.3.a" "opdracht 3.3.hex" "opdracht 3.3.lss" "opdracht 3.3.eep" "opdracht 3.3.map" "opdracht 3.3.srec" "opdracht 3.3.usersignatures"

View File

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

View File

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

View File

@@ -0,0 +1,262 @@
opdracht 3.3.elf: file format elf32-avr
Sections:
Idx Name Size VMA LMA File off Algn
0 .data 00000000 00800100 00800100 00000196 2**0
CONTENTS, ALLOC, LOAD, DATA
1 .text 00000142 00000000 00000000 00000054 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .comment 00000030 00000000 00000000 00000196 2**0
CONTENTS, READONLY
3 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 000001c8 2**2
CONTENTS, READONLY
4 .debug_aranges 00000038 00000000 00000000 00000204 2**0
CONTENTS, READONLY, DEBUGGING
5 .debug_info 00000944 00000000 00000000 0000023c 2**0
CONTENTS, READONLY, DEBUGGING
6 .debug_abbrev 00000878 00000000 00000000 00000b80 2**0
CONTENTS, READONLY, DEBUGGING
7 .debug_line 00000317 00000000 00000000 000013f8 2**0
CONTENTS, READONLY, DEBUGGING
8 .debug_frame 00000068 00000000 00000000 00001710 2**2
CONTENTS, READONLY, DEBUGGING
9 .debug_str 0000046a 00000000 00000000 00001778 2**0
CONTENTS, READONLY, DEBUGGING
10 .debug_loc 000000b3 00000000 00000000 00001be2 2**0
CONTENTS, READONLY, DEBUGGING
11 .debug_ranges 00000028 00000000 00000000 00001c95 2**0
CONTENTS, READONLY, DEBUGGING
Disassembly of section .text:
00000000 <__vectors>:
0: 45 c0 rjmp .+138 ; 0x8c <__ctors_end>
2: 00 00 nop
4: 60 c0 rjmp .+192 ; 0xc6 <__bad_interrupt>
6: 00 00 nop
8: 5e c0 rjmp .+188 ; 0xc6 <__bad_interrupt>
a: 00 00 nop
c: 5c c0 rjmp .+184 ; 0xc6 <__bad_interrupt>
e: 00 00 nop
10: 5a c0 rjmp .+180 ; 0xc6 <__bad_interrupt>
12: 00 00 nop
14: 58 c0 rjmp .+176 ; 0xc6 <__bad_interrupt>
16: 00 00 nop
18: 56 c0 rjmp .+172 ; 0xc6 <__bad_interrupt>
1a: 00 00 nop
1c: 54 c0 rjmp .+168 ; 0xc6 <__bad_interrupt>
1e: 00 00 nop
20: 52 c0 rjmp .+164 ; 0xc6 <__bad_interrupt>
22: 00 00 nop
24: 69 c0 rjmp .+210 ; 0xf8 <__vector_9>
26: 00 00 nop
28: 4e c0 rjmp .+156 ; 0xc6 <__bad_interrupt>
2a: 00 00 nop
2c: 4c c0 rjmp .+152 ; 0xc6 <__bad_interrupt>
2e: 00 00 nop
30: 4a c0 rjmp .+148 ; 0xc6 <__bad_interrupt>
32: 00 00 nop
34: 48 c0 rjmp .+144 ; 0xc6 <__bad_interrupt>
36: 00 00 nop
38: 46 c0 rjmp .+140 ; 0xc6 <__bad_interrupt>
3a: 00 00 nop
3c: 44 c0 rjmp .+136 ; 0xc6 <__bad_interrupt>
3e: 00 00 nop
40: 42 c0 rjmp .+132 ; 0xc6 <__bad_interrupt>
42: 00 00 nop
44: 40 c0 rjmp .+128 ; 0xc6 <__bad_interrupt>
46: 00 00 nop
48: 3e c0 rjmp .+124 ; 0xc6 <__bad_interrupt>
4a: 00 00 nop
4c: 3c c0 rjmp .+120 ; 0xc6 <__bad_interrupt>
4e: 00 00 nop
50: 3a c0 rjmp .+116 ; 0xc6 <__bad_interrupt>
52: 00 00 nop
54: 38 c0 rjmp .+112 ; 0xc6 <__bad_interrupt>
56: 00 00 nop
58: 36 c0 rjmp .+108 ; 0xc6 <__bad_interrupt>
5a: 00 00 nop
5c: 34 c0 rjmp .+104 ; 0xc6 <__bad_interrupt>
5e: 00 00 nop
60: 32 c0 rjmp .+100 ; 0xc6 <__bad_interrupt>
62: 00 00 nop
64: 30 c0 rjmp .+96 ; 0xc6 <__bad_interrupt>
66: 00 00 nop
68: 2e c0 rjmp .+92 ; 0xc6 <__bad_interrupt>
6a: 00 00 nop
6c: 2c c0 rjmp .+88 ; 0xc6 <__bad_interrupt>
6e: 00 00 nop
70: 2a c0 rjmp .+84 ; 0xc6 <__bad_interrupt>
72: 00 00 nop
74: 28 c0 rjmp .+80 ; 0xc6 <__bad_interrupt>
76: 00 00 nop
78: 26 c0 rjmp .+76 ; 0xc6 <__bad_interrupt>
7a: 00 00 nop
7c: 24 c0 rjmp .+72 ; 0xc6 <__bad_interrupt>
7e: 00 00 nop
80: 22 c0 rjmp .+68 ; 0xc6 <__bad_interrupt>
82: 00 00 nop
84: 20 c0 rjmp .+64 ; 0xc6 <__bad_interrupt>
86: 00 00 nop
88: 1e c0 rjmp .+60 ; 0xc6 <__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: e2 e4 ldi r30, 0x42 ; 66
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: a0 30 cpi r26, 0x00 ; 0
ae: b1 07 cpc r27, r17
b0: d9 f7 brne .-10 ; 0xa8 <__do_copy_data+0x10>
000000b2 <__do_clear_bss>:
b2: 21 e0 ldi r18, 0x01 ; 1
b4: a0 e0 ldi r26, 0x00 ; 0
b6: b1 e0 ldi r27, 0x01 ; 1
b8: 01 c0 rjmp .+2 ; 0xbc <.do_clear_bss_start>
000000ba <.do_clear_bss_loop>:
ba: 1d 92 st X+, r1
000000bc <.do_clear_bss_start>:
bc: a0 30 cpi r26, 0x00 ; 0
be: b2 07 cpc r27, r18
c0: e1 f7 brne .-8 ; 0xba <.do_clear_bss_loop>
c2: 34 d0 rcall .+104 ; 0x12c <main>
c4: 3c c0 rjmp .+120 ; 0x13e <_exit>
000000c6 <__bad_interrupt>:
c6: 9c cf rjmp .-200 ; 0x0 <__vectors>
000000c8 <wait>:
#define BIT(x) (1 << (x))
// wait(): busy waiting for 'ms' millisecond
// Used library: util/delay.h
void wait( int ms ) {
for (int tms=0; tms<ms; tms++) {
c8: 20 e0 ldi r18, 0x00 ; 0
ca: 30 e0 ldi r19, 0x00 ; 0
cc: 08 c0 rjmp .+16 ; 0xde <wait+0x16>
#else
//round up by default
__ticks_dc = (uint32_t)(ceil(fabs(__tmp)));
#endif
__builtin_avr_delay_cycles(__ticks_dc);
ce: e3 ec ldi r30, 0xC3 ; 195
d0: f9 e0 ldi r31, 0x09 ; 9
d2: 31 97 sbiw r30, 0x01 ; 1
d4: f1 f7 brne .-4 ; 0xd2 <wait+0xa>
d6: 00 c0 rjmp .+0 ; 0xd8 <wait+0x10>
d8: 00 00 nop
da: 2f 5f subi r18, 0xFF ; 255
dc: 3f 4f sbci r19, 0xFF ; 255
de: 28 17 cp r18, r24
e0: 39 07 cpc r19, r25
e2: ac f3 brlt .-22 ; 0xce <wait+0x6>
_delay_ms( 1 ); // library function (max 30 ms at 8MHz)
}
}
e4: 08 95 ret
000000e6 <timer2Init>:
volatile int msCount = 0;
void timer2Init( void ) {
OCR2 = 150; //155 // Compare value of counter 2
e6: 86 e9 ldi r24, 0x96 ; 150
e8: 83 bd out 0x23, r24 ; 35
TIMSK |= BIT(7); // T2 compare match interrupt enable
ea: 87 b7 in r24, 0x37 ; 55
ec: 80 68 ori r24, 0x80 ; 128
ee: 87 bf out 0x37, r24 ; 55
sei(); // turn_on intr all
f0: 78 94 sei
TCCR2 = 0b00001101; // Initialize T2: timer, prescaler=32, compare output disconnected,CTC,RUN
f2: 8d e0 ldi r24, 0x0D ; 13
f4: 85 bd out 0x25, r24 ; 37
f6: 08 95 ret
000000f8 <__vector_9>:
}
unsigned int msThersh = 15;
ISR( TIMER2_COMP_vect ) {
f8: 1f 92 push r1
fa: 0f 92 push r0
fc: 0f b6 in r0, 0x3f ; 63
fe: 0f 92 push r0
100: 11 24 eor r1, r1
102: 8f 93 push r24
104: 9f 93 push r25
PORTC ^= BIT(0);
106: 95 b3 in r25, 0x15 ; 21
108: 81 e0 ldi r24, 0x01 ; 1
10a: 89 27 eor r24, r25
10c: 85 bb out 0x15, r24 ; 21
if(OCR2 == 250){
10e: 83 b5 in r24, 0x23 ; 35
110: 8a 3f cpi r24, 0xFA ; 250
112: 19 f4 brne .+6 ; 0x11a <__vector_9+0x22>
OCR2 = 150;
114: 86 e9 ldi r24, 0x96 ; 150
116: 83 bd out 0x23, r24 ; 35
118: 02 c0 rjmp .+4 ; 0x11e <__vector_9+0x26>
} else {
OCR2 = 250;
11a: 8a ef ldi r24, 0xFA ; 250
11c: 83 bd out 0x23, r24 ; 35
}
}
11e: 9f 91 pop r25
120: 8f 91 pop r24
122: 0f 90 pop r0
124: 0f be out 0x3f, r0 ; 63
126: 0f 90 pop r0
128: 1f 90 pop r1
12a: 18 95 reti
0000012c <main>:
int main( void ) {
DDRC = 0xFF;
12c: 8f ef ldi r24, 0xFF ; 255
12e: 84 bb out 0x14, r24 ; 20
PORTC = BIT(0); // set PORTC for output (toggle PC0)
130: 81 e0 ldi r24, 0x01 ; 1
132: 85 bb out 0x15, r24 ; 21
timer2Init();
134: d8 df rcall .-80 ; 0xe6 <timer2Init>
while (1) {
// do something else
wait(10); // every 10 ms (busy waiting
136: 8a e0 ldi r24, 0x0A ; 10
138: 90 e0 ldi r25, 0x00 ; 0
13a: c6 df rcall .-116 ; 0xc8 <wait>
13c: fc cf rjmp .-8 ; 0x136 <main+0xa>
0000013e <_exit>:
13e: f8 94 cli
00000140 <__stop_program>:
140: ff cf rjmp .-2 ; 0x140 <__stop_program>

View File

@@ -0,0 +1,23 @@
S01400006F7064726163687420332E332E7372656307
S113000045C0000060C000005EC000005CC000008D
S11300105AC0000058C0000056C0000054C0000080
S113002052C0000069C000004EC000004CC0000077
S11300304AC0000048C0000046C0000044C00000A0
S113004042C0000040C000003EC000003CC00000B0
S11300503AC0000038C0000036C0000034C00000C0
S113006032C0000030C000002EC000002CC00000D0
S11300702AC0000028C0000026C0000024C00000E0
S113008022C0000020C000001EC0000011241FBEBA
S1130090CFEFD0E1DEBFCDBF11E0A0E0B1E0E2E4FC
S11300A0F1E000E00BBF02C007900D92A030B10751
S11300B0D9F721E0A0E0B1E001C01D92A030B20761
S11300C0E1F734D03CC09CCF20E030E008C0E3EC42
S11300D0F9E03197F1F700C000002F5F3F4F281778
S11300E03907ACF3089586E983BD87B7806887BF75
S11300F078948DE085BD08951F920F920FB60F92EC
S113010011248F939F9395B381E0892785BB83B591
S11301108A3F19F486E983BD02C08AEF83BD9F91AB
S11301208F910F900FBE0F901F9018958FEF84BB87
S113013081E085BBD8DF8AE090E0C6DFFCCFF8948D
S1050140FFCFEB
S9030000FC

View File

@@ -0,0 +1,52 @@
/*
* timer_t2_ms.c
*
* Created: 21/02/2021 13:20:32
* Author : Etienne
*/
#define F_CPU 10e6
#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#define BIT(x) (1 << (x))
// wait(): busy waiting for 'ms' millisecond
// Used library: util/delay.h
void wait( int ms ) {
for (int tms=0; tms<ms; tms++) {
_delay_ms( 1 ); // library function (max 30 ms at 8MHz)
}
}
volatile int msCount = 0;
void timer2Init( void ) {
OCR2 = 150; //155 // Compare value of counter 2
TIMSK |= BIT(7); // T2 compare match interrupt enable
sei(); // turn_on intr all
TCCR2 = 0b00001101; // Initialize T2: timer, prescaler=32, compare output disconnected,CTC,RUN
}
unsigned int msThersh = 15;
ISR( TIMER2_COMP_vect ) {
PORTC ^= BIT(0);
if(OCR2 == 250){
OCR2 = 150;
} else {
OCR2 = 250;
}
}
int main( void ) {
DDRC = 0xFF;
PORTC = BIT(0); // set PORTC for output (toggle PC0)
timer2Init();
while (1) {
// do something else
wait(10); // every 10 ms (busy waiting
}
}

View 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>rR6mgUtO8q2QLIRcSnx1LA==</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>

View File

@@ -0,0 +1,130 @@
<?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>{985d5c75-f61e-49f1-a532-66a1e6141552}</ProjectGuid>
<avrdevice>ATmega128</avrdevice>
<avrdeviceseries>none</avrdeviceseries>
<OutputType>Executable</OutputType>
<Language>C</Language>
<OutputFileName>$(MSBuildProjectName)</OutputFileName>
<OutputFileExtension>.elf</OutputFileExtension>
<OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory>
<AssemblyName>opdracht 3.3</AssemblyName>
<Name>opdracht 3.3</Name>
<RootNamespace>opdracht 3.3</RootNamespace>
<ToolchainFlavour>Native</ToolchainFlavour>
<KeepTimersRunning>true</KeepTimersRunning>
<OverrideVtor>false</OverrideVtor>
<CacheFlash>true</CacheFlash>
<ProgFlashFromRam>true</ProgFlashFromRam>
<RamSnippetAddress />
<UncachedRange />
<preserveEEPROM>true</preserveEEPROM>
<OverrideVtorValue />
<BootSegment>2</BootSegment>
<ResetRule>0</ResetRule>
<eraseonlaunchrule>0</eraseonlaunchrule>
<EraseKey />
<AsfFrameworkConfig>
<framework-data xmlns="">
<options />
<configurations />
<files />
<documentation help="" />
<offline-documentation help="" />
<dependencies>
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.49.1" />
</dependencies>
</framework-data>
</AsfFrameworkConfig>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<ToolchainSettings>
<AvrGcc>
<avrgcc.common.Device>-mmcu=atmega128 -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\gcc\dev\atmega128"</avrgcc.common.Device>
<avrgcc.common.optimization.RelaxBranches>True</avrgcc.common.optimization.RelaxBranches>
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
<avrgcc.compiler.symbols.DefSymbols>
<ListValues>
<Value>NDEBUG</Value>
</ListValues>
</avrgcc.compiler.symbols.DefSymbols>
<avrgcc.compiler.directories.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\include\</Value>
</ListValues>
</avrgcc.compiler.directories.IncludePaths>
<avrgcc.compiler.optimization.level>Optimize for size (-Os)</avrgcc.compiler.optimization.level>
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
<avrgcc.linker.libraries.Libraries>
<ListValues>
<Value>libm</Value>
</ListValues>
</avrgcc.linker.libraries.Libraries>
<avrgcc.assembler.general.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\include\</Value>
</ListValues>
</avrgcc.assembler.general.IncludePaths>
</AvrGcc>
</ToolchainSettings>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<ToolchainSettings>
<AvrGcc>
<avrgcc.common.Device>-mmcu=atmega128 -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\gcc\dev\atmega128"</avrgcc.common.Device>
<avrgcc.common.optimization.RelaxBranches>True</avrgcc.common.optimization.RelaxBranches>
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
<avrgcc.compiler.symbols.DefSymbols>
<ListValues>
<Value>DEBUG</Value>
</ListValues>
</avrgcc.compiler.symbols.DefSymbols>
<avrgcc.compiler.directories.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\include\</Value>
</ListValues>
</avrgcc.compiler.directories.IncludePaths>
<avrgcc.compiler.optimization.level>Optimize debugging experience (-Og)</avrgcc.compiler.optimization.level>
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
<avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel>
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
<avrgcc.linker.libraries.Libraries>
<ListValues>
<Value>libm</Value>
</ListValues>
</avrgcc.linker.libraries.Libraries>
<avrgcc.assembler.general.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\include\</Value>
</ListValues>
</avrgcc.assembler.general.IncludePaths>
<avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel>
</AvrGcc>
</ToolchainSettings>
</PropertyGroup>
<ItemGroup>
<Compile Include="main.c">
<SubType>compile</SubType>
</Compile>
</ItemGroup>
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
</Project>

View File

@@ -0,0 +1,139 @@
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
SHELL := cmd.exe
RM := rm -rf
USER_OBJS :=
LIBS :=
PROJ :=
O_SRCS :=
C_SRCS :=
S_SRCS :=
S_UPPER_SRCS :=
OBJ_SRCS :=
ASM_SRCS :=
PREPROCESSING_SRCS :=
OBJS :=
OBJS_AS_ARGS :=
C_DEPS :=
C_DEPS_AS_ARGS :=
EXECUTABLES :=
OUTPUT_FILE_PATH :=
OUTPUT_FILE_PATH_AS_ARGS :=
AVR_APP_PATH :=$$$AVR_APP_PATH$$$
QUOTE := "
ADDITIONAL_DEPENDENCIES:=
OUTPUT_FILE_DEP:=
LIB_DEP:=
LINKER_SCRIPT_DEP:=
# Every subdirectory with source files must be described here
SUBDIRS :=
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../lcd_control.c \
../main.c
PREPROCESSING_SRCS +=
ASM_SRCS +=
OBJS += \
lcd_control.o \
main.o
OBJS_AS_ARGS += \
lcd_control.o \
main.o
C_DEPS += \
lcd_control.d \
main.d
C_DEPS_AS_ARGS += \
lcd_control.d \
main.d
OUTPUT_FILE_PATH +=opdracht\ 4.1.elf
OUTPUT_FILE_PATH_AS_ARGS +="opdracht 4.1.elf"
ADDITIONAL_DEPENDENCIES:=
OUTPUT_FILE_DEP:= ./makedep.mk
LIB_DEP+=
LINKER_SCRIPT_DEP+=
# AVR32/GNU C Compiler
./lcd_control.o: .././lcd_control.c
@echo Building file: $<
@echo Invoking: AVR/GNU C Compiler : 5.4.0
$(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -x c -funsigned-char -funsigned-bitfields -DDEBUG -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\include" -Og -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=atmega128 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\gcc\dev\atmega128" -c -std=gnu99 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<"
@echo Finished building: $<
./main.o: .././main.c
@echo Building file: $<
@echo Invoking: AVR/GNU C Compiler : 5.4.0
$(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -x c -funsigned-char -funsigned-bitfields -DDEBUG -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\include" -Og -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=atmega128 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\gcc\dev\atmega128" -c -std=gnu99 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<"
@echo Finished building: $<
# AVR32/GNU Preprocessing Assembler
# AVR32/GNU Assembler
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS)
endif
endif
# Add inputs and outputs from these tool invocations to the build variables
# All Target
all: $(OUTPUT_FILE_PATH) $(ADDITIONAL_DEPENDENCIES)
$(OUTPUT_FILE_PATH): $(OBJS) $(USER_OBJS) $(OUTPUT_FILE_DEP) $(LIB_DEP) $(LINKER_SCRIPT_DEP)
@echo Building target: $@
@echo Invoking: AVR/GNU Linker : 5.4.0
$(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -o$(OUTPUT_FILE_PATH_AS_ARGS) $(OBJS_AS_ARGS) $(USER_OBJS) $(LIBS) -Wl,-Map="opdracht 4.1.map" -Wl,--start-group -Wl,-lm -Wl,--end-group -Wl,--gc-sections -mrelax -mmcu=atmega128 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\gcc\dev\atmega128"
@echo Finished building target: $@
"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objcopy.exe" -O ihex -R .eeprom -R .fuse -R .lock -R .signature -R .user_signatures "opdracht 4.1.elf" "opdracht 4.1.hex"
"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objcopy.exe" -j .eeprom --set-section-flags=.eeprom=alloc,load --change-section-lma .eeprom=0 --no-change-warnings -O ihex "opdracht 4.1.elf" "opdracht 4.1.eep" || exit 0
"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objdump.exe" -h -S "opdracht 4.1.elf" > "opdracht 4.1.lss"
"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objcopy.exe" -O srec -R .eeprom -R .fuse -R .lock -R .signature -R .user_signatures "opdracht 4.1.elf" "opdracht 4.1.srec"
"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-size.exe" "opdracht 4.1.elf"
# Other Targets
clean:
-$(RM) $(OBJS_AS_ARGS) $(EXECUTABLES)
-$(RM) $(C_DEPS_AS_ARGS)
rm -rf "opdracht 4.1.elf" "opdracht 4.1.a" "opdracht 4.1.hex" "opdracht 4.1.lss" "opdracht 4.1.eep" "opdracht 4.1.map" "opdracht 4.1.srec" "opdracht 4.1.usersignatures"

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,147 @@
S01400006F7064726163687420342E312E7372656308
S113000045C0000058C0000056C0000054C00000A5
S113001052C0000050C000004EC000004CC00000A0
S11300204AC000003BC1000046C0000044C00000BC
S113003042C0000040C000003EC000003CC00000C0
S11300403AC0000038C0000036C0000034C00000D0
S113005032C0000030C000002EC000002CC00000E0
S11300602AC0000028C0000026C0000024C00000F0
S113007022C0000020C000001EC000001CC0000000
S11300801AC0000018C0000016C0000011241FBED2
S1130090CFEFD0E1DEBFCDBF11E0A0E0B1E0E4EFEF
S11300A0F8E000E00BBF02C007900D92A430B10746
S11300B0D9F711D11DC4A4CF9BB321E030E002C015
S11300C0220F331F8A95E2F7292B2BBB08959BB38C
S11300D021E030E002C0220F331F8A95E2F7209519
S11300E029232BBB089586E090E0E6DF89EF90E0BA
S11300F00197F1F700C0000086E090E0E8DF89EFA7
S113010090E00197F1F700C000000895CF93C82F45
S113011085BB84E090E0D0DFE6DFC295C07FC5BB3D
S113012084E090E0C9DFDFDFCF910895CF93C82F3B
S113013085BB84E090E0CBDFD6DFC295C07FC5BB32
S113014084E090E0C4DFCFDFCF91089581E0EEDF5B
S113015083EF91E00197F1F700C0000080E8E6CF5B
S11301600895CF938FEF84BB85BB8ABB15BA1BBAA6
S1130170C0E2C5BBB8DFC5BBB6DF80E885BBB3DF73
S113018015BAB1DF80EF85BBAEDF15BAACDF80E610
S113019085BBA9DF82E0CADFA6DFCF910895CF93A4
S11301A0DF93EC0102C0B2DF219688818111FBCF7D
S11301B0DF91CF910895AF92BF92CF92DF92EF92E9
S11301C0FF920F931F93CF93DF93CDB7DEB76C01EC
S11301D0ADB6BEB601969F938F930F2EF0E0EF2E2F
S11301E0F1E0FF2EF02DFF92EF921F921F921F92CB
S11301F01F9295D001962DB73EB7285F3F4F0FB69B
S1130200F8943EBF0FBE2DBF281B390B0FB6F894D0
S11302103EBF0FBE2DBF0DB71EB70F5F1F4FDF923E
S1130220CF92FF92EF929F938F931F930F9377D068
S1130230802F912FB4DF8DB79EB708960FB6F89430
S11302409EBF0FBE8DBF0FB6F894BEBE0FBEADBE2F
S1130250DF91CF911F910F91FF90EF90DF90CF909E
S1130260BF90AF90089520E030E008C0EFECF7E0D5
S11302703197F1F700C000002F5F3F4F281739076F
S1130280ACF3089580EE87B986E886B9089587B7F8
S1130290806887BF789483E085BD08951F920F928C
S11302A00FB60F9211248F9386B1806486B98F9113
S11302B00F900FBE0F901F90189585B190E0880F96
S11302C0991F880F991F24B122952695269523708E
S11302D0820F911D0895109261008FEF82B9D2DFD1
S11302E040DF8FE19EE40197F1F700C000002EDFAC
S11302F0CEDF80E090E025B122BB24B123B9C5B1A3
S1130300D0E08C179D0731F021DF8AE090E0ABDF6D
S1130310D4DF51DF84E690E0A6DFCE01ECCF0F936B
S11303201F93CF93DF93CDB7DEB72E970FB6F89414
S1130330DEBF0FBECDBF0D891E898F89988D26E043
S11303402C831A83098397FF02C080E090E8019709
S11303509E838D83AE01455E5F4F698D7A8DCE019C
S1130360019619D04D815E8157FD0AC02F813885D1
S1130370421753070CF49A01F801E20FF31F10829D
S11303802E960FB6F894DEBF0FBECDBFDF91CF918E
S11303901F910F9108952F923F924F925F926F9207
S11303A07F928F929F92AF92BF92CF92DF92EF9201
S11303B0FF920F931F93CF93DF93CDB7DEB72B97A5
S11303C00FB6F894DEBF0FBECDBF6C017B018A016E
S11303D0FC0117821682838181FFBFC1CE01019681
S11303E03C01F6019381F70193FD859193FF81917F
S11303F07F01882309F4ADC1853239F493FD8591D9
S113040093FF81917F01853221F4B60190E0D6D12A
S1130410E8CF912C212C312CFFE1F315D8F08B324D
S113042079F038F4803279F08332A1F4232D2061FD
S11304301DC08D3261F0803369F4232D216016C014
S1130440832D8260382EE32DE4603E2E2AC0F32DE6
S1130450F8601DC037FC2DC020ED280F2A3040F075
S11304608E32B9F436FC75C1232D2064322E19C0A6
S113047036FE06C08AE0989E200D1124922E11C0EB
S1130480EAE02E9E200D1124222EF32DF0623F2E41
S113049008C08C3621F4832D8068382E02C088363B
S11304A041F4F70193FD859193FF81917F018111BF
S11304B0B3CF982F9F7D9554933028F40C5F1F4F32
S11304C09FE399830DC0833631F0833771F0833510
S11304D009F055C020C0F801808189830E5F1F4F49
S11304E088248394912C530112C02801F2E04F0E0A
S11304F0511CF801A080B18036FE03C0692D70E064
S113050002C06FEF7FEFC5014ED14C018201F32D84
S1130510FF773F2E15C0280122E0420E511CF8013E
S1130520A080B18036FE03C0692D70E002C06FEF79
S11305307FEFC5012DD14C01F32DF0683F2E8201D0
S113054033FC19C0822D90E088169906A0F4B601F8
S113055080E290E033D12A94F5CFF50137FC859100
S113056037FE81915F01B60190E028D121102A94D1
S113057021E0821A91088114910479F7E1C084364C
S113058011F0893639F5F80137FE07C060817181B1
S1130590828193810C5F1F4F08C060817181072E97
S11305A0000C880B990B0E5F1F4FF32DFF763F2E27
S11305B097FF09C090958095709561957F4F8F4FF7
S11305C09F4FF0683F2E2AE030E0A30133D1882EFC
S11305D0861844C0853731F4232D2F7EB22E2AE0AD
S11305E030E025C0932D997FB92E8F36C1F018F4D1
S11305F0883579F0AEC0803719F0883721F0A9C06A
S1130600E92FE061BE2EB4FE0DC0FB2DF460BF2EB9
S113061009C034FE0AC0292F2660B22E06C028E085
S113062030E005C020E130E002C020E132E0F80112
S1130630B7FE07C060817181828193810C5F1F4F77
S113064006C06081718180E090E00E5F1F4FA301BE
S1130650F1D0882E8618FB2DFF773F2E36FE0DC075
S1130660232D2E7FA22E891458F434FE0BC032FCA5
S113067009C0832D8E7EA82E05C0B82CA32C03C0E0
S1130680B82C01C0B92CA4FE0FC0FE01E80DF11D69
S11306908081803321F49A2D997EA92E09C0A2FE6F
S11306A006C0B394B39404C08A2D867809F0B39439
S11306B0A3FC10C0A0FE06C0B21480F4280C922C37
S11306C09B180DC0B21458F4B60180E290E076D0C5
S11306D0B394F8CFB21418F42B1802C0982C212C20
S11306E0A4FE0FC0B60180E390E068D0A2FE16C05D
S11306F0A1FC03C088E790E002C088E590E0B60161
S11307000CC08A2D867851F0A1FE02C08BE201C094
S113071080E2A7FC8DE2B60190E050D0891430F459
S1130720B60180E390E04AD09A94F8CF8A94F3011A
S1130730E80DF11D8081B60190E040D08110F6CF24
S1130740222009F44ECEB60180E290E037D02A94FC
S1130750F7CFF6018681978102C08FEF9FEF2B962A
S11307600FB6F894DEBF0FBECDBFDF91CF911F91BE
S11307700F91FF90EF90DF90CF90BF90AF909F903C
S11307808F907F906F905F904F903F902F9008953F
S1130790FC010590615070400110D8F78095909548
S11307A08E0F9F1F0895FC0161507040019001104D
S11307B0D8F7809590958E0F9F1F08950F931F93E0
S11307C0CF93DF93FB01238121FD03C08FEF9FEFC4
S11307D02CC022FF16C046815781248135814217DF
S11307E0530744F4A081B1819D012F5F3F4F3183B2
S11307F020838C93268137812F5F3F4F3783268355
S113080014C08B01EC01FB010084F185E02D0995F6
S1130810892BE1F6D80116968D919C911797019634
S113082017969C938E931697CE01DF91CF911F91CB
S11308300F910895FA01AA27283051F1203181F14E
S1130840E8946F936E7F6E5F7F4F8F4F9F4FAF4FD4
S1130850B1E03ED0B4E03CD0670F781F891F9A1FE7
S1130860A11D680F791F8A1F911DA11D6A0F711D9B
S1130870811D911DA11D20D009F468943F912AE0A7
S1130880269F11243019305D3193DEF6CF0108958F
S1130890462F4770405D4193B3E00FD0C9F7F6CFC0
S11308A0462F4F70405D4A3318F0495D31FD405288
S11308B0419302D0A9F7EACFB4E0A695979587951E
S11308C077956795BA95C9F70097610571050895FD
S11308D09B01AC010A2E06945795479537952795A9
S11308E0BA95C9F7620F731F841F951FA01D089541
S10708F0F894FFCFA6
S10708F42564000073
S9030000FC

View File

@@ -0,0 +1,130 @@
/*
* lcd_controlc.c
*
* Created: 24-2-2021 11:55:12
* Author: Sem
*/
#include <stdio.h>
#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#include "lcd_control.h"
void _delay_ms(double __ms);
void lcd_clear() {
lcd_write_command (0x01); //Leeg display
_delay_ms(2);
lcd_write_command (0x80); //Cursor terug naar start
}
void lcd_strobe_lcd_e(void) {
sbi_porta(LCD_E); // E high
_delay_ms(1);
cbi_porta(LCD_E); // E low
_delay_ms(1);
}
void sbi_portc(int index){
PORTC |= (1<<index);
}
void cbi_portc(int index){
PORTC &= ~(1<<index);
}
void sbi_porta(int index){
PORTA |= (1<<index);
}
void cbi_porta(int index){
PORTA &= ~(1<<index);
}
void init_4bits_mode(void) {
// PORTC output mode and all low (also E and RS pin)
// Init I/O
DDRC = 0xFF; // PORTD(7) output, PORTD(6:0) input
PORTC = 0xFF;
DDRA = 0xFF;
PORTC = 0x00;
PORTA = 0x00;
PORTC = 0x20; // function for 4-bit 1 row
lcd_strobe_lcd_e();
PORTC = 0x20; // function high nibble 4-bit 2 row
lcd_strobe_lcd_e();
PORTC = 0x80; // function low nibble 4-bit 2 row
lcd_strobe_lcd_e();
PORTC = 0x00; // function high nibble turn on visible blinking-block cursor
lcd_strobe_lcd_e();
PORTC = 0xF0; // function low nibble turn on visible blinking-block cursor
lcd_strobe_lcd_e();
PORTC = 0x00; // Entry mode set high nibble
lcd_strobe_lcd_e();
PORTC = 0x60; // Entry mode set low nibble
lcd_strobe_lcd_e();
// return home
lcd_write_command(0x02);
lcd_strobe_lcd_e();
}
void lcd_write_integer(int number){
int length = snprintf(NULL, 0, "%d", number + 1);
char str[length + 1];
snprintf(str, length + 1, "%d", number);
lcd_write_string(str);
}
void lcd_write_character(unsigned char byte){
//upper nibble
PORTC = byte;
sbi_porta(LCD_RS);
lcd_strobe_lcd_e();
//lower nibble
PORTC = (byte<<4);
sbi_porta(LCD_RS);
lcd_strobe_lcd_e();
}
void lcd_write_command(unsigned char byte){
//upper nibble
PORTC = byte;
cbi_porta(LCD_RS);
lcd_strobe_lcd_e();
//lower nibble
PORTC = (byte<<4);
cbi_porta(LCD_RS);
lcd_strobe_lcd_e();
}
void lcd_write_string(const char *str) {
for(;*str; str++){
lcd_write_character(*str);
}
}
void lcd_move_right(void){
lcd_write_command(0x1E);
}

View File

@@ -0,0 +1,31 @@
/*
* lcd_control.h
*
* Created: 24-2-2021 11:56:16
* Author: Sem
*/
#ifndef LCD_CONTROL_H_
#define LCD_CONTROL_H_
#define LCD_E 6
#define LCD_RS 4
void _delay_ms(double __ms);
void lcd_strobe_lcd_e(void);
void sbi_portc(int index);
void cbi_portc(int index);
void sbi_porta(int index);
void cbi_porta(int index);
void init_4bits_mode(void);
void lcd_write_string(const char *str);
void lcd_write_character(unsigned char byte);
void lcd_write_command(unsigned char byte);
void lcd_write_integer(int number);
void lcd_move_right(void);
void lcd_clear();
#endif /* LCD_CONTROL_H_ */

View File

@@ -0,0 +1,83 @@
/*
* opdracht 4.1.c
*
* Created: 03-Mar-21 9:26:31 AM
* Author : lemms
*/
#define F_CPU 8e6
#include <stdio.h>
#include <stdlib.h>
#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#include "lcd_control.h"
#define BIT(x) (1 << (x))
void wait( int ms ) {
for (int tms=0; tms<ms; tms++) {
_delay_ms( 1 ); // library function (max 30 ms at 8MHz)
}
}
void adcInit(){
ADMUX = 0b11100000; // internal reference: 2.56V and SEI on ADC0 and left-adjusted.
ADCSRA = 0b10000110; // enable ADC. No free-run. Clock 64 D-factor.
}
void timer2Init( void ) {
TIMSK |= BIT(7); // T2 compare match interrupt enable
sei(); // turn_on interrupt all
TCCR2 = 0b00000011; // Initialize T2: timer, pre-scaler=64
}
ISR( TIMER2_COMP_vect ) {
ADCSRA |= BIT(6);
}
int getADCValue(){
int value = 0;
value = ADCH;
value <<= 2;
value += (ADCL >> 6);
return value;
}
int main(void)
{
int previousValue = 0;
/* Replace with your application code */
DDRF = 0x00; // set port F input.
DDRE = 0xFF; // all port A output.
adcInit();
init_4bits_mode();
_delay_ms(10);
lcd_clear();
timer2Init();
while (1)
{
PORTD = ADCH;
PORTE = ADCL;
int number = ADCH;
if(previousValue != number){
lcd_clear();
wait(10);
lcd_write_integer(getADCValue());
}
previousValue = number;
wait(100);
}
}

View 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>ocUBw/Ju1i9iTulaRbeRxg==</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>

View File

@@ -0,0 +1,136 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
<ProjectVersion>7.0</ProjectVersion>
<ToolchainName>com.Atmel.AVRGCC8.C</ToolchainName>
<ProjectGuid>{2432e6bf-da1e-4668-99bb-59fea1f5b8a2}</ProjectGuid>
<avrdevice>ATmega128</avrdevice>
<avrdeviceseries>none</avrdeviceseries>
<OutputType>Executable</OutputType>
<Language>C</Language>
<OutputFileName>$(MSBuildProjectName)</OutputFileName>
<OutputFileExtension>.elf</OutputFileExtension>
<OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory>
<AssemblyName>opdracht 4.1</AssemblyName>
<Name>opdracht 4.1</Name>
<RootNamespace>opdracht 4.1</RootNamespace>
<ToolchainFlavour>Native</ToolchainFlavour>
<KeepTimersRunning>true</KeepTimersRunning>
<OverrideVtor>false</OverrideVtor>
<CacheFlash>true</CacheFlash>
<ProgFlashFromRam>true</ProgFlashFromRam>
<RamSnippetAddress />
<UncachedRange />
<preserveEEPROM>true</preserveEEPROM>
<OverrideVtorValue />
<BootSegment>2</BootSegment>
<ResetRule>0</ResetRule>
<eraseonlaunchrule>0</eraseonlaunchrule>
<EraseKey />
<AsfFrameworkConfig>
<framework-data xmlns="">
<options />
<configurations />
<files />
<documentation help="" />
<offline-documentation help="" />
<dependencies>
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.49.1" />
</dependencies>
</framework-data>
</AsfFrameworkConfig>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<ToolchainSettings>
<AvrGcc>
<avrgcc.common.Device>-mmcu=atmega128 -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\gcc\dev\atmega128"</avrgcc.common.Device>
<avrgcc.common.optimization.RelaxBranches>True</avrgcc.common.optimization.RelaxBranches>
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
<avrgcc.compiler.symbols.DefSymbols>
<ListValues>
<Value>NDEBUG</Value>
</ListValues>
</avrgcc.compiler.symbols.DefSymbols>
<avrgcc.compiler.directories.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\include\</Value>
</ListValues>
</avrgcc.compiler.directories.IncludePaths>
<avrgcc.compiler.optimization.level>Optimize for size (-Os)</avrgcc.compiler.optimization.level>
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
<avrgcc.linker.libraries.Libraries>
<ListValues>
<Value>libm</Value>
</ListValues>
</avrgcc.linker.libraries.Libraries>
<avrgcc.assembler.general.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\include\</Value>
</ListValues>
</avrgcc.assembler.general.IncludePaths>
</AvrGcc>
</ToolchainSettings>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<ToolchainSettings>
<AvrGcc>
<avrgcc.common.Device>-mmcu=atmega128 -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\gcc\dev\atmega128"</avrgcc.common.Device>
<avrgcc.common.optimization.RelaxBranches>True</avrgcc.common.optimization.RelaxBranches>
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
<avrgcc.compiler.symbols.DefSymbols>
<ListValues>
<Value>DEBUG</Value>
</ListValues>
</avrgcc.compiler.symbols.DefSymbols>
<avrgcc.compiler.directories.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\include\</Value>
</ListValues>
</avrgcc.compiler.directories.IncludePaths>
<avrgcc.compiler.optimization.level>Optimize debugging experience (-Og)</avrgcc.compiler.optimization.level>
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
<avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel>
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
<avrgcc.linker.libraries.Libraries>
<ListValues>
<Value>libm</Value>
</ListValues>
</avrgcc.linker.libraries.Libraries>
<avrgcc.assembler.general.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\include\</Value>
</ListValues>
</avrgcc.assembler.general.IncludePaths>
<avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel>
</AvrGcc>
</ToolchainSettings>
</PropertyGroup>
<ItemGroup>
<Compile Include="lcd_control.c">
<SubType>compile</SubType>
</Compile>
<Compile Include="lcd_control.h">
<SubType>compile</SubType>
</Compile>
<Compile Include="main.c">
<SubType>compile</SubType>
</Compile>
</ItemGroup>
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
</Project>

View File

@@ -0,0 +1,67 @@
/*
* opdracht 4.b1.c
*
* Created: 3-3-2021 10:54:49
* Author : Sem
*/
/************************************************************************/
/* Verander het programma (voor kanaal 3 en voor 8 bits) zodat het alleen een AD-conversie uitvoert
als jij dat wilt, dus op aanvraag. Maak daarvoor in main() een eindeloze lus met een wachtfunctie
en een start voor de ADC (Zie ook code in de repository). */
/************************************************************************/
#define F_CPU 10e6
#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#define BIT(x) (1 << (x))
// wait(): busy waiting for 'ms' millisecond
// Used library: util/delay.h
void wait( int ms )
{
for (int tms=0; tms<ms; tms++)
{
_delay_ms( 1 ); // library function (max 30 ms at 8MHz)
}
}
// Initialize ADC: 10-bits (left justified), no free running
void adcInit( void )
{
sei(); // enable interrupts
ADMUX = 0b01100011; // AREF=VCC, result left adjusted, channel3 at pin PF3
ADCSRA = 0b10001110; // ADC-enable, start conversion mode, no free running, interrupt enable
}
/************************************************************************/
/* starts AD converstion by setting bit 6 in ADCSRA to 1 */
/************************************************************************/
void startConversion(void) {
ADCSRA |= BIT(6);
}
// Main program: ADC at PF1
int main( void )
{
DDRF = 0x00; // set PORTF for input (ADC)
DDRA = 0xFF; // set PORTA for output
DDRB = 0xFF; // set PORTB for output
adcInit(); // initialize ADC
while (1)
{
PORTB = ADCL; // Show MSB/LSB (bit 10:0) of ADC
PORTA = ADCH;
startConversion();
wait(100); // every 100 ms (busy waiting)
}
}

View 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>LGMXRdW4vmSlRGAAGvj3wQ==</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>

View File

@@ -0,0 +1,46 @@
<?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>{314fe495-a311-499d-b63e-4b5e7b7f2054}</ProjectGuid>
<avrdevice>ATmega128</avrdevice>
<avrdeviceseries>none</avrdeviceseries>
<OutputType>Executable</OutputType>
<Language>C</Language>
<OutputFileName>$(MSBuildProjectName)</OutputFileName>
<OutputFileExtension>.elf</OutputFileExtension>
<OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory>
<AssemblyName>opdracht 4.b1</AssemblyName>
<Name>opdracht 4.b1</Name>
<RootNamespace>opdracht 4.b1</RootNamespace>
<ToolchainFlavour>Native</ToolchainFlavour>
<KeepTimersRunning>true</KeepTimersRunning>
<OverrideVtor>false</OverrideVtor>
<CacheFlash>true</CacheFlash>
<ProgFlashFromRam>true</ProgFlashFromRam>
<RamSnippetAddress />
<UncachedRange />
<preserveEEPROM>true</preserveEEPROM>
<OverrideVtorValue />
<BootSegment>2</BootSegment>
<ResetRule>0</ResetRule>
<eraseonlaunchrule>0</eraseonlaunchrule>
<EraseKey />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<ToolchainSettings>
</ToolchainSettings>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<ToolchainSettings>
</ToolchainSettings>
</PropertyGroup>
<ItemGroup>
<Compile Include="main.c">
<SubType>compile</SubType>
</Compile>
</ItemGroup>
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
</Project>

View File

@@ -0,0 +1,139 @@
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
SHELL := cmd.exe
RM := rm -rf
USER_OBJS :=
LIBS :=
PROJ :=
O_SRCS :=
C_SRCS :=
S_SRCS :=
S_UPPER_SRCS :=
OBJ_SRCS :=
ASM_SRCS :=
PREPROCESSING_SRCS :=
OBJS :=
OBJS_AS_ARGS :=
C_DEPS :=
C_DEPS_AS_ARGS :=
EXECUTABLES :=
OUTPUT_FILE_PATH :=
OUTPUT_FILE_PATH_AS_ARGS :=
AVR_APP_PATH :=$$$AVR_APP_PATH$$$
QUOTE := "
ADDITIONAL_DEPENDENCIES:=
OUTPUT_FILE_DEP:=
LIB_DEP:=
LINKER_SCRIPT_DEP:=
# Every subdirectory with source files must be described here
SUBDIRS :=
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../lcd_control.c \
../main.c
PREPROCESSING_SRCS +=
ASM_SRCS +=
OBJS += \
lcd_control.o \
main.o
OBJS_AS_ARGS += \
lcd_control.o \
main.o
C_DEPS += \
lcd_control.d \
main.d
C_DEPS_AS_ARGS += \
lcd_control.d \
main.d
OUTPUT_FILE_PATH +=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
./lcd_control.o: .././lcd_control.c
@echo Building file: $<
@echo Invoking: AVR/GNU C Compiler : 5.4.0
$(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -x c -funsigned-char -funsigned-bitfields -DDEBUG -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\include" -Og -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=atmega128 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\gcc\dev\atmega128" -c -std=gnu99 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<"
@echo Finished building: $<
./main.o: .././main.c
@echo Building file: $<
@echo Invoking: AVR/GNU C Compiler : 5.4.0
$(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -x c -funsigned-char -funsigned-bitfields -DDEBUG -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\include" -Og -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=atmega128 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\gcc\dev\atmega128" -c -std=gnu99 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<"
@echo Finished building: $<
# AVR32/GNU Preprocessing Assembler
# AVR32/GNU Assembler
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS)
endif
endif
# Add inputs and outputs from these tool invocations to the build variables
# All Target
all: $(OUTPUT_FILE_PATH) $(ADDITIONAL_DEPENDENCIES)
$(OUTPUT_FILE_PATH): $(OBJS) $(USER_OBJS) $(OUTPUT_FILE_DEP) $(LIB_DEP) $(LINKER_SCRIPT_DEP)
@echo Building target: $@
@echo Invoking: AVR/GNU Linker : 5.4.0
$(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -o$(OUTPUT_FILE_PATH_AS_ARGS) $(OBJS_AS_ARGS) $(USER_OBJS) $(LIBS) -Wl,-Map="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"

View File

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

View File

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

View 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 000004a0 00000000 00000000 00001c24 2**0
CONTENTS, READONLY, DEBUGGING
10 .debug_loc 00000299 00000000 00000000 000020c4 2**0
CONTENTS, READONLY, DEBUGGING
11 .debug_ranges 00000048 00000000 00000000 0000235d 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>

View 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

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

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

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

View File

@@ -0,0 +1,151 @@
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
SHELL := cmd.exe
RM := rm -rf
USER_OBJS :=
LIBS :=
PROJ :=
O_SRCS :=
C_SRCS :=
S_SRCS :=
S_UPPER_SRCS :=
OBJ_SRCS :=
ASM_SRCS :=
PREPROCESSING_SRCS :=
OBJS :=
OBJS_AS_ARGS :=
C_DEPS :=
C_DEPS_AS_ARGS :=
EXECUTABLES :=
OUTPUT_FILE_PATH :=
OUTPUT_FILE_PATH_AS_ARGS :=
AVR_APP_PATH :=$$$AVR_APP_PATH$$$
QUOTE := "
ADDITIONAL_DEPENDENCIES:=
OUTPUT_FILE_DEP:=
LIB_DEP:=
LINKER_SCRIPT_DEP:=
# Every subdirectory with source files must be described here
SUBDIRS :=
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../lcd_control.c \
../main.c \
../ultrasonic_sensor.c
PREPROCESSING_SRCS +=
ASM_SRCS +=
OBJS += \
lcd_control.o \
main.o \
ultrasonic_sensor.o
OBJS_AS_ARGS += \
lcd_control.o \
main.o \
ultrasonic_sensor.o
C_DEPS += \
lcd_control.d \
main.d \
ultrasonic_sensor.d
C_DEPS_AS_ARGS += \
lcd_control.d \
main.d \
ultrasonic_sensor.d
OUTPUT_FILE_PATH +=ultrasonicSensor.elf
OUTPUT_FILE_PATH_AS_ARGS +=ultrasonicSensor.elf
ADDITIONAL_DEPENDENCIES:=
OUTPUT_FILE_DEP:= ./makedep.mk
LIB_DEP+=
LINKER_SCRIPT_DEP+=
# AVR32/GNU C Compiler
./lcd_control.o: .././lcd_control.c
@echo Building file: $<
@echo Invoking: AVR/GNU C Compiler : 5.4.0
$(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -x c -funsigned-char -funsigned-bitfields -DDEBUG -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\include" -Og -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=atmega128 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\gcc\dev\atmega128" -c -std=gnu99 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<"
@echo Finished building: $<
./main.o: .././main.c
@echo Building file: $<
@echo Invoking: AVR/GNU C Compiler : 5.4.0
$(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -x c -funsigned-char -funsigned-bitfields -DDEBUG -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\include" -Og -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=atmega128 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.6.364\gcc\dev\atmega128" -c -std=gnu99 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<"
@echo Finished building: $<
./ultrasonic_sensor.o: .././ultrasonic_sensor.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="ultrasonicSensor.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 "ultrasonicSensor.elf" "ultrasonicSensor.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 "ultrasonicSensor.elf" "ultrasonicSensor.eep" || exit 0
"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objdump.exe" -h -S "ultrasonicSensor.elf" > "ultrasonicSensor.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 "ultrasonicSensor.elf" "ultrasonicSensor.srec"
"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-size.exe" "ultrasonicSensor.elf"
# Other Targets
clean:
-$(RM) $(OBJS_AS_ARGS) $(EXECUTABLES)
-$(RM) $(C_DEPS_AS_ARGS)
rm -rf "ultrasonicSensor.elf" "ultrasonicSensor.a" "ultrasonicSensor.hex" "ultrasonicSensor.lss" "ultrasonicSensor.eep" "ultrasonicSensor.map" "ultrasonicSensor.srec" "ultrasonicSensor.usersignatures"

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,154 @@
S0180000756C747261736F6E696353656E736F722E737265634E
S113000045C0000038C100005EC000005CC00000B4
S11300105AC0000058C0000056C0000054C0000080
S113002052C0000050C000004EC000004CC0000090
S11300304AC0000048C0000046C0000044C00000A0
S113004042C0000040C000003EC000003CC00000B0
S11300503AC0000038C0000036C0000034C00000C0
S113006032C0000030C000002EC000002CC00000D0
S11300702AC0000028C0000026C0000024C00000E0
S113008022C0000020C000001EC0000011241FBEBA
S1130090CFEFD0E1DEBFCDBF11E0A0E0B1E0E8E6F4
S11300A0F9E000E00BBF02C007900D92A430B10745
S11300B0D9F721E0A4E0B1E001C01D92A630B20757
S11300C0E1F700D14FC49CCF9BB321E030E002C0E4
S11300D0220F331F8A95E2F7292B2BBB08959BB37C
S11300E021E030E002C0220F331F8A95E2F7209509
S11300F029232BBB089586E090E0E6DF83EC99E0AA
S11301000197F1F700C0000086E090E0E8DF83EC9F
S113011099E00197F1F700C000000895CF93C82F2C
S113012085BB84E090E0D0DFE6DFC295C07FC5BB2D
S113013084E090E0C9DFDFDFCF910895CF93C82F2B
S113014085BB84E090E0CBDFD6DFC295C07FC5BB22
S113015084E090E0C4DFCFDFCF91089581E0EEDF4B
S113016087E893E10197F1F700C0000080E8E6CF4B
S11301700895CF938FEF84BB85BB8ABB15BA1BBA96
S1130180C0E2C5BBB8DFC5BBB6DF80E885BBB3DF63
S113019015BAB1DF80EF85BBAEDF15BAACDF80E600
S11301A085BBA9DF82E0CADFA6DFCF910895CF9394
S11301B0DF93EC0102C0B2DF219688818111FBCF6D
S11301C0DF91CF910895AF92BF92CF92DF92EF92D9
S11301D0FF920F931F93CF93DF93CDB7DEB7D82E43
S11301E0C92EADB6BEB69F938F930F2EF1E0EF2EBE
S11301F0F1E0FF2EF02DFF92EF921F921F921F92BB
S11302001F92C7D001962DB73EB7285F3F4F0FB658
S1130210F8943EBF0FBE2DBF281B390B0FB6F894C0
S11302203EBF0FBE2DBF0DB71EB70F5F1F4FCF923E
S1130230DF92FF92EF929F938F931F930F93A9D016
S1130240802F912FB4DF8DB79EB708960FB6F89420
S11302509EBF0FBE8DBF0FB6F894BEBE0FBEADBE1F
S1130260DF91CF911F910F91FF90EF90DF90CF908E
S1130270BF90AF9008951F920F920FB60F92112462
S11302800BB60F922F933F934F935F936F937F938C
S11302908F939F93AF93BF93EF93FF935CD0FF91A2
S11302A0EF91BF91AF919F918F917F916F915F91EA
S11302B04F913F912F910F900BBE0F900FBE0F9057
S11302C01F9018952CD055DF87EA91E60197F1F736
S11302D000C0000043DF32D041DF56D074DF84E633
S11302E090E00ED0F8CF20E030E006C043E04A951D
S11302F0F1F700002F5F3F4F28173907B8F308952F
S113030020E030E008C0E3ECF9E03197F1F700C0F9
S113031000002F5F3F4F28173907A8F308958FEF88
S11303208093640011BA83E080936A0089B7816086
S113033089BF1FBC8CE08EBD78940895CF93DF9362
S1130340C5E6D0E018828AE090E0CDDF81E08883C2
S1130350DF91CF91089580910001813041F482E0D2
S113036080936A001DBC1CBC10920001089583E0B8
S113037080936A008CB59DB5909305018093040128
S113038081E080930001089580910401909105011A
S113039008950F931F93CF93DF93CDB7DEB72E97B6
S11303A00FB6F894DEBF0FBECDBF0D891E898F89AD
S11303B0988D26E02C831A83098397FF02C080E07E
S11303C090E801979E838D83AE01455E5F4F698DF2
S11303D07A8DCE01019619D04D815E8157FD0AC0F8
S11303E02F813885421753070CF49A01F801E20F64
S11303F0F31F10822E960FB6F894DEBF0FBECDBF4A
S1130400DF91CF911F910F9108952F923F924F92B8
S11304105F926F927F928F929F92AF92BF92CF9290
S1130420DF92EF92FF920F931F93CF93DF93CDB799
S1130430DEB72B970FB6F894DEBF0FBECDBF6C01AD
S11304407B018A01FC0117821682838181FFBFC16F
S1130450CE0101963C01F6019381F70193FD85914C
S113046093FF81917F01882309F4ADC1853239F46A
S113047093FD859193FF81917F01853221F4B6012B
S113048090E0D6D1E8CF912C212C312CFFE1F3154B
S1130490D8F08B3279F038F4803279F08332A1F4D9
S11304A0232D20611DC08D3261F0803369F4232D2A
S11304B0216016C0832D8260382EE32DE4603E2E29
S11304C02AC0F32DF8601DC037FC2DC020ED280F85
S11304D02A3040F08E32B9F436FC75C1232D2064E5
S11304E0322E19C036FE06C08AE0989E200D1124D3
S11304F0922E11C0EAE02E9E200D1124222EF32DFF
S1130500F0623F2E08C08C3621F4832D8068382E8B
S113051002C0883641F4F70193FD859193FF8191E0
S11305207F018111B3CF982F9F7D9554933028F488
S11305300C5F1F4F9FE399830DC0833631F08337DF
S113054071F0833509F055C020C0F801808189839A
S11305500E5F1F4F88248394912C530112C02801ED
S1130560F2E04F0E511CF801A080B18036FE03C0AA
S1130570692D70E002C06FEF7FEFC5014ED14C01D1
S11305808201F32DFF773F2E15C0280122E0420E91
S1130590511CF801A080B18036FE03C0692D70E0C3
S11305A002C06FEF7FEFC5012DD14C01F32DF06830
S11305B03F2E820133FC19C0822D90E088169906E3
S11305C0A0F4B60180E290E033D12A94F5CFF5018E
S11305D037FC859137FE81915F01B60190E028D107
S11305E021102A9421E0821A91088114910479F748
S11305F0E1C0843611F0893639F5F80137FE07C0B9
S113060060817181828193810C5F1F4F08C060817A
S11306107181072E000C880B990B0E5F1F4FF32D71
S1130620FF763F2E97FF09C0909580957095619550
S11306307F4F8F4F9F4FF0683F2E2AE030E0A30199
S113064033D1882E861844C0853731F4232D2F7E6C
S1130650B22E2AE030E025C0932D997FB92E8F3633
S1130660C1F018F4883579F0AEC0803719F08837B6
S113067021F0A9C0E92FE061BE2EB4FE0DC0FB2D10
S1130680F460BF2E09C034FE0AC0292F2660B22EA2
S113069006C028E030E005C020E130E002C020E1DF
S11306A032E0F801B7FE07C06081718182819381D5
S11306B00C5F1F4F06C06081718180E090E00E5F87
S11306C01F4FA301F1D0882E8618FB2DFF773F2EF4
S11306D036FE0DC0232D2E7FA22E891458F434FE2D
S11306E00BC032FC09C0832D8E7EA82E05C0B82C09
S11306F0A32C03C0B82C01C0B92CA4FE0FC0FE016A
S1130700E80DF11D8081803321F49A2D997EA92E64
S113071009C0A2FE06C0B394B39404C08A2D86789F
S113072009F0B394A3FC10C0A0FE06C0B21480F478
S1130730280C922C9B180DC0B21458F4B60180E218
S113074090E076D0B394F8CFB21418F42B1802C00A
S1130750982C212CA4FE0FC0B60180E390E068D051
S1130760A2FE16C0A1FC03C088E790E002C088E5A1
S113077090E0B6010CC08A2D867851F0A1FE02C02B
S11307808BE201C080E2A7FC8DE2B60190E050D07C
S1130790891430F4B60180E390E04AD09A94F8CFFB
S11307A08A94F301E80DF11D8081B60190E040D0F8
S11307B08110F6CF222009F44ECEB60180E290E0FB
S11307C037D02A94F7CFF6018681978102C08FEF44
S11307D09FEF2B960FB6F894DEBF0FBECDBFDF910F
S11307E0CF911F910F91FF90EF90DF90CF90BF902A
S11307F0AF909F908F907F906F905F904F903F90BD
S11308002F900895FC010590615070400110D8F7B5
S1130810809590958E0F9F1F0895FC016150704044
S113082001900110D8F7809590958E0F9F1F089521
S11308300F931F93CF93DF93FB01238121FD03C00B
S11308408FEF9FEF2CC022FF16C046815781248171
S113085035814217530744F4A081B1819D012F5F74
S11308603F4F318320838C93268137812F5F3F4F05
S11308703783268314C08B01EC01FB010084F185CE
S1130880E02D0995892BE1F6D80116968D919C915E
S11308901797019617969C938E931697CE01DF9126
S11308A0CF911F910F910895FA01AA27283051F191
S11308B0203181F1E8946F936E7F6E5F7F4F8F4F8D
S11308C09F4FAF4FB1E03ED0B4E03CD0670F781FEC
S11308D0891F9A1FA11D680F791F8A1F911DA11DD1
S11308E06A0F711D811D911DA11D20D009F468940A
S11308F03F912AE0269F11243019305D3193DEF6B2
S1130900CF010895462F4770405D4193B3E00FD067
S1130910C9F7F6CF462F4F70405D4A3318F0495D52
S113092031FD4052419302D0A9F7EACFB4E0A69535
S11309309795879577956795BA95C9F70097610557
S1130940710508959B01AC010A2E069457954795AD
S113095037952795BA95C9F7620F731F841F951FA2
S10B0960A01D0895F894FFCFD7
S107096801256400FD
S9030000FC

View File

@@ -0,0 +1,132 @@
/*
* lcd_controlc.c
*
* Created: 24-2-2021 11:55:12
* Author: Sem
*/
#define F_CPU 10e6
#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#include <stdlib.h>
#include <stdio.h>
#include "lcd_control.h"
void _delay_ms(double __ms);
void lcd_clear() {
lcd_write_command (0x01); //Leeg display
_delay_ms(2);
lcd_write_command (0x80); //Cursor terug naar start
}
void lcd_strobe_lcd_e(void) {
sbi_porta(LCD_E); // E high
_delay_ms(1);
cbi_porta(LCD_E); // E low
_delay_ms(1);
}
void sbi_portc(int index){
PORTC |= (1<<index);
}
void cbi_portc(int index){
PORTC &= ~(1<<index);
}
void sbi_porta(int index){
PORTA |= (1<<index);
}
void cbi_porta(int index){
PORTA &= ~(1<<index);
}
void init_4bits_mode(void) {
// PORTC output mode and all low (also E and RS pin)
// Init I/O
DDRC = 0xFF; // PORTD(7) output, PORTD(6:0) input
PORTC = 0xFF;
DDRA = 0xFF;
PORTC = 0x00;
PORTA = 0x00;
PORTC = 0x20; // function for 4-bit 1 row
lcd_strobe_lcd_e();
PORTC = 0x20; // function high nibble 4-bit 2 row
lcd_strobe_lcd_e();
PORTC = 0x80; // function low nibble 4-bit 2 row
lcd_strobe_lcd_e();
PORTC = 0x00; // function high nibble turn on visible blinking-block cursor
lcd_strobe_lcd_e();
PORTC = 0xF0; // function low nibble turn on visible blinking-block cursor
lcd_strobe_lcd_e();
PORTC = 0x00; // Entry mode set high nibble
lcd_strobe_lcd_e();
PORTC = 0x60; // Entry mode set low nibble
lcd_strobe_lcd_e();
// return home
lcd_write_command(0x02);
lcd_strobe_lcd_e();
}
void lcd_write_character(unsigned char byte){
//upper nibble
PORTC = byte;
sbi_porta(LCD_RS);
lcd_strobe_lcd_e();
//lower nibble
PORTC = (byte<<4);
sbi_porta(LCD_RS);
lcd_strobe_lcd_e();
}
void lcd_write_command(unsigned char byte){
//upper nibble
PORTC = byte;
cbi_porta(LCD_RS);
lcd_strobe_lcd_e();
//lower nibble
PORTC = (byte<<4);
cbi_porta(LCD_RS);
lcd_strobe_lcd_e();
}
void lcd_write_string(const char *str) {
for(;*str; str++){
lcd_write_character(*str);
}
}
void lcd_move_right(void){
lcd_write_command(0x1E);
}
void lcd_write_int(int number)
{
int length = snprintf(NULL, 0, "%d", number);
char str[length + 1];
snprintf(str, length + 1, "%d", number);
lcd_write_string(str);
}

View File

@@ -0,0 +1,30 @@
/*
* lcd_control.h
*
* Created: 24-2-2021 11:56:16
* Author: Sem
*/
#ifndef LCD_CONTROL_H_
#define LCD_CONTROL_H_
#define LCD_E 6
#define LCD_RS 4
void _delay_ms(double __ms);
void lcd_strobe_lcd_e(void);
void sbi_portc(int index);
void cbi_portc(int index);
void sbi_porta(int index);
void cbi_porta(int index);
void init_4bits_mode(void);
void lcd_write_string(const char *str);
void lcd_write_character(unsigned char byte);
void lcd_write_command(unsigned char byte);
void lcd_clear();
void lcd_write_int(int number);
#endif /* LCD_CONTROL_H_ */

View File

@@ -0,0 +1,58 @@
/*
* ultrasonicSensor.c
*
* Created: 17-3-2021 09:47:12
* Author : Sem
interrupt op rising edge in echo,
dan timer1 aanzetten -> timer1 want 16 bits en willen nauwkeurig afstand kunnen meten, en afstand kan van 2 cm tot 4 m, dus willen zeker zijn dat het past
en interrupt zetten op falling edge in echo
als falling edge interrupt geeft ->
waarde uit timer1 uitlezen
en formule gebruiken high level time * velocity (340M/S) / 2
timer1 uitzetten
interrupt weer op rising edge van echo zetten
*/
#define F_CPU 10e6
#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#include "lcd_control.h"
#include "ultrasonic_sensor.h"
ISR(INT0_vect)
{
ultrasonic_handle_interrupt();
}
int main(void)
{
ultrasonic_init();
init_4bits_mode();
_delay_ms(10);
lcd_clear();
while (1)
{
ultrasonic_send_pulse();
lcd_clear();
lcd_write_int(ultrasonic_get_timer_dist());
wait_ms(100);
}
}

View 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>zBFq/2TxUzr5xF+6ABRBCw==</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>

View File

@@ -0,0 +1,130 @@
<?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>{26da64de-dd48-4718-94b5-81f9ec5d4b33}</ProjectGuid>
<avrdevice>ATmega128</avrdevice>
<avrdeviceseries>none</avrdeviceseries>
<OutputType>Executable</OutputType>
<Language>C</Language>
<OutputFileName>$(MSBuildProjectName)</OutputFileName>
<OutputFileExtension>.elf</OutputFileExtension>
<OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory>
<AssemblyName>ultrasonicSensor</AssemblyName>
<Name>ultrasonicSensor</Name>
<RootNamespace>ultrasonicSensor</RootNamespace>
<ToolchainFlavour>Native</ToolchainFlavour>
<KeepTimersRunning>true</KeepTimersRunning>
<OverrideVtor>false</OverrideVtor>
<CacheFlash>true</CacheFlash>
<ProgFlashFromRam>true</ProgFlashFromRam>
<RamSnippetAddress />
<UncachedRange />
<preserveEEPROM>true</preserveEEPROM>
<OverrideVtorValue />
<BootSegment>2</BootSegment>
<ResetRule>0</ResetRule>
<eraseonlaunchrule>0</eraseonlaunchrule>
<EraseKey />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<ToolchainSettings>
<AvrGcc>
<avrgcc.common.Device>-mmcu=atmega128 -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\gcc\dev\atmega128"</avrgcc.common.Device>
<avrgcc.common.optimization.RelaxBranches>True</avrgcc.common.optimization.RelaxBranches>
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
<avrgcc.compiler.symbols.DefSymbols>
<ListValues>
<Value>NDEBUG</Value>
</ListValues>
</avrgcc.compiler.symbols.DefSymbols>
<avrgcc.compiler.directories.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\include\</Value>
</ListValues>
</avrgcc.compiler.directories.IncludePaths>
<avrgcc.compiler.optimization.level>Optimize for size (-Os)</avrgcc.compiler.optimization.level>
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
<avrgcc.linker.libraries.Libraries>
<ListValues>
<Value>libm</Value>
</ListValues>
</avrgcc.linker.libraries.Libraries>
<avrgcc.assembler.general.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\include\</Value>
</ListValues>
</avrgcc.assembler.general.IncludePaths>
</AvrGcc>
</ToolchainSettings>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<ToolchainSettings>
<AvrGcc>
<avrgcc.common.Device>-mmcu=atmega128 -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\gcc\dev\atmega128"</avrgcc.common.Device>
<avrgcc.common.optimization.RelaxBranches>True</avrgcc.common.optimization.RelaxBranches>
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
<avrgcc.compiler.symbols.DefSymbols>
<ListValues>
<Value>DEBUG</Value>
</ListValues>
</avrgcc.compiler.symbols.DefSymbols>
<avrgcc.compiler.directories.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\include\</Value>
</ListValues>
</avrgcc.compiler.directories.IncludePaths>
<avrgcc.compiler.optimization.level>Optimize debugging experience (-Og)</avrgcc.compiler.optimization.level>
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
<avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel>
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
<avrgcc.linker.libraries.Libraries>
<ListValues>
<Value>libm</Value>
</ListValues>
</avrgcc.linker.libraries.Libraries>
<avrgcc.assembler.general.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.6.364\include\</Value>
</ListValues>
</avrgcc.assembler.general.IncludePaths>
<avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel>
</AvrGcc>
</ToolchainSettings>
</PropertyGroup>
<ItemGroup>
<Compile Include="lcd_control.c">
<SubType>compile</SubType>
</Compile>
<Compile Include="lcd_control.h">
<SubType>compile</SubType>
</Compile>
<Compile Include="main.c">
<SubType>compile</SubType>
</Compile>
<Compile Include="ultrasonic_sensor.c">
<SubType>compile</SubType>
</Compile>
<Compile Include="ultrasonic_sensor.h">
<SubType>compile</SubType>
</Compile>
</ItemGroup>
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
</Project>

View File

@@ -0,0 +1,91 @@
/*
* ultrasonic_sensor.c
*
* Created: 24-3-2021 13:04:52
* Author: Sem
*/
#define F_CPU 10e6
#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#include "lcd_control.h"
static uint16_t timer_dist = 0;
enum interrupt_status {INTERRUPT_FALLING, INTERRUPT_RISING};
static enum interrupt_status int_stat = INTERRUPT_RISING;
void wait_us(unsigned int us)
{
for(int i = 0; i < us; i++)
{
_delay_us(1);
}
}
void wait_ms(unsigned int ms)
{
for(int i = 0; i < ms; i++)
{
_delay_ms(1);
}
}
void ultrasonic_init()
{
DDRG = 0xFF; // port g all output. pin 0 is trig, the rest is for debug
DDRD = 0x00; // port D pin 0 on input. 0 is echo and also interrupt
EICRA = 0x03; // interrupt PORTD on pin 0, rising edge
EIMSK |= 0x01; // enable interrupt on pin 0 (INT0)
TCCR1A = 0b00000000; // initialize timer1, prescaler=256
TCCR1B = 0b00001100; // CTC compare A, RUN
sei(); // turn on interrupt system
}
void ultrasonic_send_pulse()
{
PORTG = 0x00; // 10 us low pulse
wait_us(10);
PORTG = 0x01;
}
void ultrasonic_handle_interrupt()
{
// if the interrupt was generated on a rising edge (start sending echo)
if (int_stat == INTERRUPT_RISING)
{
// set interrupt pin 0 on PORTD to falling edge
EICRA = 0x02;
// reset the time in timer1
TCNT1 = 0x00;
// set interrupt status
int_stat = INTERRUPT_FALLING;
} else
// else if it was generated on a falling edge (end sending echo)
{
// set interrupt pin 0 on PORTD to rising edge
EICRA = 0x03;
// read timer1 into time_dist
timer_dist = TCNT1;
// set interrupt status
int_stat = INTERRUPT_RISING;
}
}
uint16_t ultrasonic_get_timer_dist()
{
return timer_dist;
}

View File

@@ -0,0 +1,12 @@
/*
* ultrasonic_sensor.h
*
* Created: 24-3-2021 13:14:50
* Author: Sem
*/
void ultrasonic_init();
void ultrasonic_send_pulse();
uint16_t ultrasonic_get_timer_dist();
void ultrasonic_handle_interrupt();