P4 Changed Interrupt PortB -> PortC; Unfinished implementation of PortB for teens

This commit is contained in:
S170H
2023-12-06 14:14:59 +01:00
parent c6080d47db
commit ee22ff0819
32 changed files with 1904 additions and 152 deletions

View File

@@ -0,0 +1,58 @@
#include <avr/io.h>
#include <avr/interrupt.h>
#define F_CPU 16000000UL // 16MHz clock frequency
#define LED_PIN PD0 // LED is connected to Pin D0
volatile uint32_t systemClock = 0;
void setupTimer0() {
// Configure Timer0 for CTC mode
TCCR0A |= (1 << WGM01); // Set Waveform Generation Mode bits for CTC
TCCR0B |= (1 << CS01) | (1 << CS00); // Set prescaler to 64
OCR0A = 249; // Set Output Compare Register to 249 for ~1ms interrupt
TIMSK0 |= (1 << OCIE0A); // Enable Timer0 Output Compare A Match interrupt
}
// Timer0 Output Compare A Match Interrupt Service Routine
ISR(TIMER0_COMPA_vect) {
systemClock++; // Increment the milliseconds counter
}
uint32_t getSystemClock(){
cli();
uint32_t tempSystemClock = systemClock;
sei();
return tempSystemClock;
}
void waitFor(uint32_t ms) {
uint32_t endTime = getSystemClock() + ms;
while (getSystemClock() != endTime);
}
void waitUntil(uint32_t ms) {
while (getSystemClock() != ms);
}
void initializeLED() {
DDRD |= (1 << LED_PIN); // Set LED_PIN as an output
}
void toggleLED() {
PORTD ^= (1 << LED_PIN); // Toggle the LED
}
int main(void) {
initializeLED(); // Initialize the LED pin
setupTimer0(); // Setup Timer0
//sei(); // Enable global interrupts
waitUntil(500); // Wait until 500 ms have passed
toggleLED(); // Toggle the LED to turn it on
while (1) {
waitFor(500); // Wait for 500 ms
toggleLED(); // Toggle the LED
}
}

Binary file not shown.

Binary file not shown.

View File

@@ -6,22 +6,22 @@
:100050000C9446000C9446000C9446000C94460008
:100060000C9446000C94460011241FBECFEFD8E03C
:10007000DEBFCDBF21E0A0E0B1E001C01D92A43001
:10008000B207E1F70E94B2000C94C8000C94000083
:10008000B207E1F70E94B7000C94CC000C9400007A
:1000900084B5826084BD85B5836085BD89EF87BDE9
:1000A000EEE6F0E080818260808308951F920F92D7
:1000B0000FB60F9211248F939F93AF93BF938091AC
:1000C000000190910101A0910201B09103010196FC
:1000D000A11DB11D8093000190930101A093020125
:1000E000B0930301BF91AF919F918F910F900FBE7D
:1000F0000F901F9018950F931F930091000110917E
:1001000001012091020130910301AB01BC01400FBC
:10011000511F621F731F8091000190910101A091F6
:100120000201B091030184179507A607B70798F35A
:100130001F910F910895AB01BC0180910001909136
:100140000101A0910201B091030184179507A60750
:10015000B70798F30895509A08959BB181E08927D5
:100160008BB908950E94AB000E944800789464EF18
:1001700071E080E090E00E949B000E94AD0064EF7F
:1001800071E080E090E00E947B000E94AD00F7CF1C
:04019000F894FFCF11
:1000F0000F901F901895F894609100017091010184
:10010000809102019091030178940895CF92DF923B
:10011000EF92FF926B017C010E947B00C60ED71EFE
:10012000E81EF91E0E947B00C616D706E806F906EF
:10013000C9F7FF90EF90DF90CF900895CF92DF92B4
:10014000EF92FF926B017C010E947B006C157D0594
:100150008E059F05C9F7FF90EF90DF90CF9008952F
:10016000509A08959BB181E089278BB908950E9428
:10017000B0000E94480064EF71E080E090E00E94CF
:100180009E000E94B20064EF71E080E090E00E9467
:0C01900086000E94B200F7CFF894FFCF69
:00000001FF

View File

