Files
microcontrollers/Microcontrollers/testlcd/Debug/testlcd.lss
Guilliam Lutz f3fa8afa60 Opdracht 3
2021-03-10 09:59:28 +01:00

431 lines
14 KiB
Plaintext

testlcd.elf: file format elf32-avr
Sections:
Idx Name Size VMA LMA File off Algn
0 .data 0000000e 00800100 000001ce 00000242 2**0
CONTENTS, ALLOC, LOAD, DATA
1 .text 000001ce 00000000 00000000 00000074 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .comment 00000030 00000000 00000000 00000250 2**0
CONTENTS, READONLY
3 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 00000280 2**2
CONTENTS, READONLY
4 .debug_aranges 00000058 00000000 00000000 000002bc 2**0
CONTENTS, READONLY, DEBUGGING
5 .debug_info 00000b5a 00000000 00000000 00000314 2**0
CONTENTS, READONLY, DEBUGGING
6 .debug_abbrev 0000088d 00000000 00000000 00000e6e 2**0
CONTENTS, READONLY, DEBUGGING
7 .debug_line 00000470 00000000 00000000 000016fb 2**0
CONTENTS, READONLY, DEBUGGING
8 .debug_frame 000000b8 00000000 00000000 00001b6c 2**2
CONTENTS, READONLY, DEBUGGING
9 .debug_str 000004a0 00000000 00000000 00001c24 2**0
CONTENTS, READONLY, DEBUGGING
10 .debug_loc 00000299 00000000 00000000 000020c4 2**0
CONTENTS, READONLY, DEBUGGING
11 .debug_ranges 00000048 00000000 00000000 0000235d 2**0
CONTENTS, READONLY, DEBUGGING
Disassembly of section .text:
00000000 <__vectors>:
0: 45 c0 rjmp .+138 ; 0x8c <__ctors_end>
2: 00 00 nop
4: 58 c0 rjmp .+176 ; 0xb6 <__bad_interrupt>
6: 00 00 nop
8: 56 c0 rjmp .+172 ; 0xb6 <__bad_interrupt>
a: 00 00 nop
c: 54 c0 rjmp .+168 ; 0xb6 <__bad_interrupt>
e: 00 00 nop
10: 52 c0 rjmp .+164 ; 0xb6 <__bad_interrupt>
12: 00 00 nop
14: 50 c0 rjmp .+160 ; 0xb6 <__bad_interrupt>
16: 00 00 nop
18: 4e c0 rjmp .+156 ; 0xb6 <__bad_interrupt>
1a: 00 00 nop
1c: 4c c0 rjmp .+152 ; 0xb6 <__bad_interrupt>
1e: 00 00 nop
20: 4a c0 rjmp .+148 ; 0xb6 <__bad_interrupt>
22: 00 00 nop
24: 48 c0 rjmp .+144 ; 0xb6 <__bad_interrupt>
26: 00 00 nop
28: 46 c0 rjmp .+140 ; 0xb6 <__bad_interrupt>
2a: 00 00 nop
2c: 44 c0 rjmp .+136 ; 0xb6 <__bad_interrupt>
2e: 00 00 nop
30: 42 c0 rjmp .+132 ; 0xb6 <__bad_interrupt>
32: 00 00 nop
34: 40 c0 rjmp .+128 ; 0xb6 <__bad_interrupt>
36: 00 00 nop
38: 3e c0 rjmp .+124 ; 0xb6 <__bad_interrupt>
3a: 00 00 nop
3c: 3c c0 rjmp .+120 ; 0xb6 <__bad_interrupt>
3e: 00 00 nop
40: 3a c0 rjmp .+116 ; 0xb6 <__bad_interrupt>
42: 00 00 nop
44: 38 c0 rjmp .+112 ; 0xb6 <__bad_interrupt>
46: 00 00 nop
48: 36 c0 rjmp .+108 ; 0xb6 <__bad_interrupt>
4a: 00 00 nop
4c: 34 c0 rjmp .+104 ; 0xb6 <__bad_interrupt>
4e: 00 00 nop
50: 32 c0 rjmp .+100 ; 0xb6 <__bad_interrupt>
52: 00 00 nop
54: 30 c0 rjmp .+96 ; 0xb6 <__bad_interrupt>
56: 00 00 nop
58: 2e c0 rjmp .+92 ; 0xb6 <__bad_interrupt>
5a: 00 00 nop
5c: 2c c0 rjmp .+88 ; 0xb6 <__bad_interrupt>
5e: 00 00 nop
60: 2a c0 rjmp .+84 ; 0xb6 <__bad_interrupt>
62: 00 00 nop
64: 28 c0 rjmp .+80 ; 0xb6 <__bad_interrupt>
66: 00 00 nop
68: 26 c0 rjmp .+76 ; 0xb6 <__bad_interrupt>
6a: 00 00 nop
6c: 24 c0 rjmp .+72 ; 0xb6 <__bad_interrupt>
6e: 00 00 nop
70: 22 c0 rjmp .+68 ; 0xb6 <__bad_interrupt>
72: 00 00 nop
74: 20 c0 rjmp .+64 ; 0xb6 <__bad_interrupt>
76: 00 00 nop
78: 1e c0 rjmp .+60 ; 0xb6 <__bad_interrupt>
7a: 00 00 nop
7c: 1c c0 rjmp .+56 ; 0xb6 <__bad_interrupt>
7e: 00 00 nop
80: 1a c0 rjmp .+52 ; 0xb6 <__bad_interrupt>
82: 00 00 nop
84: 18 c0 rjmp .+48 ; 0xb6 <__bad_interrupt>
86: 00 00 nop
88: 16 c0 rjmp .+44 ; 0xb6 <__bad_interrupt>
...
0000008c <__ctors_end>:
8c: 11 24 eor r1, r1
8e: 1f be out 0x3f, r1 ; 63
90: cf ef ldi r28, 0xFF ; 255
92: d0 e1 ldi r29, 0x10 ; 16
94: de bf out 0x3e, r29 ; 62
96: cd bf out 0x3d, r28 ; 61
00000098 <__do_copy_data>:
98: 11 e0 ldi r17, 0x01 ; 1
9a: a0 e0 ldi r26, 0x00 ; 0
9c: b1 e0 ldi r27, 0x01 ; 1
9e: ee ec ldi r30, 0xCE ; 206
a0: f1 e0 ldi r31, 0x01 ; 1
a2: 00 e0 ldi r16, 0x00 ; 0
a4: 0b bf out 0x3b, r16 ; 59
a6: 02 c0 rjmp .+4 ; 0xac <__do_copy_data+0x14>
a8: 07 90 elpm r0, Z+
aa: 0d 92 st X+, r0
ac: ae 30 cpi r26, 0x0E ; 14
ae: b1 07 cpc r27, r17
b0: d9 f7 brne .-10 ; 0xa8 <__do_copy_data+0x10>
b2: 75 d0 rcall .+234 ; 0x19e <main>
b4: 8a c0 rjmp .+276 ; 0x1ca <_exit>
000000b6 <__bad_interrupt>:
b6: a4 cf rjmp .-184 ; 0x0 <__vectors>
000000b8 <wait>:
clock value is set. This is used by _delay_ms inside
util/delay.h
Version : DMK, Initial code
*******************************************************************/
void wait( int ms ) {
for (int i=0; i<ms; i++) {
b8: 20 e0 ldi r18, 0x00 ; 0
ba: 30 e0 ldi r19, 0x00 ; 0
bc: 08 c0 rjmp .+16 ; 0xce <wait+0x16>
#else
//round up by default
__ticks_dc = (uint32_t)(ceil(fabs(__tmp)));
#endif
__builtin_avr_delay_cycles(__ticks_dc);
be: ef ec ldi r30, 0xCF ; 207
c0: f7 e0 ldi r31, 0x07 ; 7
c2: 31 97 sbiw r30, 0x01 ; 1
c4: f1 f7 brne .-4 ; 0xc2 <wait+0xa>
c6: 00 c0 rjmp .+0 ; 0xc8 <wait+0x10>
c8: 00 00 nop
ca: 2f 5f subi r18, 0xFF ; 255
cc: 3f 4f sbci r19, 0xFF ; 255
ce: 28 17 cp r18, r24
d0: 39 07 cpc r19, r25
d2: ac f3 brlt .-22 ; 0xbe <wait+0x6>
_delay_ms( 1 ); // library function (max 30 ms at 8MHz)
}
}
d4: 08 95 ret
000000d6 <lcd_strobe_lcd_e>:
outputs:
notes: According datasheet HD44780
Version : DMK, Initial code
*******************************************************************/
void lcd_strobe_lcd_e(void) {
PORTA |= (1<<LCD_E); // E high
d6: 8b b3 in r24, 0x1b ; 27
d8: 80 64 ori r24, 0x40 ; 64
da: 8b bb out 0x1b, r24 ; 27
dc: 8f ec ldi r24, 0xCF ; 207
de: 97 e0 ldi r25, 0x07 ; 7
e0: 01 97 sbiw r24, 0x01 ; 1
e2: f1 f7 brne .-4 ; 0xe0 <lcd_strobe_lcd_e+0xa>
e4: 00 c0 rjmp .+0 ; 0xe6 <lcd_strobe_lcd_e+0x10>
e6: 00 00 nop
_delay_ms(1); // nodig
PORTA &= ~(1<<LCD_E); // E low
e8: 8b b3 in r24, 0x1b ; 27
ea: 8f 7b andi r24, 0xBF ; 191
ec: 8b bb out 0x1b, r24 ; 27
ee: 8f ec ldi r24, 0xCF ; 207
f0: 97 e0 ldi r25, 0x07 ; 7
f2: 01 97 sbiw r24, 0x01 ; 1
f4: f1 f7 brne .-4 ; 0xf2 <lcd_strobe_lcd_e+0x1c>
f6: 00 c0 rjmp .+0 ; 0xf8 <lcd_strobe_lcd_e+0x22>
f8: 00 00 nop
fa: 08 95 ret
000000fc <init_4bits_mode>:
inputs:
outputs:
notes: According datasheet HD44780 table 12
Version : DMK, Initial code
*******************************************************************/
void init_4bits_mode(void) {
fc: cf 93 push r28
// PORTC output mode and all low (also E and RS pin)
DDRD = 0xFF;
fe: 8f ef ldi r24, 0xFF ; 255
100: 81 bb out 0x11, r24 ; 17
DDRA = 0xFF;
102: 8a bb out 0x1a, r24 ; 26
PORTC = 0x00;
104: 15 ba out 0x15, r1 ; 21
PORTA = 0x00;
106: 1b ba out 0x1b, r1 ; 27
//PORTA = 0xFF;
// Step 2 (table 12)
PORTC = 0x20; // function set
108: c0 e2 ldi r28, 0x20 ; 32
10a: c5 bb out 0x15, r28 ; 21
lcd_strobe_lcd_e();
10c: e4 df rcall .-56 ; 0xd6 <lcd_strobe_lcd_e>
// Step 3 (table 12)
PORTC = 0x20; // function set
lcd_strobe_lcd_e();
10e: c5 bb out 0x15, r28 ; 21
110: e2 df rcall .-60 ; 0xd6 <lcd_strobe_lcd_e>
PORTC = 0x80;
112: 80 e8 ldi r24, 0x80 ; 128
lcd_strobe_lcd_e();
114: 85 bb out 0x15, r24 ; 21
// Step 4 (table 12)
PORTC = 0x00; // Display on/off control
116: df df rcall .-66 ; 0xd6 <lcd_strobe_lcd_e>
lcd_strobe_lcd_e();
118: 15 ba out 0x15, r1 ; 21
PORTC = 0xF0;
11a: dd df rcall .-70 ; 0xd6 <lcd_strobe_lcd_e>
lcd_strobe_lcd_e();
11c: 80 ef ldi r24, 0xF0 ; 240
// Step 4 (table 12)
PORTC = 0x00; // Entry mode set
11e: 85 bb out 0x15, r24 ; 21
lcd_strobe_lcd_e();
120: da df rcall .-76 ; 0xd6 <lcd_strobe_lcd_e>
122: 15 ba out 0x15, r1 ; 21
PORTC = 0x60;
124: d8 df rcall .-80 ; 0xd6 <lcd_strobe_lcd_e>
126: 80 e6 ldi r24, 0x60 ; 96
lcd_strobe_lcd_e();
128: 85 bb out 0x15, r24 ; 21
12a: d5 df rcall .-86 ; 0xd6 <lcd_strobe_lcd_e>
}
12c: cf 91 pop r28
12e: 08 95 ret
00000130 <lcd_write_data>:
inputs: byte - written to LCD
outputs:
notes: According datasheet HD44780 table 12
Version : DMK, Initial code
*******************************************************************/
void lcd_write_data(unsigned char byte) {
130: cf 93 push r28
132: c8 2f mov r28, r24
// First nibble.
PORTC = byte;
134: 85 bb out 0x15, r24 ; 21
PORTA |= (1<<LCD_RS);
136: 8b b3 in r24, 0x1b ; 27
138: 80 61 ori r24, 0x10 ; 16
13a: 8b bb out 0x1b, r24 ; 27
lcd_strobe_lcd_e();
13c: cc df rcall .-104 ; 0xd6 <lcd_strobe_lcd_e>
// Second nibble
PORTC = (byte<<4);
13e: c2 95 swap r28
140: c0 7f andi r28, 0xF0 ; 240
142: c5 bb out 0x15, r28 ; 21
PORTA |= (1<<LCD_RS);
144: 8b b3 in r24, 0x1b ; 27
146: 80 61 ori r24, 0x10 ; 16
lcd_strobe_lcd_e();
148: 8b bb out 0x1b, r24 ; 27
14a: c5 df rcall .-118 ; 0xd6 <lcd_strobe_lcd_e>
}
14c: cf 91 pop r28
14e: 08 95 ret
00000150 <lcd_write_string>:
inputs:
outputs:
notes: According datasheet HD44780 table 12
Version : DMK, Initial code
*******************************************************************/
void lcd_write_string(char *str) {
150: cf 93 push r28
152: df 93 push r29
154: ec 01 movw r28, r24
// while(*str) {
// lcd_write_data(*str++);
// }
// of met een for:
for(;*str; str++){
156: 02 c0 rjmp .+4 ; 0x15c <lcd_write_string+0xc>
lcd_write_data(*str);
158: eb df rcall .-42 ; 0x130 <lcd_write_data>
// while(*str) {
// lcd_write_data(*str++);
// }
// of met een for:
for(;*str; str++){
15a: 21 96 adiw r28, 0x01 ; 1
15c: 88 81 ld r24, Y
15e: 81 11 cpse r24, r1
160: fb cf rjmp .-10 ; 0x158 <lcd_write_string+0x8>
lcd_write_data(*str);
}
}
162: df 91 pop r29
164: cf 91 pop r28
166: 08 95 ret
00000168 <lcd_write_command>:
inputs: byte - written to LCD
outputs:
notes: According datasheet HD44780 table 12
Version : DMK, Initial code
*******************************************************************/
void lcd_write_command(unsigned char byte) {
168: cf 93 push r28
16a: c8 2f mov r28, r24
// First nibble.
PORTC = byte;
16c: 85 bb out 0x15, r24 ; 21
PORTA &= ~(1<<LCD_RS);
16e: 8b b3 in r24, 0x1b ; 27
170: 8f 7e andi r24, 0xEF ; 239
172: 8b bb out 0x1b, r24 ; 27
lcd_strobe_lcd_e();
174: b0 df rcall .-160 ; 0xd6 <lcd_strobe_lcd_e>
// Second nibble
PORTC = (byte<<4);
176: c2 95 swap r28
178: c0 7f andi r28, 0xF0 ; 240
17a: c5 bb out 0x15, r28 ; 21
PORTA &= ~(1<<LCD_RS);
17c: 8b b3 in r24, 0x1b ; 27
17e: 8f 7e andi r24, 0xEF ; 239
lcd_strobe_lcd_e();
180: 8b bb out 0x1b, r24 ; 27
182: a9 df rcall .-174 ; 0xd6 <lcd_strobe_lcd_e>
}
184: cf 91 pop r28
186: 08 95 ret
00000188 <lcd_clear>:
void lcd_clear() {
lcd_write_command (0x01); //Leeg display
188: 81 e0 ldi r24, 0x01 ; 1
18a: ee df rcall .-36 ; 0x168 <lcd_write_command>
18c: 8f e9 ldi r24, 0x9F ; 159
18e: 9f e0 ldi r25, 0x0F ; 15
190: 01 97 sbiw r24, 0x01 ; 1
192: f1 f7 brne .-4 ; 0x190 <lcd_clear+0x8>
194: 00 c0 rjmp .+0 ; 0x196 <lcd_clear+0xe>
196: 00 00 nop
_delay_ms(2);
lcd_write_command (0x80); //Cursor terug naar start
198: 80 e8 ldi r24, 0x80 ; 128
19a: e6 cf rjmp .-52 ; 0x168 <lcd_write_command>
19c: 08 95 ret
0000019e <main>:
notes: Slow background task after init ISR
Version : DMK, Initial code
*******************************************************************/
int main( void ) {
// Init I/O
DDRC = 0xFF; // PORTD(7) output, PORTD(6:0) input
19e: 8f ef ldi r24, 0xFF ; 255
1a0: 84 bb out 0x14, r24 ; 20
PORTC = 0xFF;
1a2: 85 bb out 0x15, r24 ; 21
// Init LCD
init_4bits_mode();
1a4: ab df rcall .-170 ; 0xfc <init_4bits_mode>
1a6: 8f e1 ldi r24, 0x1F ; 31
1a8: 9e e4 ldi r25, 0x4E ; 78
1aa: 01 97 sbiw r24, 0x01 ; 1
1ac: f1 f7 brne .-4 ; 0x1aa <main+0xc>
1ae: 00 c0 rjmp .+0 ; 0x1b0 <main+0x12>
_delay_ms(10);
lcd_clear();
1b0: 00 00 nop
1b2: ea df rcall .-44 ; 0x188 <lcd_clear>
// Write sample string
lcd_write_string("Hello world!");
1b4: 80 e0 ldi r24, 0x00 ; 0
1b6: 91 e0 ldi r25, 0x01 ; 1
1b8: cb df rcall .-106 ; 0x150 <lcd_write_string>
// Loop forever
while (1) {
PORTC ^= (1<<0); // Toggle PORTD.7
1ba: 95 b3 in r25, 0x15 ; 21
1bc: 81 e0 ldi r24, 0x01 ; 1
1be: 89 27 eor r24, r25
wait( 250 );
1c0: 85 bb out 0x15, r24 ; 21
1c2: 8a ef ldi r24, 0xFA ; 250
1c4: 90 e0 ldi r25, 0x00 ; 0
1c6: 78 df rcall .-272 ; 0xb8 <wait>
1c8: f8 cf rjmp .-16 ; 0x1ba <main+0x1c>
000001ca <_exit>:
1ca: f8 94 cli
000001cc <__stop_program>:
1cc: ff cf rjmp .-2 ; 0x1cc <__stop_program>