This commit is contained in:
S170H
2023-12-12 01:08:38 +01:00
parent ee22ff0819
commit 237e085b51
18 changed files with 504 additions and 496 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -1,43 +1,43 @@
:100000000C9434000C9451000C9451000C94680032
:100000000C9434000C9451000C9451000C94670033
:100010000C9451000C9451000C9451000C9451001C
:100020000C9451000C9451000C9451000C9451000C
:100030000C9451000C9451000C9451000C945100FC
:100040000C9451000C9451000C9451000C945100EC
:100050000C9451000C9451000C9451000C945100DC
:100060000C9451000C94510011241FBECFEFD8E026
:10007000DEBFCDBF11E0A0E0B1E0EEE7F2E002C0EC
:10007000DEBFCDBF11E0A0E0B1E0E2E7F2E002C0F8
: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
:1000900001C01D92A631B207E1F70E94A5000C94A1
:1000A00037010C9400008FEF8AB981E084B985B1E3
:1000B000866085B9F894E8E6F0E08081816080830D
:1000C000EBE6F0E0808186608083789408951F924B
:1000D0000F920FB60F9211248F939F93199916C008
:1000E0008091140190911501892B31F484E690E000
:1000F0009093150180931401809114019091150142
:100100000197909315018093140118C01A9916C095
:1001100080911401909115018336910531F48FEF90
:100120009FEF909315018093140180911401909199
:100130001501019690931501809314019F918F9161
:100140000F900FBE0F901F9018950E945300809142
:100150001401909115010E94AE00F9CF0F931F93E7
:10016000CF93DF93CDB7DEB768970FB6F894DEBFB5
:100170000FBECDBF9C0184E1E0E0F1E0DE0111960D
:1001800001900D928A95E1F70AE010E0C901B801EB
:100190000E940F01FC01EE0FFF1F41E050E04C0FE9
:1001A0005D1FE40FF51F408151815E8B4D8BF9017E
:1001B000E81BF90BCF01B8010E940F01FB01EE0F04
:1001C000FF1F41E050E04C0F5D1FE40FF51F8081E1
:1001D0009181988F8F8B8D899E898BB98FE39CE954
:1001E0000197F1F700C0000095B181E0982795B91B
:1001F0002F89388D2BB9EFE3FCE93197F1F700C077
:10020000000095B1892785B968960FB6F894DEBFCE
:100210000FBECDBFDF91CF911F910F91089597FB36
:10022000072E16F4009407D077FD09D00E94230111
:1002300007FC05D03EF4909581959F4F08957095E9
:1002400061957F4F0895AA1BBB1B51E107C0AA1FF0
:10025000BB1FA617B70710F0A61BB70B881F991F67
:100260005A95A9F780959095BC01CD010895F89411
:02027000FFCFBE
:10027200C000F900A4003000990092008200F8004A
:040282008000900068
:00000001FF

View File