@@ -3,31 +3,31 @@ P3.elf: file format elf32-avr
Sections:
Idx Name Size VMA LMA File off Algn
0 .data 00000000 00800100 00800100 00000208 2**0
0 .data 00000000 00800100 00800100 00000210 2**0
CONTENTS, ALLOC, LOAD, DATA
1 .text 00000194 00000000 00000000 00000074 2**1
1 .text 0000019c 00000000 00000000 00000074 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .bss 00000004 00800100 00800100 00000208 2**0
2 .bss 00000004 00800100 00800100 00000210 2**0
ALLOC
3 .comment 00000030 00000000 00000000 00000208 2**0
3 .comment 00000030 00000000 00000000 00000210 2**0
CONTENTS, READONLY
4 .note.gnu.avr.deviceinfo 00000040 00000000 00000000 00000238 2**2
4 .note.gnu.avr.deviceinfo 00000040 00000000 00000000 00000240 2**2
CONTENTS, READONLY
5 .debug_aranges 00000050 00000000 00000000 00000278 2**0
5 .debug_aranges 00000058 00000000 00000000 00000280 2**0
CONTENTS, READONLY, DEBUGGING
6 .debug_info 000007d8 00000000 00000000 000002c8 2**0
6 .debug_info 0000080e 00000000 00000000 000002d8 2**0
CONTENTS, READONLY, DEBUGGING
7 .debug_abbrev 000006b6 00000000 00000000 00000aa0 2**0
7 .debug_abbrev 000006c5 00000000 00000000 00000ae6 2**0
CONTENTS, READONLY, DEBUGGING
8 .debug_line 000002b4 00000000 00000000 00001156 2**0
8 .debug_line 000002d6 00000000 00000000 000011ab 2**0
CONTENTS, READONLY, DEBUGGING
9 .debug_frame 000000b0 00000000 00000000 0000140c 2**2
9 .debug_frame 000000dc 00000000 00000000 00001484 2**2
CONTENTS, READONLY, DEBUGGING
10 .debug_str 000003c7 00000000 00000000 000014bc 2**0
10 .debug_str 000003e6 00000000 00000000 00001560 2**0
CONTENTS, READONLY, DEBUGGING
11 .debug_loc 00000092 00000000 00000000 00001883 2**0
11 .debug_loc 00000197 00000000 00000000 00001946 2**0
CONTENTS, READONLY, DEBUGGING
12 .debug_ranges 00000040 00000000 00000000 00001915 2**0
12 .debug_ranges 00000048 00000000 00000000 00001add 2**0
CONTENTS, READONLY, DEBUGGING
Disassembly of section .text:
@@ -81,8 +81,8 @@ Disassembly of section .text:
7e: a4 30 cpi r26, 0x04 ; 4
80: b2 07 cpc r27, r18
82: e1 f7 brne .-8 ; 0x7c <.do_clear_bss_loop>
84: 0e 94 b2 00 call 0x164 ; 0x164 <main>
88: 0c 94 c8 00 jmp 0x190 ; 0x190 <_exit>
84: 0e 94 b7 00 call 0x16e ; 0x16e <main>
88: 0c 94 cc 00 jmp 0x198 ; 0x198 <_exit>
0000008c <__bad_interrupt>:
8c: 0c 94 00 00 jmp 0 ; 0x0 <__vectors>
@@ -149,106 +149,124 @@ ISR(TIMER0_COMPA_vect) {
f2: 1f 90 pop r1
f4: 18 95 reti
000000f6 <waitFor>:
000000f6 <getSystemClock>:
uint32_t getSystemClock(){
cli();
f6: f8 94 cli
uint32_t tempSystemClock = systemClock;
f8: 60 91 00 01 lds r22, 0x0100 ; 0x800100 <_edata>
fc: 70 91 01 01 lds r23, 0x0101 ; 0x800101 <_edata+0x1>
100: 80 91 02 01 lds r24, 0x0102 ; 0x800102 <_edata+0x2>
104: 90 91 03 01 lds r25, 0x0103 ; 0x800103 <_edata+0x3>
sei();
108: 78 94 sei
return tempSystemClock;
}
10a: 08 95 ret
0000010c <waitFor>:
void waitFor(uint32_t ms) {
f6: 0f 93 push r16
f8: 1f 93 push r17
uint32_t endTime = systemClock + ms;
fa: 00 91 00 01 lds r16, 0x0100 ; 0x800100 <_edata>
fe: 10 91 01 01 lds r17, 0x0101 ; 0x800101 <_edata+0x1>
102: 20 91 02 01 lds r18, 0x0102 ; 0x800102 <_edata+0x2>
106: 30 91 03 01 lds r19, 0x0103 ; 0x800103 <_edata+0x3>
10a: ab 01 movw r20, r22
10c: bc 01 movw r22, r24
10e: 40 0f add r20, r16
110: 51 1f adc r21, r17
112: 62 1f adc r22, r18
114: 73 1f adc r23, r19
while (systemClock < endTime);
116: 80 91 00 01 lds r24, 0x0100 ; 0x800100 <_edata>
11a: 90 91 01 01 lds r25, 0x0101 ; 0x800101 <_edata+0x1>
11e: a0 91 02 01 lds r26, 0x0102 ; 0x800102 <_edata+0x2>
122: b0 91 03 01 lds r27, 0x0103 ; 0x800103 <_edata+0x3>
126: 84 17 cp r24, r20
128: 95 07 cpc r25, r21
12a: a6 07 cpc r26, r22
12c: b7 07 cpc r27, r23
12e: 98 f3 brcs .-26 ; 0x116 <waitFor+0x20>
10c: cf 92 push r12
10e: df 92 push r13
110: ef 92 push r14
112: ff 92 push r15
114: 6b 01 movw r12, r22
116: 7c 01 movw r14, r24
uint32_t endTime = getSystemClock() + ms;
118: 0e 94 7b 00 call 0xf6 ; 0xf6 <getSystemClock>
11c: c6 0e add r12, r22
11e: d7 1e adc r13, r23
120: e8 1e adc r14, r24
122: f9 1e adc r15, r25
while (getSystemClock() != endTime);
124: 0e 94 7b 00 call 0xf6 ; 0xf6 <getSystemClock>
128: c6 16 cp r12, r22
12a: d7 06 cpc r13, r23
12c: e8 06 cpc r14, r24
12e: f9 06 cpc r15, r25
130: c9 f7 brne .-14 ; 0x124 <waitFor+0x18>
}
130: 1f 91 pop r17
132: 0f 91 pop r16
134: 08 95 ret
132: ff 90 pop r15
134: ef 90 pop r14
136: df 90 pop r13
138: cf 90 pop r12
13a: 08 95 ret
00000136 <waitUntil>:
0000013c <waitUntil>:
void waitUntil(uint32_t ms) {
136: ab 01 movw r20, r22
138: bc 01 movw r22, r24
while (systemClock < ms);
13a: 80 91 00 01 lds r24, 0x0100 ; 0x800100 <_edata>
13e: 90 91 01 01 lds r25, 0x0101 ; 0x800101 <_edata+0x1>
142: a0 91 02 01 lds r26, 0x0102 ; 0x800102 <_edata+0x2>
146: b0 91 03 01 lds r27, 0x0103 ; 0x800103 <_edata+0x3>
14a: 84 17 cp r24, r20
14c: 95 07 cpc r25, r21
14e: a6 07 cpc r26, r22
150: b7 07 cpc r27, r23
152: 98 f3 brcs .-26 ; 0x13a <waitUntil+0x4>
13c: cf 92 push r12
13e: df 92 push r13
140: ef 92 push r14
142: ff 92 push r15
144: 6b 01 movw r12, r22
146: 7c 01 movw r14, r24
while (getSystemClock() != ms);
148: 0e 94 7b 00 call 0xf6 ; 0xf6 <getSystemClock>
14c: 6c 15 cp r22, r12
14e: 7d 05 cpc r23, r13
150: 8e 05 cpc r24, r14
152: 9f 05 cpc r25, r15
154: c9 f7 brne .-14 ; 0x148 <waitUntil+0xc>
}
154: 08 95 ret
156: ff 90 pop r15
158: ef 90 pop r14
15a: df 90 pop r13
15c: cf 90 pop r12
15e: 08 95 ret
00000156 <initializeLED>:
00000160 <initializeLED>:
void initializeLED() {
DDRD |= (1 << LED_PIN); // Set LED_PIN as an output
156: 50 9a sbi 0x0a, 0 ; 10
158: 08 95 ret
160: 50 9a sbi 0x0a, 0 ; 10
162: 08 95 ret
0000015a <toggleLED>:
00000164 <toggleLED>:
}
void toggleLED() {
PORTD ^= (1 << LED_PIN); // Toggle the LED
15a: 9b b1 in r25, 0x0b ; 11
15c: 81 e0 ldi r24, 0x01 ; 1
15e: 89 27 eor r24, r25
160: 8b b9 out 0x0b, r24 ; 11
162: 08 95 ret
164: 9b b1 in r25, 0x0b ; 11
166: 81 e0 ldi r24, 0x01 ; 1
168: 89 27 eor r24, r25
16a: 8b b9 out 0x0b, r24 ; 11
16c: 08 95 ret
00000164 <main>:
0000016e <main>:
}
int main(void) {
initializeLED(); // Initialize the LED pin
164: 0e 94 ab 00 call 0x156 ; 0x156 <initializeLED>
16e: 0e 94 b0 00 call 0x160 ; 0x160 <initializeLED>
setupTimer0(); // Setup Timer0
168: 0e 94 48 00 call 0x90 ; 0x90 <setupTimer0>
sei(); // Enable global interrupts
16c: 78 94 sei
172: 0e 94 48 00 call 0x90 ; 0x90 <setupTimer0>
//sei(); // Enable global interrupts
waitUntil(500); // Wait until 500 ms have passed
16e: 64 ef ldi r22, 0xF4 ; 244
170: 71 e0 ldi r23, 0x01 ; 1
172: 80 e0 ldi r24, 0x00 ; 0
174: 90 e0 ldi r25, 0x00 ; 0
176: 0e 94 9b 00 call 0x136 ; 0x136 <waitUntil>
176: 64 ef ldi r22, 0xF4 ; 244
178: 71 e0 ldi r23, 0x01 ; 1
17a: 80 e0 ldi r24, 0x00 ; 0
17c: 90 e0 ldi r25, 0x00 ; 0
17e: 0e 94 9e 00 call 0x13c ; 0x13c <waitUntil>
toggleLED(); // Toggle the LED to turn it on
17a: 0e 94 ad 00 call 0x15a ; 0x15a <toggleLED>
182: 0e 94 b2 00 call 0x164 ; 0x164 <toggleLED>
while (1) {
waitFor(500); // Wait for 500 ms
17e: 64 ef ldi r22, 0xF4 ; 244
180: 71 e0 ldi r23, 0x01 ; 1
182: 80 e0 ldi r24, 0x00 ; 0
184: 90 e0 ldi r25, 0x00 ; 0
186: 0e 94 7b 00 call 0xf6 ; 0xf6 <waitFor>
186: 64 ef ldi r22, 0xF4 ; 244
188: 71 e0 ldi r23, 0x01 ; 1
18a: 80 e0 ldi r24, 0x00 ; 0
18c: 90 e0 ldi r25, 0x00 ; 0
18e: 0e 94 86 00 call 0x10c ; 0x10c <waitFor>
toggleLED(); // Toggle the LED
18a: 0e 94 ad 00 call 0x15a ; 0x15a <toggleLED>
18e: f7 cf rjmp .-18 ; 0x17e <main+0x1a>
192: 0e 94 b2 00 call 0x164 ; 0x164 <toggleLED>
196: f7 cf rjmp .-18 ; 0x186 <main+0x18>
00000190 <_exit>:
190: f8 94 cli
00000198 <_exit>:
198: f8 94 cli
00000192 <__stop_program>:
192: ff cf rjmp .-2 ; 0x192 <__stop_program>
0000019a <__stop_program>:
19a: ff cf rjmp .-2 ; 0x19a <__stop_program>

View File

@@ -169,7 +169,7 @@ END GROUP
.rela.plt
*(.rela.plt)
.text 0x00000000 0x194
.text 0x00000000 0x19c
*(.vectors)
.vectors 0x00000000 0x68 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.2.209/gcc/dev/atmega328p/avr5/crtatmega328p.o
0x00000000 __vector_default
@@ -259,24 +259,27 @@ END GROUP
.text.__vector_14
0x000000ac 0x4a main.o
0x000000ac __vector_14
.text.waitFor 0x000000f6 0x40 main.o
0x000000f6 waitFor
.text.getSystemClock
0x000000f6 0x16 main.o
0x000000f6 getSystemClock
.text.waitFor 0x0000010c 0x30 main.o
0x0000010c waitFor
.text.waitUntil
0x00000136 0x20 main.o
0x00000136 waitUntil
0x0000013c 0x24 main.o
0x0000013c waitUntil
.text.initializeLED
0x00000156 0x4 main.o
0x00000156 initializeLED
0x00000160 0x4 main.o
0x00000160 initializeLED
.text.toggleLED
0x0000015a 0xa main.o
0x0000015a toggleLED
.text.main 0x00000164 0x2c main.o
0x00000164 main
0x00000190 . = ALIGN (0x2)
0x00000164 0xa main.o
0x00000164 toggleLED
.text.main 0x0000016e 0x2a main.o
0x0000016e main
0x00000198 . = ALIGN (0x2)
*(.fini9)
.fini9 0x00000190 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_exit.o)
0x00000190 _exit
0x00000190 exit
.fini9 0x00000198 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_exit.o)
0x00000198 _exit
0x00000198 exit
*(.fini9)
*(.fini8)
*(.fini8)
@@ -295,11 +298,11 @@ END GROUP
*(.fini1)
*(.fini1)
*(.fini0)
.fini0 0x00000190 0x4 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_exit.o)
.fini0 0x00000198 0x4 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_exit.o)
*(.fini0)
0x00000194 _etext = .
0x0000019c _etext = .
.data 0x00800100 0x0 load address 0x00000194
.data 0x00800100 0x0 load address 0x0000019c
[!provide] PROVIDE (__data_start, .)
*(.data)
*(.data*)
@@ -320,8 +323,8 @@ END GROUP
0x00800100 systemClock
*(COMMON)
0x00800104 PROVIDE (__bss_end, .)
0x00000194 __data_load_start = LOADADDR (.data)
0x00000194 __data_load_end = (__data_load_start + SIZEOF (.data))
0x0000019c __data_load_start = LOADADDR (.data)
0x0000019c __data_load_end = (__data_load_start + SIZEOF (.data))
.noinit 0x00800104 0x0
[!provide] PROVIDE (__noinit_start, .)
@@ -392,42 +395,42 @@ END GROUP
.debug_sfnames
*(.debug_sfnames)
.debug_aranges 0x00000000 0x50
.debug_aranges 0x00000000 0x58
*(.debug_aranges)
.debug_aranges
0x00000000 0x50 main.o
0x00000000 0x58 main.o
.debug_pubnames
*(.debug_pubnames)
.debug_info 0x00000000 0x7d8
.debug_info 0x00000000 0x80e
*(.debug_info .gnu.linkonce.wi.*)
.debug_info 0x00000000 0x5f4 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.2.209/gcc/dev/atmega328p/avr5/crtatmega328p.o
.debug_info 0x000005f4 0x1e4 main.o
.debug_info 0x000005f4 0x21a main.o
.debug_abbrev 0x00000000 0x6b6
.debug_abbrev 0x00000000 0x6c5
*(.debug_abbrev)
.debug_abbrev 0x00000000 0x5a2 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.2.209/gcc/dev/atmega328p/avr5/crtatmega328p.o
.debug_abbrev 0x000005a2 0x114 main.o
.debug_abbrev 0x000005a2 0x123 main.o
.debug_line 0x00000000 0x2b4
.debug_line 0x00000000 0x2d6
*(.debug_line .debug_line.* .debug_line_end)
.debug_line 0x00000000 0x133 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.2.209/gcc/dev/atmega328p/avr5/crtatmega328p.o
.debug_line 0x00000133 0x181 main.o
.debug_line 0x00000133 0x1a3 main.o
.debug_frame 0x00000000 0xb0
.debug_frame 0x00000000 0xdc
*(.debug_frame)
.debug_frame 0x00000000 0xb0 main.o
.debug_frame 0x00000000 0xdc main.o
.debug_str 0x00000000 0x3c7
.debug_str 0x00000000 0x3e6
*(.debug_str)
.debug_str 0x00000000 0x208 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.2.209/gcc/dev/atmega328p/avr5/crtatmega328p.o
.debug_str 0x00000208 0x1bf main.o
0x1f3 (size before relaxing)
.debug_str 0x00000208 0x1de main.o
0x212 (size before relaxing)
.debug_loc 0x00000000 0x92
.debug_loc 0x00000000 0x197
*(.debug_loc)
.debug_loc 0x00000000 0x92 main.o
.debug_loc 0x00000000 0x197 main.o
.debug_macinfo
*(.debug_macinfo)
@@ -447,9 +450,9 @@ END GROUP
.debug_pubtypes
*(.debug_pubtypes)
.debug_ranges 0x00000000 0x40
.debug_ranges 0x00000000 0x48
*(.debug_ranges)
.debug_ranges 0x00000000 0x40 main.o
.debug_ranges 0x00000000 0x48 main.o
.debug_macro
*(.debug_macro)

