a.out: file format elf32-avr Sections: Idx Name Size VMA LMA File off Algn 0 .text 00000046 00000000 00000000 00000074 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE 1 .data 00000000 00800060 00000046 000000ba 2**0 CONTENTS, ALLOC, LOAD, DATA 2 .comment 00000026 00000000 00000000 000000ba 2**0 CONTENTS, READONLY 3 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 000000e0 2**2 CONTENTS, READONLY, OCTETS 4 .debug_aranges 00000040 00000000 00000000 00000120 2**3 CONTENTS, READONLY, DEBUGGING, OCTETS 5 .debug_info 00000489 00000000 00000000 00000160 2**0 CONTENTS, READONLY, DEBUGGING, OCTETS 6 .debug_abbrev 00000435 00000000 00000000 000005e9 2**0 CONTENTS, READONLY, DEBUGGING, OCTETS 7 .debug_line 00000131 00000000 00000000 00000a1e 2**0 CONTENTS, READONLY, DEBUGGING, OCTETS 8 .debug_frame 00000024 00000000 00000000 00000b50 2**2 CONTENTS, READONLY, DEBUGGING, OCTETS 9 .debug_str 0000026e 00000000 00000000 00000b74 2**0 CONTENTS, READONLY, DEBUGGING, OCTETS 10 .debug_ranges 00000010 00000000 00000000 00000de2 2**0 CONTENTS, READONLY, DEBUGGING, OCTETS Disassembly of section .text: 00000000 <__vectors>: 0: 0e c0 rjmp .+28 ; 0x1e <__ctors_end> 2: 15 c0 rjmp .+42 ; 0x2e <__bad_interrupt> 4: 14 c0 rjmp .+40 ; 0x2e <__bad_interrupt> 6: 13 c0 rjmp .+38 ; 0x2e <__bad_interrupt> 8: 12 c0 rjmp .+36 ; 0x2e <__bad_interrupt> a: 11 c0 rjmp .+34 ; 0x2e <__bad_interrupt> c: 10 c0 rjmp .+32 ; 0x2e <__bad_interrupt> e: 0f c0 rjmp .+30 ; 0x2e <__bad_interrupt> 10: 0e c0 rjmp .+28 ; 0x2e <__bad_interrupt> 12: 0d c0 rjmp .+26 ; 0x2e <__bad_interrupt> 14: 0c c0 rjmp .+24 ; 0x2e <__bad_interrupt> 16: 0b c0 rjmp .+22 ; 0x2e <__bad_interrupt> 18: 0a c0 rjmp .+20 ; 0x2e <__bad_interrupt> 1a: 09 c0 rjmp .+18 ; 0x2e <__bad_interrupt> 1c: 08 c0 rjmp .+16 ; 0x2e <__bad_interrupt> 0000001e <__ctors_end>: 1e: 11 24 eor r1, r1 20: 1f be out 0x3f, r1 ; 63 22: cf e5 ldi r28, 0x5F ; 95 24: d1 e0 ldi r29, 0x01 ; 1 26: de bf out 0x3e, r29 ; 62 28: cd bf out 0x3d, r28 ; 61 2a: 02 d0 rcall .+4 ; 0x30
2c: 0a c0 rjmp .+20 ; 0x42 <_exit> 0000002e <__bad_interrupt>: 2e: e8 cf rjmp .-48 ; 0x0 <__vectors> 00000030
: #define LED_PIN 3 #define SWITCH_PIN 4 int main() { //set led pin bit to output DDRB |= (1<: //set switch pin bit to input DDRB &= ~(1<: //for voltage high == no press config, sets pull up. PORTB |= (1<: //give the pull up a moment. //TODO pullup is slow to warm up. while (1) { if (!(PINB & (1< 0000003a <.Loc.10>: //above if compares (0x000?0000 & 0x00010000) => // - if true, seeing pull up. button not pressed // - if false, seeing ground via closed switch, button pressed PORTB &= ~(1< 0000003e <.L3>: } else { PORTB |= (1< 00000042 <_exit>: 42: f8 94 cli 00000044 <__stop_program>: 44: ff cf rjmp .-2 ; 0x44 <__stop_program>