@@ -3,31 +3,31 @@ P4.elf: file format elf32-avr
Sections:
Idx Name Size VMA LMA File off Algn
0 .data 00000014 00800100 0000027e 00000312 2**0
0 .data 00000014 00800100 00000272 00000306 2**0
CONTENTS, ALLOC, LOAD, DATA
1 .text 0000027e 00000000 00000000 00000094 2**1
1 .text 00000272 00000000 00000000 00000094 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .bss 00000004 00800114 00800114 00000326 2**0
2 .bss 00000002 00800114 00800114 0000031a 2**0
ALLOC
3 .comment 00000030 00000000 00000000 00000326 2**0
3 .comment 00000030 00000000 00000000 0000031a 2**0
CONTENTS, READONLY
4 .note.gnu.avr.deviceinfo 00000040 00000000 00000000 00000358 2**2
4 .note.gnu.avr.deviceinfo 00000040 00000000 00000000 0000034c 2**2
CONTENTS, READONLY
5 .debug_aranges 00000068 00000000 00000000 00000398 2**0
5 .debug_aranges 00000068 00000000 00000000 0000038c 2**0
CONTENTS, READONLY, DEBUGGING
6 .debug_info 00000944 00000000 00000000 00000400 2**0
6 .debug_info 000008f2 00000000 00000000 000003f4 2**0
CONTENTS, READONLY, DEBUGGING
7 .debug_abbrev 000007e4 00000000 00000000 00000d44 2**0
7 .debug_abbrev 00000797 00000000 00000000 00000ce6 2**0
CONTENTS, READONLY, DEBUGGING
8 .debug_line 00000458 00000000 00000000 00001528 2**0
8 .debug_line 00000448 00000000 00000000 0000147d 2**0
CONTENTS, READONLY, DEBUGGING
9 .debug_frame 0000009c 00000000 00000000 00001980 2**2
9 .debug_frame 000000ac 00000000 00000000 000018c8 2**2
CONTENTS, READONLY, DEBUGGING
10 .debug_str 00000430 00000000 00000000 00001a1c 2**0
10 .debug_str 0000041d 00000000 00000000 00001974 2**0
CONTENTS, READONLY, DEBUGGING
11 .debug_loc 00000118 00000000 00000000 00001e4c 2**0
11 .debug_loc 00000170 00000000 00000000 00001d91 2**0
CONTENTS, READONLY, DEBUGGING
12 .debug_ranges 00000038 00000000 00000000 00001f64 2**0
12 .debug_ranges 00000038 00000000 00000000 00001f01 2**0
CONTENTS, READONLY, DEBUGGING
Disassembly of section .text:
@@ -36,7 +36,7 @@ Disassembly of section .text:
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>
c: 0c 94 67 00 jmp 0xce ; 0xce <__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>
@@ -72,7 +72,7 @@ Disassembly of section .text:
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
7a: e2 e7 ldi r30, 0x72 ; 114
7c: f2 e0 ldi r31, 0x02 ; 2
7e: 02 c0 rjmp .+4 ; 0x84 <__do_copy_data+0x10>
80: 05 90 lpm r0, Z+
@@ -91,295 +91,315 @@ Disassembly of section .text:
92: 1d 92 st X+, r1
00000094 <.do_clear_bss_start>:
94: a8 31 cpi r26, 0x18 ; 24
94: a6 31 cpi r26, 0x16 ; 22
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>
9a: 0e 94 a5 00 call 0x14a ; 0x14a <main>
9e: 0c 94 37 01 jmp 0x26e ; 0x26e <_exit>
000000a2 <__bad_interrupt>:
a2: 0c 94 00 00 jmp 0 ; 0x0 <__vectors>
000000a6 <init>:
#include"keys.h"
#include "keys.h"
void init(){
DDRD = 0xff; // Data direction register D (D0 -> D6) as input
DDRD = 0xff; // Data direction register D (D0 -> D6) as output
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
// PORTD = 0xff; // setting bit for 7-segment show 0
// => spielt keine Rolle, wird von der while Schleife <20>bernommen
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
DDRB = 0x01; // Data direction register B (B0) as output and DDRB (B1, B2) as input
aa: 81 e0 ldi r24, 0x01 ; 1
ac: 84 b9 out 0x04, r24 ; 4
PORTB |= (1 << PINB1) | (1 << PINB2) ; // setting bit for teens and SW1-2
ae: 85 b1 in r24, 0x05 ; 5
b0: 86 60 ori r24, 0x06 ; 6
b2: 85 b9 out 0x05, r24 ; 5
// mit unserem Atmega nicht m<>glich, da keine PCINT8_vect und PCINT9_vect vorhanden
// DDRC = 0x00; // Data direction register C as input for SW1 and SW2
// PORTC |= (1<<PINC0) | (1<<PINC1); // settings pins for SW1 -> PINC0 and SW2 -> PINC1
cli(); // clear global interrupt flag: interrupts will be immediately disabled
b6: f8 94 cli
b4: 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
b6: e8 e6 ldi r30, 0x68 ; 104
b8: f0 e0 ldi r31, 0x00 ; 0
ba: 80 81 ld r24, Z
bc: 81 60 ori r24, 0x01 ; 1
be: 80 83 st Z, r24
PCMSK0 |= (1 << PINB1) | (1 << PINB2); // trigger interrupt when SW1 or SW2 is pressed
c0: eb e6 ldi r30, 0x6B ; 107
c2: f0 e0 ldi r31, 0x00 ; 0
c4: 80 81 ld r24, Z
c6: 86 60 ori r24, 0x06 ; 6
c8: 80 83 st Z, r24
sei(); // set global interrupt enable
cc: 78 94 sei
ce: 08 95 ret
ca: 78 94 sei
cc: 08 95 ret
000000d0 <__vector_3>:
*/
000000ce <__vector_3>:
#include "keys.h"
#include "sevenseg.h"
int numbersAsSegments[10] = { 192, 249, 164, 48, 153, 146, 130, 248, 128, 144 }; // display number from 0 to 9;
volatile uint32_t count = 0;
volatile int 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>
ISR(PCINT0_vect) { // every 10ms interrupt is triggered
ce: 1f 92 push r1
d0: 0f 92 push r0
d2: 0f b6 in r0, 0x3f ; 63
d4: 0f 92 push r0
d6: 11 24 eor r1, r1
d8: 8f 93 push r24
da: 9f 93 push r25
if (!(PINB & (1<<PINB1))) { // sw1 is pressed
dc: 19 99 sbic 0x03, 1 ; 3
de: 16 c0 rjmp .+44 ; 0x10c <__vector_3+0x3e>
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>
e0: 80 91 14 01 lds r24, 0x0114 ; 0x800114 <__data_end>
e4: 90 91 15 01 lds r25, 0x0115 ; 0x800115 <__data_end+0x1>
e8: 89 2b or r24, r25
ea: 31 f4 brne .+12 ; 0xf8 <__vector_3+0x2a>
count = 100; // 100 - 1 = 99
ec: 84 e6 ldi r24, 0x64 ; 100
ee: 90 e0 ldi r25, 0x00 ; 0
f0: 90 93 15 01 sts 0x0115, r25 ; 0x800115 <__data_end+0x1>
f4: 80 93 14 01 sts 0x0114, r24 ; 0x800114 <__data_end>
}
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>
f8: 80 91 14 01 lds r24, 0x0114 ; 0x800114 <__data_end>
fc: 90 91 15 01 lds r25, 0x0115 ; 0x800115 <__data_end+0x1>
100: 01 97 sbiw r24, 0x01 ; 1
102: 90 93 15 01 sts 0x0115, r25 ; 0x800115 <__data_end+0x1>
106: 80 93 14 01 sts 0x0114, r24 ; 0x800114 <__data_end>
10a: 18 c0 rjmp .+48 ; 0x13c <__vector_3+0x6e>
}
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>
else if (!(PINB & (1<<PINB2))) { // sw2 is pressed
10c: 1a 99 sbic 0x03, 2 ; 3
10e: 16 c0 rjmp .+44 ; 0x13c <__vector_3+0x6e>
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>
110: 80 91 14 01 lds r24, 0x0114 ; 0x800114 <__data_end>
114: 90 91 15 01 lds r25, 0x0115 ; 0x800115 <__data_end+0x1>
118: 83 36 cpi r24, 0x63 ; 99
11a: 91 05 cpc r25, r1
11c: 31 f4 brne .+12 ; 0x12a <__vector_3+0x5c>
count = -1; // -1 + 1 = 0
11e: 8f ef ldi r24, 0xFF ; 255
120: 9f ef ldi r25, 0xFF ; 255
122: 90 93 15 01 sts 0x0115, r25 ; 0x800115 <__data_end+0x1>
126: 80 93 14 01 sts 0x0114, r24 ; 0x800114 <__data_end>
}
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>
12a: 80 91 14 01 lds r24, 0x0114 ; 0x800114 <__data_end>
12e: 90 91 15 01 lds r25, 0x0115 ; 0x800115 <__data_end+0x1>
132: 01 96 adiw r24, 0x01 ; 1
134: 90 93 15 01 sts 0x0115, r25 ; 0x800115 <__data_end+0x1>
138: 80 93 14 01 sts 0x0114, r24 ; 0x800114 <__data_end>
}
}
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
13c: 9f 91 pop r25
13e: 8f 91 pop r24
140: 0f 90 pop r0
142: 0f be out 0x3f, r0 ; 63
144: 0f 90 pop r0
146: 1f 90 pop r1
148: 18 95 reti
000001a8 <main>:
0000014a <main>:
int main(void)
{
init(); // initializing SW1 and SW2
1a8: 0e 94 53 00 call 0xa6 ; 0xa6 <init>
int main(void) {
init();
14a: 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>
display(count);
14e: 80 91 14 01 lds r24, 0x0114 ; 0x800114 <__data_end>
152: 90 91 15 01 lds r25, 0x0115 ; 0x800115 <__data_end+0x1>
156: 0e 94 ae 00 call 0x15c ; 0x15c <display>
15a: f9 cf rjmp .-14 ; 0x14e <main+0x4>
0000020e <display>:
0000015c <display>:
#include "sevenseg.h"
#include <stdbool.h>
void display(bool tens, int num, int numList[]) {
void display(int count) {
15c: 0f 93 push r16
15e: 1f 93 push r17
160: cf 93 push r28
162: df 93 push r29
164: cd b7 in r28, 0x3d ; 61
166: de b7 in r29, 0x3e ; 62
168: 68 97 sbiw r28, 0x18 ; 24
16a: 0f b6 in r0, 0x3f ; 63
16c: f8 94 cli
16e: de bf out 0x3e, r29 ; 62
170: 0f be out 0x3f, r0 ; 63
172: cd bf out 0x3d, r28 ; 61
174: 9c 01 movw r18, r24
7 : 1111 1000 = F8 248
8 : 1000 0000 = 80 128
9 : 1001 0000 = 90 144
*/
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
int numbersAsSegments[10] = { 192, 249, 164, 48, 153, 146, 130, 248, 128, 144 }; // display number from 0 to 9;
176: 84 e1 ldi r24, 0x14 ; 20
178: e0 e0 ldi r30, 0x00 ; 0
17a: f1 e0 ldi r31, 0x01 ; 1
17c: de 01 movw r26, r28
17e: 11 96 adiw r26, 0x01 ; 1
180: 01 90 ld r0, Z+
182: 0d 92 st X+, r0
184: 8a 95 dec r24
186: e1 f7 brne .-8 ; 0x180 <display+0x24>
volatile int led_Einer = numbersAsSegments[(int) count % 10]; // Segmentanzeige f<>r Zehner
188: 0a e0 ldi r16, 0x0A ; 10
18a: 10 e0 ldi r17, 0x00 ; 0
18c: c9 01 movw r24, r18
18e: b8 01 movw r22, r16
190: 0e 94 0f 01 call 0x21e ; 0x21e <__divmodhi4>
194: fc 01 movw r30, r24
196: ee 0f add r30, r30
198: ff 1f adc r31, r31
19a: 41 e0 ldi r20, 0x01 ; 1
19c: 50 e0 ldi r21, 0x00 ; 0
19e: 4c 0f add r20, r28
1a0: 5d 1f adc r21, r29
1a2: e4 0f add r30, r20
1a4: f5 1f adc r31, r21
1a6: 40 81 ld r20, Z
1a8: 51 81 ldd r21, Z+1 ; 0x01
1aa: 5e 8b std Y+22, r21 ; 0x16
1ac: 4d 8b std Y+21, r20 ; 0x15
volatile int led_Zehner = numbersAsSegments[(int) (count - (count % 10)) / 10]; // Segmentanzeige f<>r Einer
1ae: f9 01 movw r30, r18
1b0: e8 1b sub r30, r24
1b2: f9 0b sbc r31, r25
1b4: cf 01 movw r24, r30
1b6: b8 01 movw r22, r16
1b8: 0e 94 0f 01 call 0x21e ; 0x21e <__divmodhi4>
1bc: fb 01 movw r30, r22
1be: ee 0f add r30, r30
1c0: ff 1f adc r31, r31
1c2: 41 e0 ldi r20, 0x01 ; 1
1c4: 50 e0 ldi r21, 0x00 ; 0
1c6: 4c 0f add r20, r28
1c8: 5d 1f adc r21, r29
1ca: e4 0f add r30, r20
1cc: f5 1f adc r31, r21
1ce: 80 81 ld r24, Z
1d0: 91 81 ldd r25, Z+1 ; 0x01
1d2: 98 8f std Y+24, r25 ; 0x18
1d4: 8f 8b std Y+23, r24 ; 0x17
PORTD = led_Einer;
1d6: 8d 89 ldd r24, Y+21 ; 0x15
1d8: 9e 89 ldd r25, Y+22 ; 0x16
1da: 8b b9 out 0x0b, r24 ; 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
1dc: 8f e3 ldi r24, 0x3F ; 63
1de: 9c e9 ldi r25, 0x9C ; 156
1e0: 01 97 sbiw r24, 0x01 ; 1
1e2: f1 f7 brne .-4 ; 0x1e0 <display+0x84>
1e4: 00 c0 rjmp .+0 ; 0x1e6 <display+0x8a>
1e6: 00 00 nop
_delay_ms(10);
PORTB ^= (1 << PINB0);
1e8: 95 b1 in r25, 0x05 ; 5
1ea: 81 e0 ldi r24, 0x01 ; 1
1ec: 98 27 eor r25, r24
1ee: 95 b9 out 0x05, r25 ; 5
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
PORTD = led_Zehner;
1f0: 2f 89 ldd r18, Y+23 ; 0x17
1f2: 38 8d ldd r19, Y+24 ; 0x18
1f4: 2b b9 out 0x0b, r18 ; 11
1f6: ef e3 ldi r30, 0x3F ; 63
1f8: fc e9 ldi r31, 0x9C ; 156
1fa: 31 97 sbiw r30, 0x01 ; 1
1fc: f1 f7 brne .-4 ; 0x1fa <display+0x9e>
1fe: 00 c0 rjmp .+0 ; 0x200 <display+0xa4>
200: 00 00 nop
_delay_ms(10);
PORTB ^= (1 << PINB0);
202: 95 b1 in r25, 0x05 ; 5
204: 89 27 eor r24, r25
206: 85 b9 out 0x05, r24 ; 5
}
208: 68 96 adiw r28, 0x18 ; 24
20a: 0f b6 in r0, 0x3f ; 63
20c: f8 94 cli
20e: de bf out 0x3e, r29 ; 62
210: 0f be out 0x3f, r0 ; 63
212: cd bf out 0x3d, r28 ; 61
214: df 91 pop r29
216: cf 91 pop r28
218: 1f 91 pop r17
21a: 0f 91 pop r16
21c: 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>
0000021e <__divmodhi4>:
21e: 97 fb bst r25, 7
220: 07 2e mov r0, r23
222: 16 f4 brtc .+4 ; 0x228 <__divmodhi4+0xa>
224: 00 94 com r0
226: 07 d0 rcall .+14 ; 0x236 <__divmodhi4_neg1>
228: 77 fd sbrc r23, 7
22a: 09 d0 rcall .+18 ; 0x23e <__divmodhi4_neg2>
22c: 0e 94 23 01 call 0x246 ; 0x246 <__udivmodhi4>
230: 07 fc sbrc r0, 7
232: 05 d0 rcall .+10 ; 0x23e <__divmodhi4_neg2>
234: 3e f4 brtc .+14 ; 0x244 <__divmodhi4_exit>
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
00000236 <__divmodhi4_neg1>:
236: 90 95 com r25
238: 81 95 neg r24
23a: 9f 4f sbci r25, 0xFF ; 255
23c: 08 95 ret
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
0000023e <__divmodhi4_neg2>:
23e: 70 95 com r23
240: 61 95 neg r22
242: 7f 4f sbci r23, 0xFF ; 255
0000027a <_exit>:
27a: f8 94 cli
00000244 <__divmodhi4_exit>:
244: 08 95 ret
0000027c <__stop_program>:
27c: ff cf rjmp .-2 ; 0x27c <__stop_program>
00000246 <__udivmodhi4>:
246: aa 1b sub r26, r26
248: bb 1b sub r27, r27
24a: 51 e1 ldi r21, 0x11 ; 17
24c: 07 c0 rjmp .+14 ; 0x25c <__udivmodhi4_ep>
0000024e <__udivmodhi4_loop>:
24e: aa 1f adc r26, r26
250: bb 1f adc r27, r27
252: a6 17 cp r26, r22
254: b7 07 cpc r27, r23
256: 10 f0 brcs .+4 ; 0x25c <__udivmodhi4_ep>
258: a6 1b sub r26, r22
25a: b7 0b sbc r27, r23
0000025c <__udivmodhi4_ep>:
25c: 88 1f adc r24, r24
25e: 99 1f adc r25, r25
260: 5a 95 dec r21
262: a9 f7 brne .-22 ; 0x24e <__udivmodhi4_loop>
264: 80 95 com r24
266: 90 95 com r25
268: bc 01 movw r22, r24
26a: cd 01 movw r24, r26
26c: 08 95 ret
0000026e <_exit>:
26e: f8 94 cli
00000270 <__stop_program>:
270: ff cf rjmp .-2 ; 0x270 <__stop_program>

View File

@@ -1,13 +1,15 @@
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(_divmodhi4.o)
sevenseg.o (__divmodhi4)
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)
sevenseg.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)
c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_udivmodhi4.o)
c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_divmodhi4.o) (__udivmodhi4)
Discarded input sections
@@ -22,20 +24,20 @@ Discarded input sections
.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 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(_divmodhi4.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(_divmodhi4.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(_divmodhi4.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)
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(_divmodhi4.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(_divmodhi4.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)
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(_divmodhi4.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)
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(_divmodhi4.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)
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(_divmodhi4.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)
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(_divmodhi4.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)
@@ -84,6 +86,20 @@ Discarded input sections
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)
.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(_udivmodhi4.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(_udivmodhi4.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(_udivmodhi4.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(_udivmodhi4.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(_udivmodhi4.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(_udivmodhi4.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(_udivmodhi4.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(_udivmodhi4.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(_udivmodhi4.o)
Memory Configuration
@@ -211,7 +227,7 @@ END GROUP
.rela.plt
*(.rela.plt)
.text 0x00000000 0x27e
.text 0x00000000 0x272
*(.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
@@ -297,23 +313,27 @@ END GROUP
0x000000a2 __vector_20
0x000000a6 . = ALIGN (0x2)
*(.text.*)
.text.init 0x000000a6 0x2a keys.o
.text.init 0x000000a6 0x28 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
0x000000ce 0x7c main.o
0x000000ce __vector_3
.text.main 0x0000014a 0x12 main.o
0x0000014a main
.text.display 0x0000015c 0xc2 sevenseg.o
0x0000015c 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)
0x0000021e 0x28 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_divmodhi4.o)
0x0000021e _div
0x0000021e __divmodhi4
.text.libgcc.div
0x00000246 0x28 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avr5\libgcc.a(_udivmodhi4.o)
0x00000246 __udivmodhi4
0x0000026e . = 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 0x0000026e 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)
0x0000026e _exit
0x0000026e exit
*(.fini9)
*(.fini8)
*(.fini8)
@@ -332,41 +352,39 @@ END GROUP
*(.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 0x0000026e 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 = .
0x00000272 _etext = .
.data 0x00800100 0x14 load address 0x0000027e
.data 0x00800100 0x14 load address 0x00000272
0x00800100 PROVIDE (__data_start, .)
*(.data)
*(.data*)
.data.numbersAsSegments
0x00800100 0x14 main.o
0x00800100 numbersAsSegments
*(.gnu.linkonce.d*)
*(.rodata)
.rodata 0x00800100 0x14 sevenseg.o
*(.rodata*)
*(.gnu.linkonce.r*)
0x00800114 . = ALIGN (0x2)
0x00800114 _edata = .
0x00800114 PROVIDE (__data_end, .)
.bss 0x00800114 0x4
.bss 0x00800114 0x2
0x00800114 PROVIDE (__bss_start, .)
*(.bss)
*(.bss*)
.bss.count 0x00800114 0x4 main.o
.bss.count 0x00800114 0x2 main.o
0x00800114 count
*(COMMON)
0x00800118 PROVIDE (__bss_end, .)
0x0000027e __data_load_start = LOADADDR (.data)
0x00000292 __data_load_end = (__data_load_start + SIZEOF (.data))
0x00800116 PROVIDE (__bss_end, .)
0x00000272 __data_load_start = LOADADDR (.data)
0x00000286 __data_load_end = (__data_load_start + SIZEOF (.data))
.noinit 0x00800118 0x0
.noinit 0x00800116 0x0
[!provide] PROVIDE (__noinit_start, .)
*(.noinit*)
[!provide] PROVIDE (__noinit_end, .)
0x00800118 _end = .
0x00800116 _end = .
[!provide] PROVIDE (__heap_start, .)
.eeprom 0x00810000 0x0
@@ -445,47 +463,47 @@ END GROUP
.debug_pubnames
*(.debug_pubnames)
.debug_info 0x00000000 0x944
.debug_info 0x00000000 0x8f2
*(.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_info 0x00000676 0xe6 main.o
.debug_info 0x0000075c 0x196 sevenseg.o
.debug_abbrev 0x00000000 0x7e4
.debug_abbrev 0x00000000 0x797
*(.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_abbrev 0x000005f1 0xa5 main.o
.debug_abbrev 0x00000696 0x101 sevenseg.o
.debug_line 0x00000000 0x458
.debug_line 0x00000000 0x448
*(.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_line 0x00000133 0xc3 keys.o
.debug_line 0x000001f6 0x107 main.o
.debug_line 0x000002fd 0x14b sevenseg.o
.debug_frame 0x00000000 0x9c
.debug_frame 0x00000000 0xac
*(.debug_frame)
.debug_frame 0x00000000 0x24 keys.o
.debug_frame 0x00000024 0x54 main.o
.debug_frame 0x00000078 0x24 sevenseg.o
.debug_frame 0x00000024 0x48 main.o
.debug_frame 0x0000006c 0x40 sevenseg.o
.debug_str 0x00000000 0x430
.debug_str 0x00000000 0x41d
*(.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_str 0x00000368 0x2a main.o
0x1b2 (size before relaxing)
.debug_str 0x00000392 0x8b sevenseg.o
0x21c (size before relaxing)
.debug_loc 0x00000000 0x118
.debug_loc 0x00000000 0x170
*(.debug_loc)
.debug_loc 0x00000000 0x7e main.o
.debug_loc 0x0000007e 0x9a sevenseg.o
.debug_loc 0x00000000 0x49 main.o
.debug_loc 0x00000049 0x127 sevenseg.o
.debug_macinfo
*(.debug_macinfo)

View File

@@ -1,44 +1,44 @@
S00A000050342E7372656396
S11300000C9434000C9451000C9451000C9468002E
S11300000C9434000C9451000C9451000C9467002F
S11300100C9451000C9451000C9451000C94510018
S11300200C9451000C9451000C9451000C94510008
S11300300C9451000C9451000C9451000C945100F8
S11300400C9451000C9451000C9451000C945100E8
S11300500C9451000C9451000C9451000C945100D8
S11300600C9451000C94510011241FBECFEFD8E022
S1130070DEBFCDBF11E0A0E0B1E0EEE7F2E002C0E8
S1130070DEBFCDBF11E0A0E0B1E0E2E7F2E002C0F4
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
S113009001C01D92A631B207E1F70E94A5000C949D
S11300A037010C9400008FEF8AB981E084B985B1DF
S11300B0866085B9F894E8E6F0E080818160808309
S11300C0EBE6F0E0808186608083789408951F9247
S11300D00F920FB60F9211248F939F93199916C004
S11300E08091140190911501892B31F484E690E0FC
S11300F0909315018093140180911401909115013E
S11301000197909315018093140118C01A9916C091
S113011080911401909115018336910531F48FEF8C
S11301209FEF909315018093140180911401909195
S11301301501019690931501809314019F918F915D
S11301400F900FBE0F901F9018950E94530080913E
S11301501401909115010E94AE00F9CF0F931F93E3
S1130160CF93DF93CDB7DEB768970FB6F894DEBFB1
S11301700FBECDBF9C0184E1E0E0F1E0DE01119609
S113018001900D928A95E1F70AE010E0C901B801E7
S11301900E940F01FC01EE0FFF1F41E050E04C0FE5
S11301A05D1FE40FF51F408151815E8B4D8BF9017A
S11301B0E81BF90BCF01B8010E940F01FB01EE0F00
S11301C0FF1F41E050E04C0F5D1FE40FF51F8081DD
S11301D09181988F8F8B8D899E898BB98FE39CE950
S11301E00197F1F700C0000095B181E0982795B917
S11301F02F89388D2BB9EFE3FCE93197F1F700C073
S1130200000095B1892785B968960FB6F894DEBFCA
S11302100FBECDBFDF91CF911F910F91089597FB32
S1130220072E16F4009407D077FD09D00E9423010D
S113023007FC05D03EF4909581959F4F08957095E5
S113024061957F4F0895AA1BBB1B51E107C0AA1FEC
S1130250BB1FA617B70710F0A61BB70B881F991F63
S11302605A95A9F780959095BC01CD010895F8940D
S1050270FFCFBA
S1130272C000F900A4003000990092008200F80046
S10702828000900064
S9030000FC

Binary file not shown.

View File

@@ -14,8 +14,7 @@ main.d main.o: .././main.c .././keys.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
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h
.././keys.h:
@@ -50,5 +49,3 @@ c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\
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:

Binary file not shown.

View File

@@ -12,8 +12,7 @@ sevenseg.d sevenseg.o: .././sevenseg.c .././sevenseg.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
c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h
.././sevenseg.h:
@@ -44,5 +43,3 @@ c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\
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:

Binary file not shown.

View File

@@ -1,22 +0,0 @@
/*
* 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

@@ -20,14 +20,27 @@
<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 />
<avrtool>com.atmel.avrdbg.tool.simulator</avrtool>
<avrtoolserialnumber />
<avrdeviceexpectedsignature>0x1E950F</avrdeviceexpectedsignature>
<com_atmel_avrdbg_tool_simulator>
<ToolOptions xmlns="">
<InterfaceProperties>
</InterfaceProperties>
</ToolOptions>
<ToolType xmlns="">com.atmel.avrdbg.tool.simulator</ToolType>
<ToolNumber xmlns="">
</ToolNumber>
<ToolName xmlns="">Simulator</ToolName>
</com_atmel_avrdbg_tool_simulator>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<ToolchainSettings>

22
P4/P4/keys.c Normal file
View File

@@ -0,0 +1,22 @@
#include "keys.h"
void init(){
DDRD = 0xff; // Data direction register D (D0 -> D6) as output
// PORTD = 0xff; // setting bit for 7-segment show 0
// => spielt keine Rolle, wird von der while Schleife <20>bernommen
DDRB = 0x01; // Data direction register B (B0) as output and DDRB (B1, B2) as input
PORTB |= (1 << PINB1) | (1 << PINB2) ; // setting bit for teens and SW1-2
// PINB=0 => start with LED3 (Einer)
// mit unserem Atmega nicht m<>glich, da keine PCINT8_vect und PCINT9_vect vorhanden
// DDRC = 0x00; // Data direction register C as input for SW1 and SW2
// PORTC |= (1<<PINC0) | (1<<PINC1); // settings pins for SW1 -> PINC0 and SW2 -> PINC1
cli(); // clear global interrupt flag: interrupts will be immediately disabled
PCICR |= 0x01; // Pin Change Interrupt Control Register: turn on PortB
PCMSK0 |= (1 << PINB1) | (1 << PINB2); // trigger interrupt when SW1 or SW2 is pressed
sei(); // set global interrupt enable
}

View File

@@ -1,19 +1,9 @@
/*
* 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();

View File

@@ -1,59 +1,26 @@
/*
* 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
volatile int count = 0;
.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
}
ISR(PCINT0_vect) { // every 10ms interrupt is triggered
if (!(PINB & (1<<PINB1))) { // count down => sw1 is pressed
if (count == 0) count = 100; // 100 - 1 = 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
}
if (!(PINB & (1<<PINB2))) { // count up => sw2 is pressed
if (count == 99) count = -1; // -1 + 1 = 0
count++;
}
}
int main(void)
{
init(); // initializing SW1 and SW2
int main(void) {
init();
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);
display(count);
}
}

View File

@@ -1,17 +1,33 @@
#include "sevenseg.h"
#include <stdbool.h>
void display(bool tens, int num, int numList[]) {
void display(int count) {
/*
logical 0: on
logical 1: off
PORTD = numList[num]; // Displays the Number on PortD
.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 int led_Einer = numbersAsSegments[(int) count % 10]; // Segmentanzeige f<>r Zehner
volatile int led_Zehner = numbersAsSegments[(int) (count - (count % 10)) / 10]; // Segmentanzeige f<>r Einer
PORTD = led_Einer;
_delay_ms(10);
PORTB ^= (1 << PINB0);
// teens durch den Wert von PortB ersetzen
if(tens) {
PORTB = 1;
}
else {
PORTB = 0;
}
PORTD = led_Zehner;
_delay_ms(10);
PORTB ^= (1 << PINB0);
}

View File

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