View File

@@ -7,22 +7,22 @@ S11300400C9446000C9446000C9446000C94460014
S11300500C9446000C9446000C9446000C94460004
S11300600C9446000C94460011241FBECFEFD8E038
S1130070DEBFCDBF21E0A0E0B1E001C01D92A430FD
S1130080B207E1F70E94B2000C94C8000C9400007F
S1130080B207E1F70E94B7000C94CC000C94000076
S113009084B5826084BD85B5836085BD89EF87BDE5
S11300A0EEE6F0E080818260808308951F920F92D3
S11300B00FB60F9211248F939F93AF93BF938091A8
S11300C0000190910101A0910201B09103010196F8
S11300D0A11DB11D8093000190930101A093020121
S11300E0B0930301BF91AF919F918F910F900FBE79
S11300F00F901F9018950F931F930091000110917A
S113010001012091020130910301AB01BC01400FB8
S1130110511F621F731F8091000190910101A091F2
S11301200201B091030184179507A607B70798F356
S11301301F910F910895AB01BC0180910001909132
S11301400101A0910201B091030184179507A6074C
S1130150B70798F30895509A08959BB181E08927D1
S11301608BB908950E94AB000E944800789464EF14
S113017071E080E090E00E949B000E94AD0064EF7B
S113018071E080E090E00E947B000E94AD00F7CF18
S1070190F894FFCF0D
S11300F00F901F901895F894609100017091010180
S1130100809102019091030178940895CF92DF9237
S1130110EF92FF926B017C010E947B00C60ED71EFA
S1130120E81EF91E0E947B00C616D706E806F906EB
S1130130C9F7FF90EF90DF90CF900895CF92DF92B0
S1130140EF92FF926B017C010E947B006C157D0590
S11301508E059F05C9F7FF90EF90DF90CF9008952B
S1130160509A08959BB181E089278BB908950E9424
S1130170B0000E94480064EF71E080E090E00E94CB
S11301809E000E94B20064EF71E080E090E00E9463
S10F019086000E94B200F7CFF894FFCF65
S9030000FC

Binary file not shown.

View File

@@ -19,13 +19,20 @@ ISR(TIMER0_COMPA_vect) {
systemClock++; // Increment the milliseconds counter
}
uint32_t getSystemClock(){
cli();
uint32_t tempSystemClock = systemClock;
sei();
return tempSystemClock;
}
void waitFor(uint32_t ms) {
uint32_t endTime = systemClock + ms;
while (systemClock < endTime);
uint32_t endTime = getSystemClock() + ms;
while (getSystemClock() != endTime);
}
void waitUntil(uint32_t ms) {
while (systemClock < ms);
while (getSystemClock() != ms);
}
void initializeLED() {
@@ -39,7 +46,7 @@ void toggleLED() {
int main(void) {
initializeLED(); // Initialize the LED pin
setupTimer0(); // Setup Timer0
sei(); // Enable global interrupts
//sei(); // Enable global interrupts
waitUntil(500); // Wait until 500 ms have passed
toggleLED(); // Toggle the LED to turn it on

BIN
P4/.vs/P4/v14/.atsuo Normal file

Binary file not shown.

22
P4/P4.atsln Normal file
View File

@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Atmel Studio Solution File, Format Version 11.00
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "P4", "P4\P4.cproj", "{DCE6C7E3-EE26-4D79-826B-08594B9AD897}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|AVR = Debug|AVR
Release|AVR = Release|AVR
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Debug|AVR.ActiveCfg = Debug|AVR
{DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Debug|AVR.Build.0 = Debug|AVR
{DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Release|AVR.ActiveCfg = Release|AVR
{DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Release|AVR.Build.0 = Release|AVR
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

151
P4/P4/Debug/Makefile Normal file
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 += \
../keys.c \
../main.c \
../sevenseg.c
PREPROCESSING_SRCS +=
ASM_SRCS +=
OBJS += \
keys.o \
main.o \
sevenseg.o
OBJS_AS_ARGS += \
keys.o \
main.o \
sevenseg.o
C_DEPS += \
keys.d \
main.d \
sevenseg.d
C_DEPS_AS_ARGS += \
keys.d \
main.d \
sevenseg.d
OUTPUT_FILE_PATH +=P4.elf
OUTPUT_FILE_PATH_AS_ARGS +=P4.elf
ADDITIONAL_DEPENDENCIES:=
OUTPUT_FILE_DEP:= ./makedep.mk
LIB_DEP+=
LINKER_SCRIPT_DEP+=
# AVR32/GNU C Compiler
./keys.o: .././keys.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.2.209\include" -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -g2 -Wall -mmcu=atmega328p -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\gcc\dev\atmega328p" -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.2.209\include" -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -g2 -Wall -mmcu=atmega328p -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\gcc\dev\atmega328p" -c -std=gnu99 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<"
@echo Finished building: $<
./sevenseg.o: .././sevenseg.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.2.209\include" -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -g2 -Wall -mmcu=atmega328p -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\gcc\dev\atmega328p" -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="P4.map" -Wl,--start-group -Wl,-lm -Wl,--end-group -Wl,--gc-sections -mmcu=atmega328p -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\gcc\dev\atmega328p"
@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 "P4.elf" "P4.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 "P4.elf" "P4.eep" || exit 0
"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objdump.exe" -h -S "P4.elf" > "P4.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 "P4.elf" "P4.srec"
"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-size.exe" "P4.elf"
# Other Targets
clean:
-$(RM) $(OBJS_AS_ARGS) $(EXECUTABLES)
-$(RM) $(C_DEPS_AS_ARGS)
rm -rf "P4.elf" "P4.a" "P4.hex" "P4.lss" "P4.eep" "P4.map" "P4.srec" "P4.usersignatures"

1
P4/P4/Debug/P4.eep Normal file
View File

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

BIN
P4/P4/Debug/P4.elf Normal file

Binary file not shown.

43
P4/P4/Debug/P4.hex Normal file
View File

@@ -0,0 +1,43 @@
:100000000C9434000C9451000C9451000C94680032
:100010000C9451000C9451000C9451000C9451001C
:100020000C9451000C9451000C9451000C9451000C
:100030000C9451000C9451000C9451000C945100FC
:100040000C9451000C9451000C9451000C945100EC
:100050000C9451000C9451000C9451000C945100DC
:100060000C9451000C94510011241FBECFEFD8E026
:10007000DEBFCDBF11E0A0E0B1E0EEE7F2E002C0EC
:1000800005900D92A431B107D9F721E0A4E1B1E0C8
:1000900001C01D92A831B207E1F70E94D4000C9470
:1000A0003D010C9400008FEF8AB981E08BB984B9CF
:1000B00085B1866085B9F894E8E6F0E080818160DA
:1000C0008083EBE6F0E080818660808378940895F9
:1000D0001F920F920FB60F9211248F939F93AF939D
:1000E000BF9319992BC08091140190911501A09193
:1000F0001601B0911701892B8A2B8B2B61F484E6B2
:1001000090E0A0E0B0E08093140190931501A093DB
:100110001601B09317018091140190911501A091DF
:100120001601B09117010197A109B109809314013B
:1001300090931501A0931601B09317011A992BC043
:100140008091140190911501A0911601B0911701B1
:1001500083369105A105B10559F48FEF9FEFDC01BE
:100160008093140190931501A0931601B093170189
:100170008091140190911501A0911601B091170181
:100180000196A11DB11D8093140190931501A093B8
:100190001601B0931701BF91AF919F918F910F906E
:1001A0000FBE0F901F9018950E9453000F2EFAE07B
:1001B0008F2E912CA12CB12CF02D16EF60911401F3
:1001C000709115018091160190911701A50194017C
:1001D0000E941B016B017C0140E051E081E00E9424
:1001E00007018091140190911501A0911601B09121
:1001F000170196011203B001139F700D1124680FAF
:10020000791F40E051E080E00E940701D7CF660FE0
:10021000771FFA01E60FF71F90819BB9EFE3FCE926
:100220003197F1F700C00000882319F081E085B90B
:10023000089515B80895A1E21A2EAA1BBB1BFD0153
:100240000DC0AA1FBB1FEE1FFF1FA217B307E407B5
:10025000F50720F0A21BB30BE40BF50B661F771F0D
:10026000881F991F1A9469F76095709580959095ED
:0E0270009B01AC01BD01CF010895F894FFCFB2
:10027E00C000F900A4003000990092008200F8003E
:04028E00800090005C
:00000001FF

385
P4/P4/Debug/P4.lss Normal file
View File

@@ -0,0 +1,385 @@
P4.elf: file format elf32-avr
Sections:
Idx Name Size VMA LMA File off Algn
0 .data 00000014 00800100 0000027e 00000312 2**0
CONTENTS, ALLOC, LOAD, DATA
1 .text 0000027e 00000000 00000000 00000094 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .bss 00000004 00800114 00800114 00000326 2**0
ALLOC
3 .comment 00000030 00000000 00000000 00000326 2**0
CONTENTS, READONLY
4 .note.gnu.avr.deviceinfo 00000040 00000000 00000000 00000358 2**2
CONTENTS, READONLY
5 .debug_aranges 00000068 00000000 00000000 00000398 2**0
CONTENTS, READONLY, DEBUGGING
6 .debug_info 00000944 00000000 00000000 00000400 2**0
CONTENTS, READONLY, DEBUGGING
7 .debug_abbrev 000007e4 00000000 00000000 00000d44 2**0
CONTENTS, READONLY, DEBUGGING
8 .debug_line 00000458 00000000 00000000 00001528 2**0
CONTENTS, READONLY, DEBUGGING
9 .debug_frame 0000009c 00000000 00000000 00001980 2**2
CONTENTS, READONLY, DEBUGGING
10 .debug_str 00000430 00000000 00000000 00001a1c 2**0
CONTENTS, READONLY, DEBUGGING
11 .debug_loc 00000118 00000000 00000000 00001e4c 2**0
CONTENTS, READONLY, DEBUGGING
12 .debug_ranges 00000038 00000000 00000000 00001f64 2**0
CONTENTS, READONLY, DEBUGGING
Disassembly of section .text:
00000000 <__vectors>:
0: 0c 94 34 00 jmp 0x68 ; 0x68 <__ctors_end>
4: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
8: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
c: 0c 94 68 00 jmp 0xd0 ; 0xd0 <__vector_3>
10: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
14: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
18: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
1c: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
20: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
24: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
28: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
2c: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
30: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
34: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
38: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
3c: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
40: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
44: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
48: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
4c: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
50: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
54: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
58: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
5c: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
60: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
64: 0c 94 51 00 jmp 0xa2 ; 0xa2 <__bad_interrupt>
00000068 <__ctors_end>:
68: 11 24 eor r1, r1
6a: 1f be out 0x3f, r1 ; 63
6c: cf ef ldi r28, 0xFF ; 255
6e: d8 e0 ldi r29, 0x08 ; 8
70: de bf out 0x3e, r29 ; 62
72: cd bf out 0x3d, r28 ; 61
00000074 <__do_copy_data>:
74: 11 e0 ldi r17, 0x01 ; 1
76: a0 e0 ldi r26, 0x00 ; 0
78: b1 e0 ldi r27, 0x01 ; 1
7a: ee e7 ldi r30, 0x7E ; 126
7c: f2 e0 ldi r31, 0x02 ; 2
7e: 02 c0 rjmp .+4 ; 0x84 <__do_copy_data+0x10>
80: 05 90 lpm r0, Z+
82: 0d 92 st X+, r0
84: a4 31 cpi r26, 0x14 ; 20
86: b1 07 cpc r27, r17
88: d9 f7 brne .-10 ; 0x80 <__do_copy_data+0xc>
0000008a <__do_clear_bss>:
8a: 21 e0 ldi r18, 0x01 ; 1
8c: a4 e1 ldi r26, 0x14 ; 20
8e: b1 e0 ldi r27, 0x01 ; 1
90: 01 c0 rjmp .+2 ; 0x94 <.do_clear_bss_start>
00000092 <.do_clear_bss_loop>:
92: 1d 92 st X+, r1
00000094 <.do_clear_bss_start>:
94: a8 31 cpi r26, 0x18 ; 24
96: b2 07 cpc r27, r18
98: e1 f7 brne .-8 ; 0x92 <.do_clear_bss_loop>
9a: 0e 94 d4 00 call 0x1a8 ; 0x1a8 <main>
9e: 0c 94 3d 01 jmp 0x27a ; 0x27a <_exit>
000000a2 <__bad_interrupt>:
a2: 0c 94 00 00 jmp 0 ; 0x0 <__vectors>
000000a6 <init>:
#include"keys.h"
void init(){
DDRD = 0xff; // Data direction register D (D0 -> D6) as input
a6: 8f ef ldi r24, 0xFF ; 255
a8: 8a b9 out 0x0a, r24 ; 10
PORTD = (1 << PIND0); // setting bit for 7-segment
aa: 81 e0 ldi r24, 0x01 ; 1
ac: 8b b9 out 0x0b, r24 ; 11
DDRB = 0x01; // Data direction register B0 as output, B1 & B2 as input
ae: 84 b9 out 0x04, r24 ; 4
PORTB |= (1 << PINB1) | (1 << PINB2); // setting bit for SW1 and SW2
b0: 85 b1 in r24, 0x05 ; 5
b2: 86 60 ori r24, 0x06 ; 6
b4: 85 b9 out 0x05, r24 ; 5
cli(); // clear global interrupt flag: interrupts will be immediately disabled
b6: f8 94 cli
PCICR |= 0x01; // Pin Change Interrupt Control Register: turn on PortB
b8: e8 e6 ldi r30, 0x68 ; 104
ba: f0 e0 ldi r31, 0x00 ; 0
bc: 80 81 ld r24, Z
be: 81 60 ori r24, 0x01 ; 1
c0: 80 83 st Z, r24
PCMSK0 |= (1 << PINB1) | (1 << PINB2); // trigger interrupt when PB1's and PB2's state changes
c2: eb e6 ldi r30, 0x6B ; 107
c4: f0 e0 ldi r31, 0x00 ; 0
c6: 80 81 ld r24, Z
c8: 86 60 ori r24, 0x06 ; 6
ca: 80 83 st Z, r24
sei(); // set global interrupt enable
cc: 78 94 sei
ce: 08 95 ret
000000d0 <__vector_3>:
*/
int numbersAsSegments[10] = { 192, 249, 164, 48, 153, 146, 130, 248, 128, 144 }; // display number from 0 to 9;
volatile uint32_t count = 0;
ISR(PCINT0_vect){
d0: 1f 92 push r1
d2: 0f 92 push r0
d4: 0f b6 in r0, 0x3f ; 63
d6: 0f 92 push r0
d8: 11 24 eor r1, r1
da: 8f 93 push r24
dc: 9f 93 push r25
de: af 93 push r26
e0: bf 93 push r27
if (bit_is_clear(PINB, PINB1)) { // sw1 is pressed
e2: 19 99 sbic 0x03, 1 ; 3
e4: 2b c0 rjmp .+86 ; 0x13c <__vector_3+0x6c>
if (count == 0) {
e6: 80 91 14 01 lds r24, 0x0114 ; 0x800114 <__data_end>
ea: 90 91 15 01 lds r25, 0x0115 ; 0x800115 <__data_end+0x1>
ee: a0 91 16 01 lds r26, 0x0116 ; 0x800116 <__data_end+0x2>
f2: b0 91 17 01 lds r27, 0x0117 ; 0x800117 <__data_end+0x3>
f6: 89 2b or r24, r25
f8: 8a 2b or r24, r26
fa: 8b 2b or r24, r27
fc: 61 f4 brne .+24 ; 0x116 <__vector_3+0x46>
count = 100; // if count == 0 and sw1 is pressed, set count = 100 then minus 1 and leds will display 99
fe: 84 e6 ldi r24, 0x64 ; 100
100: 90 e0 ldi r25, 0x00 ; 0
102: a0 e0 ldi r26, 0x00 ; 0
104: b0 e0 ldi r27, 0x00 ; 0
106: 80 93 14 01 sts 0x0114, r24 ; 0x800114 <__data_end>
10a: 90 93 15 01 sts 0x0115, r25 ; 0x800115 <__data_end+0x1>
10e: a0 93 16 01 sts 0x0116, r26 ; 0x800116 <__data_end+0x2>
112: b0 93 17 01 sts 0x0117, r27 ; 0x800117 <__data_end+0x3>
}
count--;
116: 80 91 14 01 lds r24, 0x0114 ; 0x800114 <__data_end>
11a: 90 91 15 01 lds r25, 0x0115 ; 0x800115 <__data_end+0x1>
11e: a0 91 16 01 lds r26, 0x0116 ; 0x800116 <__data_end+0x2>
122: b0 91 17 01 lds r27, 0x0117 ; 0x800117 <__data_end+0x3>
126: 01 97 sbiw r24, 0x01 ; 1
128: a1 09 sbc r26, r1
12a: b1 09 sbc r27, r1
12c: 80 93 14 01 sts 0x0114, r24 ; 0x800114 <__data_end>
130: 90 93 15 01 sts 0x0115, r25 ; 0x800115 <__data_end+0x1>
134: a0 93 16 01 sts 0x0116, r26 ; 0x800116 <__data_end+0x2>
138: b0 93 17 01 sts 0x0117, r27 ; 0x800117 <__data_end+0x3>
}
if (bit_is_clear(PINB, PINB2)) { // sw2 is pressed
13c: 1a 99 sbic 0x03, 2 ; 3
13e: 2b c0 rjmp .+86 ; 0x196 <__vector_3+0xc6>
if (count == 99) {
140: 80 91 14 01 lds r24, 0x0114 ; 0x800114 <__data_end>
144: 90 91 15 01 lds r25, 0x0115 ; 0x800115 <__data_end+0x1>
148: a0 91 16 01 lds r26, 0x0116 ; 0x800116 <__data_end+0x2>
14c: b0 91 17 01 lds r27, 0x0117 ; 0x800117 <__data_end+0x3>
150: 83 36 cpi r24, 0x63 ; 99
152: 91 05 cpc r25, r1
154: a1 05 cpc r26, r1
156: b1 05 cpc r27, r1
158: 59 f4 brne .+22 ; 0x170 <__vector_3+0xa0>
count = -1; // if count == 99 and sw2 is pressed, set count = -1 then plus 1 and leds will display 00
15a: 8f ef ldi r24, 0xFF ; 255
15c: 9f ef ldi r25, 0xFF ; 255
15e: dc 01 movw r26, r24
160: 80 93 14 01 sts 0x0114, r24 ; 0x800114 <__data_end>
164: 90 93 15 01 sts 0x0115, r25 ; 0x800115 <__data_end+0x1>
168: a0 93 16 01 sts 0x0116, r26 ; 0x800116 <__data_end+0x2>
16c: b0 93 17 01 sts 0x0117, r27 ; 0x800117 <__data_end+0x3>
}
count++;
170: 80 91 14 01 lds r24, 0x0114 ; 0x800114 <__data_end>
174: 90 91 15 01 lds r25, 0x0115 ; 0x800115 <__data_end+0x1>
178: a0 91 16 01 lds r26, 0x0116 ; 0x800116 <__data_end+0x2>
17c: b0 91 17 01 lds r27, 0x0117 ; 0x800117 <__data_end+0x3>
180: 01 96 adiw r24, 0x01 ; 1
182: a1 1d adc r26, r1
184: b1 1d adc r27, r1
186: 80 93 14 01 sts 0x0114, r24 ; 0x800114 <__data_end>
18a: 90 93 15 01 sts 0x0115, r25 ; 0x800115 <__data_end+0x1>
18e: a0 93 16 01 sts 0x0116, r26 ; 0x800116 <__data_end+0x2>
192: b0 93 17 01 sts 0x0117, r27 ; 0x800117 <__data_end+0x3>
}
}
196: bf 91 pop r27
198: af 91 pop r26
19a: 9f 91 pop r25
19c: 8f 91 pop r24
19e: 0f 90 pop r0
1a0: 0f be out 0x3f, r0 ; 63
1a2: 0f 90 pop r0
1a4: 1f 90 pop r1
1a6: 18 95 reti
000001a8 <main>:
int main(void)
{
init(); // initializing SW1 and SW2
1a8: 0e 94 53 00 call 0xa6 ; 0xa6 <init>
while(1) {
int led03 = count % 10; // Segmentanzeige f<>r Zehner
1ac: 0f 2e mov r0, r31
1ae: fa e0 ldi r31, 0x0A ; 10
1b0: 8f 2e mov r8, r31
1b2: 91 2c mov r9, r1
1b4: a1 2c mov r10, r1
1b6: b1 2c mov r11, r1
1b8: f0 2d mov r31, r0
display(true, led03, numbersAsSegments);
int led02 = count - led03 * 10; // Segmentanzeige f<>r Einer
display(false, led02, numbersAsSegments);
1ba: 16 ef ldi r17, 0xF6 ; 246
int main(void)
{
init(); // initializing SW1 and SW2
while(1) {
int led03 = count % 10; // Segmentanzeige f<>r Zehner
1bc: 60 91 14 01 lds r22, 0x0114 ; 0x800114 <__data_end>
1c0: 70 91 15 01 lds r23, 0x0115 ; 0x800115 <__data_end+0x1>
1c4: 80 91 16 01 lds r24, 0x0116 ; 0x800116 <__data_end+0x2>
1c8: 90 91 17 01 lds r25, 0x0117 ; 0x800117 <__data_end+0x3>
1cc: a5 01 movw r20, r10
1ce: 94 01 movw r18, r8
1d0: 0e 94 1b 01 call 0x236 ; 0x236 <__udivmodsi4>
1d4: 6b 01 movw r12, r22
1d6: 7c 01 movw r14, r24
display(true, led03, numbersAsSegments);
1d8: 40 e0 ldi r20, 0x00 ; 0
1da: 51 e0 ldi r21, 0x01 ; 1
1dc: 81 e0 ldi r24, 0x01 ; 1
1de: 0e 94 07 01 call 0x20e ; 0x20e <display>
int led02 = count - led03 * 10; // Segmentanzeige f<>r Einer
1e2: 80 91 14 01 lds r24, 0x0114 ; 0x800114 <__data_end>
1e6: 90 91 15 01 lds r25, 0x0115 ; 0x800115 <__data_end+0x1>
1ea: a0 91 16 01 lds r26, 0x0116 ; 0x800116 <__data_end+0x2>
1ee: b0 91 17 01 lds r27, 0x0117 ; 0x800117 <__data_end+0x3>
display(false, led02, numbersAsSegments);
1f2: 96 01 movw r18, r12
1f4: 12 03 mulsu r17, r18
1f6: b0 01 movw r22, r0
1f8: 13 9f mul r17, r19
1fa: 70 0d add r23, r0
1fc: 11 24 eor r1, r1
1fe: 68 0f add r22, r24
200: 79 1f adc r23, r25
202: 40 e0 ldi r20, 0x00 ; 0
204: 51 e0 ldi r21, 0x01 ; 1
206: 80 e0 ldi r24, 0x00 ; 0
208: 0e 94 07 01 call 0x20e ; 0x20e <display>
20c: d7 cf rjmp .-82 ; 0x1bc <main+0x14>
0000020e <display>:
#include "sevenseg.h"
#include <stdbool.h>
void display(bool tens, int num, int numList[]) {
PORTD = numList[num]; // Displays the Number on PortD
20e: 66 0f add r22, r22
210: 77 1f adc r23, r23
212: fa 01 movw r30, r20
214: e6 0f add r30, r22
216: f7 1f adc r31, r23
218: 90 81 ld r25, Z
21a: 9b b9 out 0x0b, r25 ; 11
#else
//round up by default
__ticks_dc = (uint32_t)(ceil(fabs(__tmp)));
#endif
__builtin_avr_delay_cycles(__ticks_dc);
21c: ef e3 ldi r30, 0x3F ; 63
21e: fc e9 ldi r31, 0x9C ; 156
220: 31 97 sbiw r30, 0x01 ; 1
222: f1 f7 brne .-4 ; 0x220 <display+0x12>
224: 00 c0 rjmp .+0 ; 0x226 <display+0x18>
226: 00 00 nop
_delay_ms(10);
if(tens) {
228: 88 23 and r24, r24
22a: 19 f0 breq .+6 ; 0x232 <display+0x24>
PORTB = 1;
22c: 81 e0 ldi r24, 0x01 ; 1
22e: 85 b9 out 0x05, r24 ; 5
230: 08 95 ret
}
else {
PORTB = 0;
232: 15 b8 out 0x05, r1 ; 5
234: 08 95 ret
00000236 <__udivmodsi4>:
236: a1 e2 ldi r26, 0x21 ; 33
238: 1a 2e mov r1, r26
23a: aa 1b sub r26, r26
23c: bb 1b sub r27, r27
23e: fd 01 movw r30, r26
240: 0d c0 rjmp .+26 ; 0x25c <__udivmodsi4_ep>
00000242 <__udivmodsi4_loop>:
242: aa 1f adc r26, r26
244: bb 1f adc r27, r27
246: ee 1f adc r30, r30
248: ff 1f adc r31, r31
24a: a2 17 cp r26, r18
24c: b3 07 cpc r27, r19
24e: e4 07 cpc r30, r20
250: f5 07 cpc r31, r21
252: 20 f0 brcs .+8 ; 0x25c <__udivmodsi4_ep>
254: a2 1b sub r26, r18
256: b3 0b sbc r27, r19
258: e4 0b sbc r30, r20
25a: f5 0b sbc r31, r21
0000025c <__udivmodsi4_ep>:
25c: 66 1f adc r22, r22
25e: 77 1f adc r23, r23
260: 88 1f adc r24, r24
262: 99 1f adc r25, r25
264: 1a 94 dec r1
266: 69 f7 brne .-38 ; 0x242 <__udivmodsi4_loop>
268: 60 95 com r22
26a: 70 95 com r23
26c: 80 95 com r24
26e: 90 95 com r25
270: 9b 01 movw r18, r22
272: ac 01 movw r20, r24
274: bd 01 movw r22, r26
276: cf 01 movw r24, r30
278: 08 95 ret
0000027a <_exit>:
27a: f8 94 cli
0000027c <__stop_program>:
27c: ff cf rjmp .-2 ; 0x27c <__stop_program>

517
P4/P4/Debug/P4.map Normal file
View File

@@ -0,0 +1,517 @@
Archive member included to satisfy reference by file (symbol)
c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_udivmodsi4.o)
main.o (__udivmodsi4)
c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_exit.o)
C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.2.209/gcc/dev/atmega328p/avr5/crtatmega328p.o (exit)
c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_copy_data.o)
main.o (__do_copy_data)
c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_clear_bss.o)
main.o (__do_clear_bss)
Discarded input sections
.data 0x00000000 0x0 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.2.209/gcc/dev/atmega328p/avr5/crtatmega328p.o
.bss 0x00000000 0x0 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.2.209/gcc/dev/atmega328p/avr5/crtatmega328p.o
.text 0x00000000 0x0 keys.o
.data 0x00000000 0x0 keys.o
.bss 0x00000000 0x0 keys.o
.text 0x00000000 0x0 main.o
.data 0x00000000 0x0 main.o
.bss 0x00000000 0x0 main.o
.text 0x00000000 0x0 sevenseg.o
.data 0x00000000 0x0 sevenseg.o
.bss 0x00000000 0x0 sevenseg.o
.text 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_udivmodsi4.o)
.data 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_udivmodsi4.o)
.bss 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_udivmodsi4.o)
.text.libgcc.mul
0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_udivmodsi4.o)
.text.libgcc 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_udivmodsi4.o)
.text.libgcc.prologue
0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_udivmodsi4.o)
.text.libgcc.builtins
0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_udivmodsi4.o)
.text.libgcc.fmul
0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_udivmodsi4.o)
.text.libgcc.fixed
0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_udivmodsi4.o)
.text 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_exit.o)
.data 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_exit.o)
.bss 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_exit.o)
.text.libgcc.mul
0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_exit.o)
.text.libgcc.div
0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_exit.o)
.text.libgcc 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_exit.o)
.text.libgcc.prologue
0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_exit.o)
.text.libgcc.builtins
0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_exit.o)
.text.libgcc.fmul
0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_exit.o)
.text.libgcc.fixed
0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_exit.o)
.text 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_copy_data.o)
.data 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_copy_data.o)
.bss 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_copy_data.o)
.text.libgcc.mul
0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_copy_data.o)
.text.libgcc.div
0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_copy_data.o)
.text.libgcc 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_copy_data.o)
.text.libgcc.prologue
0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_copy_data.o)
.text.libgcc.builtins
0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_copy_data.o)
.text.libgcc.fmul
0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_copy_data.o)
.text.libgcc.fixed
0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_copy_data.o)
.text 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_clear_bss.o)
.data 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_clear_bss.o)
.bss 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_clear_bss.o)
.text.libgcc.mul
0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_clear_bss.o)
.text.libgcc.div
0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_clear_bss.o)
.text.libgcc 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_clear_bss.o)
.text.libgcc.prologue
0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_clear_bss.o)
.text.libgcc.builtins
0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_clear_bss.o)
.text.libgcc.fmul
0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_clear_bss.o)
.text.libgcc.fixed
0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_clear_bss.o)
Memory Configuration
Name Origin Length Attributes
text 0x00000000 0x00020000 xr
data 0x00800060 0x0000ffa0 rw !x
eeprom 0x00810000 0x00010000 rw !x
fuse 0x00820000 0x00000003 rw !x
lock 0x00830000 0x00000400 rw !x
signature 0x00840000 0x00000400 rw !x
user_signatures 0x00850000 0x00000400 rw !x
*default* 0x00000000 0xffffffff
Linker script and memory map
Address of section .data set to 0x800100
LOAD C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.2.209/gcc/dev/atmega328p/avr5/crtatmega328p.o
LOAD keys.o
LOAD main.o
LOAD sevenseg.o
START GROUP
LOAD c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/../../../../avr/lib/avr5\libm.a
END GROUP
START GROUP
LOAD c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a
LOAD c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/../../../../avr/lib/avr5\libm.a
LOAD c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/../../../../avr/lib/avr5\libc.a
LOAD C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.2.209/gcc/dev/atmega328p/avr5\libatmega328p.a
END GROUP
0x00020000 __TEXT_REGION_LENGTH__ = DEFINED (__TEXT_REGION_LENGTH__)?__TEXT_REGION_LENGTH__:0x20000
0x0000ffa0 __DATA_REGION_LENGTH__ = DEFINED (__DATA_REGION_LENGTH__)?__DATA_REGION_LENGTH__:0xffa0
0x00010000 __EEPROM_REGION_LENGTH__ = DEFINED (__EEPROM_REGION_LENGTH__)?__EEPROM_REGION_LENGTH__:0x10000
[0x00000003] __FUSE_REGION_LENGTH__ = DEFINED (__FUSE_REGION_LENGTH__)?__FUSE_REGION_LENGTH__:0x400
0x00000400 __LOCK_REGION_LENGTH__ = DEFINED (__LOCK_REGION_LENGTH__)?__LOCK_REGION_LENGTH__:0x400
0x00000400 __SIGNATURE_REGION_LENGTH__ = DEFINED (__SIGNATURE_REGION_LENGTH__)?__SIGNATURE_REGION_LENGTH__:0x400
0x00000400 __USER_SIGNATURE_REGION_LENGTH__ = DEFINED (__USER_SIGNATURE_REGION_LENGTH__)?__USER_SIGNATURE_REGION_LENGTH__:0x400
.hash
*(.hash)
.dynsym
*(.dynsym)
.dynstr
*(.dynstr)
.gnu.version
*(.gnu.version)
.gnu.version_d
*(.gnu.version_d)
.gnu.version_r
*(.gnu.version_r)
.rel.init
*(.rel.init)
.rela.init
*(.rela.init)
.rel.text
*(.rel.text)
*(.rel.text.*)
*(.rel.gnu.linkonce.t*)
.rela.text
*(.rela.text)
*(.rela.text.*)
*(.rela.gnu.linkonce.t*)
.rel.fini
*(.rel.fini)
.rela.fini
*(.rela.fini)
.rel.rodata
*(.rel.rodata)
*(.rel.rodata.*)
*(.rel.gnu.linkonce.r*)
.rela.rodata
*(.rela.rodata)
*(.rela.rodata.*)
*(.rela.gnu.linkonce.r*)
.rel.data
*(.rel.data)
*(.rel.data.*)
*(.rel.gnu.linkonce.d*)
.rela.data
*(.rela.data)
*(.rela.data.*)
*(.rela.gnu.linkonce.d*)
.rel.ctors
*(.rel.ctors)
.rela.ctors
*(.rela.ctors)
.rel.dtors
*(.rel.dtors)
.rela.dtors
*(.rela.dtors)
.rel.got
*(.rel.got)
.rela.got
*(.rela.got)
.rel.bss
*(.rel.bss)
.rela.bss
*(.rela.bss)
.rel.plt
*(.rel.plt)
.rela.plt
*(.rela.plt)
.text 0x00000000 0x27e
*(.vectors)
.vectors 0x00000000 0x68 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.2.209/gcc/dev/atmega328p/avr5/crtatmega328p.o
0x00000000 __vector_default
0x00000000 __vectors
*(.vectors)
*(.progmem.gcc*)
0x00000068 . = ALIGN (0x2)
0x00000068 __trampolines_start = .
*(.trampolines)
.trampolines 0x00000068 0x0 linker stubs
*(.trampolines*)
0x00000068 __trampolines_end = .
*libprintf_flt.a:*(.progmem.data)
*libc.a:*(.progmem.data)
*(.progmem*)
0x00000068 . = ALIGN (0x2)
*(.jumptables)
*(.jumptables*)
*(.lowtext)
*(.lowtext*)
0x00000068 __ctors_start = .
*(.ctors)
0x00000068 __ctors_end = .
0x00000068 __dtors_start = .
*(.dtors)
0x00000068 __dtors_end = .
SORT(*)(.ctors)
SORT(*)(.dtors)
*(.init0)
.init0 0x00000068 0x0 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.2.209/gcc/dev/atmega328p/avr5/crtatmega328p.o
0x00000068 __init
*(.init0)
*(.init1)
*(.init1)
*(.init2)
.init2 0x00000068 0xc C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.2.209/gcc/dev/atmega328p/avr5/crtatmega328p.o
*(.init2)
*(.init3)
*(.init3)
*(.init4)
.init4 0x00000074 0x16 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_copy_data.o)
0x00000074 __do_copy_data
.init4 0x0000008a 0x10 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_clear_bss.o)
0x0000008a __do_clear_bss
*(.init4)
*(.init5)
*(.init5)
*(.init6)
*(.init6)
*(.init7)
*(.init7)
*(.init8)
*(.init8)
*(.init9)
.init9 0x0000009a 0x8 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.2.209/gcc/dev/atmega328p/avr5/crtatmega328p.o
*(.init9)
*(.text)
.text 0x000000a2 0x4 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.2.209/gcc/dev/atmega328p/avr5/crtatmega328p.o
0x000000a2 __vector_22
0x000000a2 __vector_1
0x000000a2 __vector_24
0x000000a2 __vector_12
0x000000a2 __bad_interrupt
0x000000a2 __vector_6
0x000000a2 __vector_23
0x000000a2 __vector_25
0x000000a2 __vector_11
0x000000a2 __vector_13
0x000000a2 __vector_17
0x000000a2 __vector_19
0x000000a2 __vector_7
0x000000a2 __vector_5
0x000000a2 __vector_4
0x000000a2 __vector_9
0x000000a2 __vector_2
0x000000a2 __vector_21
0x000000a2 __vector_15
0x000000a2 __vector_8
0x000000a2 __vector_14
0x000000a2 __vector_10
0x000000a2 __vector_16
0x000000a2 __vector_18
0x000000a2 __vector_20
0x000000a6 . = ALIGN (0x2)
*(.text.*)
.text.init 0x000000a6 0x2a keys.o
0x000000a6 init
.text.__vector_3
0x000000d0 0xd8 main.o
0x000000d0 __vector_3
.text.main 0x000001a8 0x66 main.o
0x000001a8 main
.text.display 0x0000020e 0x28 sevenseg.o
0x0000020e display
.text.libgcc.div
0x00000236 0x44 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_udivmodsi4.o)
0x00000236 __udivmodsi4
0x0000027a . = ALIGN (0x2)
*(.fini9)
.fini9 0x0000027a 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_exit.o)
0x0000027a _exit
0x0000027a exit
*(.fini9)
*(.fini8)
*(.fini8)
*(.fini7)
*(.fini7)
*(.fini6)
*(.fini6)
*(.fini5)
*(.fini5)
*(.fini4)
*(.fini4)
*(.fini3)
*(.fini3)
*(.fini2)
*(.fini2)
*(.fini1)
*(.fini1)
*(.fini0)
.fini0 0x0000027a 0x4 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_exit.o)
*(.fini0)
0x0000027e _etext = .
.data 0x00800100 0x14 load address 0x0000027e
0x00800100 PROVIDE (__data_start, .)
*(.data)
*(.data*)
.data.numbersAsSegments
0x00800100 0x14 main.o
0x00800100 numbersAsSegments
*(.gnu.linkonce.d*)
*(.rodata)
*(.rodata*)
*(.gnu.linkonce.r*)
0x00800114 . = ALIGN (0x2)
0x00800114 _edata = .
0x00800114 PROVIDE (__data_end, .)
.bss 0x00800114 0x4
0x00800114 PROVIDE (__bss_start, .)
*(.bss)
*(.bss*)
.bss.count 0x00800114 0x4 main.o
0x00800114 count
*(COMMON)
0x00800118 PROVIDE (__bss_end, .)
0x0000027e __data_load_start = LOADADDR (.data)
0x00000292 __data_load_end = (__data_load_start + SIZEOF (.data))
.noinit 0x00800118 0x0
[!provide] PROVIDE (__noinit_start, .)
*(.noinit*)
[!provide] PROVIDE (__noinit_end, .)
0x00800118 _end = .
[!provide] PROVIDE (__heap_start, .)
.eeprom 0x00810000 0x0
*(.eeprom*)
0x00810000 __eeprom_end = .
.fuse
*(.fuse)
*(.lfuse)
*(.hfuse)
*(.efuse)
.lock
*(.lock*)
.signature
*(.signature*)
.user_signatures
*(.user_signatures*)
.stab
*(.stab)
.stabstr
*(.stabstr)
.stab.excl
*(.stab.excl)
.stab.exclstr
*(.stab.exclstr)
.stab.index
*(.stab.index)
.stab.indexstr
*(.stab.indexstr)
.comment 0x00000000 0x30
*(.comment)
.comment 0x00000000 0x30 keys.o
0x31 (size before relaxing)
.comment 0x00000030 0x31 main.o
.comment 0x00000030 0x31 sevenseg.o
.note.gnu.avr.deviceinfo
0x00000000 0x40
.note.gnu.avr.deviceinfo
0x00000000 0x40 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.2.209/gcc/dev/atmega328p/avr5/crtatmega328p.o
.note.gnu.build-id
*(.note.gnu.build-id)
.debug
*(.debug)
.line
*(.line)
.debug_srcinfo
*(.debug_srcinfo)
.debug_sfnames
*(.debug_sfnames)
.debug_aranges 0x00000000 0x68
*(.debug_aranges)
.debug_aranges
0x00000000 0x20 keys.o
.debug_aranges
0x00000020 0x28 main.o
.debug_aranges
0x00000048 0x20 sevenseg.o
.debug_pubnames
*(.debug_pubnames)
.debug_info 0x00000000 0x944
*(.debug_info .gnu.linkonce.wi.*)
.debug_info 0x00000000 0x5f4 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.2.209/gcc/dev/atmega328p/avr5/crtatmega328p.o
.debug_info 0x000005f4 0x82 keys.o
.debug_info 0x00000676 0x189 main.o
.debug_info 0x000007ff 0x145 sevenseg.o
.debug_abbrev 0x00000000 0x7e4
*(.debug_abbrev)
.debug_abbrev 0x00000000 0x5a2 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.2.209/gcc/dev/atmega328p/avr5/crtatmega328p.o
.debug_abbrev 0x000005a2 0x4f keys.o
.debug_abbrev 0x000005f1 0x104 main.o
.debug_abbrev 0x000006f5 0xef sevenseg.o
.debug_line 0x00000000 0x458
*(.debug_line .debug_line.* .debug_line_end)
.debug_line 0x00000000 0x133 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.2.209/gcc/dev/atmega328p/avr5/crtatmega328p.o
.debug_line 0x00000133 0xcb keys.o
.debug_line 0x000001fe 0x133 main.o
.debug_line 0x00000331 0x127 sevenseg.o
.debug_frame 0x00000000 0x9c
*(.debug_frame)
.debug_frame 0x00000000 0x24 keys.o
.debug_frame 0x00000024 0x54 main.o
.debug_frame 0x00000078 0x24 sevenseg.o
.debug_str 0x00000000 0x430
*(.debug_str)
.debug_str 0x00000000 0x208 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.2.209/gcc/dev/atmega328p/avr5/crtatmega328p.o
.debug_str 0x00000208 0x160 keys.o
0x194 (size before relaxing)
.debug_str 0x00000368 0x63 main.o
0x1eb (size before relaxing)
.debug_str 0x000003cb 0x65 sevenseg.o
0x1f9 (size before relaxing)
.debug_loc 0x00000000 0x118
*(.debug_loc)
.debug_loc 0x00000000 0x7e main.o
.debug_loc 0x0000007e 0x9a sevenseg.o
.debug_macinfo
*(.debug_macinfo)
.debug_weaknames
*(.debug_weaknames)
.debug_funcnames
*(.debug_funcnames)
.debug_typenames
*(.debug_typenames)
.debug_varnames
*(.debug_varnames)
.debug_pubtypes
*(.debug_pubtypes)
.debug_ranges 0x00000000 0x38
*(.debug_ranges)
.debug_ranges 0x00000000 0x10 keys.o
.debug_ranges 0x00000010 0x18 main.o
.debug_ranges 0x00000028 0x10 sevenseg.o
.debug_macro
*(.debug_macro)
OUTPUT(P4.elf elf32-avr)
LOAD linker stubs

44
P4/P4/Debug/P4.srec Normal file
View File

@@ -0,0 +1,44 @@
S00A000050342E7372656396
S11300000C9434000C9451000C9451000C9468002E
S11300100C9451000C9451000C9451000C94510018
S11300200C9451000C9451000C9451000C94510008
S11300300C9451000C9451000C9451000C945100F8
S11300400C9451000C9451000C9451000C945100E8
S11300500C9451000C9451000C9451000C945100D8
S11300600C9451000C94510011241FBECFEFD8E022
S1130070DEBFCDBF11E0A0E0B1E0EEE7F2E002C0E8
S113008005900D92A431B107D9F721E0A4E1B1E0C4
S113009001C01D92A831B207E1F70E94D4000C946C
S11300A03D010C9400008FEF8AB981E08BB984B9CB
S11300B085B1866085B9F894E8E6F0E080818160D6
S11300C08083EBE6F0E080818660808378940895F5
S11300D01F920F920FB60F9211248F939F93AF9399
S11300E0BF9319992BC08091140190911501A0918F
S11300F01601B0911701892B8A2B8B2B61F484E6AE
S113010090E0A0E0B0E08093140190931501A093D7
S11301101601B09317018091140190911501A091DB
S11301201601B09117010197A109B1098093140137
S113013090931501A0931601B09317011A992BC03F
S11301408091140190911501A0911601B0911701AD
S113015083369105A105B10559F48FEF9FEFDC01BA
S11301608093140190931501A0931601B093170185
S11301708091140190911501A0911601B09117017D
S11301800196A11DB11D8093140190931501A093B4
S11301901601B0931701BF91AF919F918F910F906A
S11301A00FBE0F901F9018950E9453000F2EFAE077
S11301B08F2E912CA12CB12CF02D16EF60911401EF
S11301C0709115018091160190911701A501940178
S11301D00E941B016B017C0140E051E081E00E9420
S11301E007018091140190911501A0911601B0911D
S11301F0170196011203B001139F700D1124680FAB
S1130200791F40E051E080E00E940701D7CF660FDC
S1130210771FFA01E60FF71F90819BB9EFE3FCE922
S11302203197F1F700C00000882319F081E085B907
S1130230089515B80895A1E21A2EAA1BBB1BFD014F
S11302400DC0AA1FBB1FEE1FFF1FA217B307E407B1
S1130250F50720F0A21BB30BE40BF50B661F771F09
S1130260881F991F1A9469F76095709580959095E9
S11102709B01AC01BD01CF010895F894FFCFAE
S113027EC000F900A4003000990092008200F8003A
S107028E8000900058
S9030000FC

39
P4/P4/Debug/keys.d Normal file
View File

@@ -0,0 +1,39 @@
keys.d keys.o: .././keys.c .././keys.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdint.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h \
C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\include/avr/iom328p.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\interrupt.h
.././keys.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdint.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h:
C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\include/avr/iom328p.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\interrupt.h:

BIN
P4/P4/Debug/keys.o Normal file

Binary file not shown.

54
P4/P4/Debug/main.d Normal file
View File

@@ -0,0 +1,54 @@
main.d main.o: .././main.c .././keys.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdint.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h \
C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\include/avr/iom328p.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\interrupt.h \
.././sevenseg.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay_basic.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdbool.h
.././keys.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdint.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h:
C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\include/avr/iom328p.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\interrupt.h:
.././sevenseg.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay_basic.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdbool.h:

BIN
P4/P4/Debug/main.o Normal file

Binary file not shown.

10
P4/P4/Debug/makedep.mk Normal file
View File

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

48
P4/P4/Debug/sevenseg.d Normal file
View File

@@ -0,0 +1,48 @@
sevenseg.d sevenseg.o: .././sevenseg.c .././sevenseg.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdint.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay_basic.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h \
C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\include/avr/iom328p.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h \
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdbool.h
.././sevenseg.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdint.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay_basic.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h:
C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\include/avr/iom328p.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h:
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdbool.h:

BIN
P4/P4/Debug/sevenseg.o Normal file

Binary file not shown.

View File

@@ -0,0 +1,22 @@
/*
* keys.c
*
* Created: 12/12/2021 07:26:18
* Author: haypsilcn
*/
#include"keys.h"
void init(){
DDRD = 0xff; // Data direction register D (D0 -> D6) as input
PORTD = (1 << PIND0); // setting bit for 7-segment
DDRB = 0x01; // Data direction register B0 as output, B1 & B2 as input
PORTB |= (1 << PINB1) | (1 << PINB2); // setting bit for SW1 and SW2
cli(); // clear global interrupt flag: interrupts will be immediately disabled
PCICR |= 0x02; // Pin Change Interrupt Control Register: turn on PortC
PCMSK0 |= (1 << PINC0) | (1 << PINC1); // trigger interrupt when PB1's and PB2's state changes
sei(); // set global interrupt enable
}

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.2.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.2.209\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.2.209\include\avr\iom328p.h</AbsolutePath>
<Attribute></Attribute>
<Category>header</Category>
<Condition>C</Condition>
<FileContentHash>UMk4QUzkkuShabuoYtNl/Q==</FileContentHash>
<FileVersion></FileVersion>
<Name>include/avr/iom328p.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.2.209\templates\main.c</AbsolutePath>
<Attribute>template</Attribute>
<Category>source</Category>
<Condition>C Exe</Condition>
<FileContentHash>tT5ONm3vILdPjO5YQRtoRA==</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.2.209\templates\main.cpp</AbsolutePath>
<Attribute>template</Attribute>
<Category>source</Category>
<Condition>C Exe</Condition>
<FileContentHash>YXFphlh0CtZJU+ebktABgQ==</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.2.209\gcc\dev\atmega328p</AbsolutePath>
<Attribute></Attribute>
<Category>libraryPrefix</Category>
<Condition>GCC</Condition>
<FileContentHash i:nil="true" />
<FileVersion></FileVersion>
<Name>gcc/dev/atmega328p</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.2.209/Atmel.ATmega_DFP.pdsc</PackPath>
<PackVersion>1.2.209</PackVersion>
<PresentInProject>true</PresentInProject>
<ReferenceConditionId>ATmega328P</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>

128
P4/P4/P4.cproj Normal file
View File

@@ -0,0 +1,128 @@
<?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>dce6c7e3-ee26-4d79-826b-08594b9ad897</ProjectGuid>
<avrdevice>ATmega328P</avrdevice>
<avrdeviceseries>none</avrdeviceseries>
<OutputType>Executable</OutputType>
<Language>C</Language>
<OutputFileName>$(MSBuildProjectName)</OutputFileName>
<OutputFileExtension>.elf</OutputFileExtension>
<OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory>
<AssemblyName>P4</AssemblyName>
<Name>P4</Name>
<RootNamespace>P4</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=atmega328p -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\gcc\dev\atmega328p"</avrgcc.common.Device>
<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.2.209\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.2.209\include</Value>
</ListValues>
</avrgcc.assembler.general.IncludePaths>
</AvrGcc>
</ToolchainSettings>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<ToolchainSettings>
<AvrGcc>
<avrgcc.common.Device>-mmcu=atmega328p -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.2.209\gcc\dev\atmega328p"</avrgcc.common.Device>
<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.2.209\include</Value>
</ListValues>
</avrgcc.compiler.directories.IncludePaths>
<avrgcc.compiler.optimization.level>Optimize (-O1)</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.2.209\include</Value>
</ListValues>
</avrgcc.assembler.general.IncludePaths>
<avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel>
</AvrGcc>
</ToolchainSettings>
</PropertyGroup>
<ItemGroup>
<Compile Include="keys.c">
<SubType>compile</SubType>
</Compile>
<Compile Include="keys.h">
<SubType>compile</SubType>
</Compile>
<Compile Include="main.c">
<SubType>compile</SubType>
</Compile>
<Compile Include="sevenseg.c">
<SubType>compile</SubType>
</Compile>
<Compile Include="sevenseg.h">
<SubType>compile</SubType>
</Compile>
</ItemGroup>
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
</Project>

20
P4/P4/keys.h Normal file
View File

@@ -0,0 +1,20 @@
/*
* keys.h
*
* Created: 12/12/2021 07:25:56
* Author: haypsilcn
*/
#ifndef KEYS_H_
#define KEYS_H_
#include <avr/io.h>
#include <avr/interrupt.h>
#define bit_is_clear(sfr, bit) (!(_SFR_BYTE(sfr) & _BV(bit))) // Test whether bit 'bit' in IO register 'sfr' is clear. This will return non-zero if the bit is clear, and a 0 if the bit is set.
void init();
#endif /* KEYS_H_ */

60
P4/P4/main.c Normal file
View File

@@ -0,0 +1,60 @@
/*
* Praktikum04.c
*
* Created: 12/12/2021 07:21:18
* Author : haypsilcn
*/
#include "keys.h"
#include "sevenseg.h"
#include <stdbool.h>
/*
logical 0: on
logical 1: off
.gfe dcba HEX int
0 : 1100 0000 = C0 192
1 : 1111 1001 = F9 249
2 : 1010 0100 = A4 164
3 : 1011 0000 = 30 48
4 : 1001 1001 = 99 153
5 : 1001 0010 = 92 146
6 : 1000 0010 = 82 130
7 : 1111 1000 = F8 248
8 : 1000 0000 = 80 128
9 : 1001 0000 = 90 144
*/
int numbersAsSegments[10] = { 192, 249, 164, 48, 153, 146, 130, 248, 128, 144 }; // display number from 0 to 9;
volatile uint32_t count = 0;
ISR(PCINT0_vect){
if (bit_is_clear(PINB, PINB1)) { // sw1 is pressed
if (count == 0) {
count = 100; // if count == 0 and sw1 is pressed, set count = 100 then minus 1 and leds will display 99
}
count--;
}
if (bit_is_clear(PINB, PINB2)) { // sw2 is pressed
if (count == 99) {
count = -1; // if count == 99 and sw2 is pressed, set count = -1 then plus 1 and leds will display 00
}
count++;
}
}
int main(void)
{
init(); // initializing SW1 and SW2
while(1) {
int led03 = count % 10; // Segmentanzeige f<>r Zehner
display(true, led03, numbersAsSegments);
int led02 = count - led03 * 10; // Segmentanzeige f<>r Einer
display(false, led02, numbersAsSegments);
}
}

17
P4/P4/sevenseg.c Normal file
View File

@@ -0,0 +1,17 @@
#include "sevenseg.h"
#include <stdbool.h>
void display(bool tens, int num, int numList[]) {
PORTD = numList[num]; // Displays the Number on PortD
_delay_ms(10);
// teens durch den Wert von PortB ersetzen
if(tens) {
PORTB = 1;
}
else {
PORTB = 0;
}
}

19
P4/P4/sevenseg.h Normal file
View File

@@ -0,0 +1,19 @@
/*
* sevenseg.h
*
* Created: 12/12/2021 07:25:14
* Author: haypsilcn
*/
#ifndef SEVENSEG_H_
#define SEVENSEG_H_
#define F_CPU 16000000
#include <util/delay.h>
#include "avr/io.h"
#include <stdbool.h>
void display(bool tens, int num, int numList[]);
#endif /* SEVENSEG_H_ */