⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 led.lss

📁 AVR code for led matrix
💻 LSS
📖 第 1 页 / 共 2 页
字号:
	} else 
	if (port == PD) { 
 178:	e4 30       	cpi	r30, 0x04	; 4
 17a:	19 f4       	brne	.+6      	; 0x182 <paint+0xb4>
 17c:	e2 e3       	ldi	r30, 0x32	; 50
 17e:	f0 e0       	ldi	r31, 0x00	; 0
 180:	02 c0       	rjmp	.+4      	; 0x186 <paint+0xb8>
 182:	e0 e0       	ldi	r30, 0x00	; 0
 184:	f0 e0       	ldi	r31, 0x00	; 0
	     out = &PORTD; 
	}

	if (val == LOW) *out &= ~bit;
	else *out |= bit;
 186:	80 81       	ld	r24, Z
 188:	8a 2b       	or	r24, r26
 18a:	80 83       	st	Z, r24
 18c:	0f 5f       	subi	r16, 0xFF	; 255
 18e:	1f 4f       	sbci	r17, 0xFF	; 255
 190:	08 94       	sec
 192:	e1 1c       	adc	r14, r1
 194:	f1 1c       	adc	r15, r1
// Use times for choose the speeds
void paint(uint8_t matrix[], uint8_t times){
	uint8_t col,row, i;

		for (i=0;i<times;i++){
			for (row=0;row<7;row++){
 196:	07 30       	cpi	r16, 0x07	; 7
 198:	11 05       	cpc	r17, r1
 19a:	09 f0       	breq	.+2      	; 0x19e <paint+0xd0>
 19c:	ac cf       	rjmp	.-168    	; 0xf6 <paint+0x28>
// Refresh paint all the dotmatrix by scanning all rows and cols
// Use times for choose the speeds
void paint(uint8_t matrix[], uint8_t times){
	uint8_t col,row, i;

		for (i=0;i<times;i++){
 19e:	c3 94       	inc	r12
 1a0:	c7 14       	cp	r12, r7
 1a2:	38 f4       	brcc	.+14     	; 0x1b2 <paint+0xe4>
 1a4:	85 e6       	ldi	r24, 0x65	; 101
 1a6:	e8 2e       	mov	r14, r24
 1a8:	80 e0       	ldi	r24, 0x00	; 0
 1aa:	f8 2e       	mov	r15, r24
 1ac:	00 e0       	ldi	r16, 0x00	; 0
 1ae:	10 e0       	ldi	r17, 0x00	; 0
 1b0:	a2 cf       	rjmp	.-188    	; 0xf6 <paint+0x28>
					setPixel(cols[col],matrix[col]&1<<row);
				}
				digitalWrite(rows[row],HIGH);
			}
		}
}
 1b2:	df 91       	pop	r29
 1b4:	cf 91       	pop	r28
 1b6:	1f 91       	pop	r17
 1b8:	0f 91       	pop	r16
 1ba:	ff 90       	pop	r15
 1bc:	ef 90       	pop	r14
 1be:	df 90       	pop	r13
 1c0:	cf 90       	pop	r12
 1c2:	bf 90       	pop	r11
 1c4:	af 90       	pop	r10
 1c6:	9f 90       	pop	r9
 1c8:	8f 90       	pop	r8
 1ca:	7f 90       	pop	r7
 1cc:	08 95       	ret

000001ce <main>:



// Here is the main 
int main (void)
{
 1ce:	2f 92       	push	r2
 1d0:	3f 92       	push	r3
 1d2:	4f 92       	push	r4
 1d4:	5f 92       	push	r5
 1d6:	6f 92       	push	r6
 1d8:	7f 92       	push	r7
 1da:	8f 92       	push	r8
 1dc:	9f 92       	push	r9
 1de:	af 92       	push	r10
 1e0:	bf 92       	push	r11
 1e2:	cf 92       	push	r12
 1e4:	df 92       	push	r13
 1e6:	ef 92       	push	r14
 1e8:	ff 92       	push	r15
 1ea:	0f 93       	push	r16
 1ec:	1f 93       	push	r17
 1ee:	df 93       	push	r29
 1f0:	cf 93       	push	r28
 1f2:	cd b7       	in	r28, 0x3d	; 61
 1f4:	de b7       	in	r29, 0x3e	; 62
 1f6:	27 97       	sbiw	r28, 0x07	; 7
 1f8:	0f b6       	in	r0, 0x3f	; 63
 1fa:	f8 94       	cli
 1fc:	de bf       	out	0x3e, r29	; 62
 1fe:	0f be       	out	0x3f, r0	; 63
 200:	cd bf       	out	0x3d, r28	; 61
	// setup all pins to outputs
	DDRB  = 0xff;
 202:	8f ef       	ldi	r24, 0xFF	; 255
 204:	87 bb       	out	0x17, r24	; 23
	DDRD  = 0xff;
 206:	81 bb       	out	0x11, r24	; 17
 208:	ff 24       	eor	r15, r15
				// scroll every frame to left
				for (offset=0;offset<8;offset++){
					// Fill screen buffer
					for (i=0;i<5;i++){
						if (frame==0)     screen[i] = (pgm_read_byte(&animation[frame][i])>>(8-offset));
						if (frame>0)      screen[i] = (pgm_read_byte(&animation[frame-1][i])<<(offset));
 20a:	58 e0       	ldi	r21, 0x08	; 8
 20c:	25 2e       	mov	r2, r21
 20e:	31 2c       	mov	r3, r1
		    uint8_t screen[5]; 		// buffer for paint
			
			// for each frame...
			for (frame=0;frame<=FRAMES;frame++){
				// scroll every frame to left
				for (offset=0;offset<8;offset++){
 210:	3e 01       	movw	r6, r28
 212:	08 94       	sec
 214:	61 1c       	adc	r6, r1
 216:	71 1c       	adc	r7, r1
					// Fill screen buffer
					for (i=0;i<5;i++){
 218:	46 e0       	ldi	r20, 0x06	; 6
 21a:	44 2e       	mov	r4, r20
 21c:	51 2c       	mov	r5, r1
 21e:	4c 0e       	add	r4, r28
 220:	5d 1e       	adc	r5, r29
 222:	4c c0       	rjmp	.+152    	; 0x2bc <main+0xee>
						if (frame==0)     screen[i] = (pgm_read_byte(&animation[frame][i])>>(8-offset));
 224:	ff 20       	and	r15, r15
 226:	51 f4       	brne	.+20     	; 0x23c <main+0x6e>
 228:	fb 01       	movw	r30, r22
 22a:	84 91       	lpm	r24, Z+
 22c:	90 e0       	ldi	r25, 0x00	; 0
 22e:	00 2e       	mov	r0, r16
 230:	02 c0       	rjmp	.+4      	; 0x236 <main+0x68>
 232:	95 95       	asr	r25
 234:	87 95       	ror	r24
 236:	0a 94       	dec	r0
 238:	e2 f7       	brpl	.-8      	; 0x232 <main+0x64>
 23a:	09 c0       	rjmp	.+18     	; 0x24e <main+0x80>
						if (frame>0)      screen[i] = (pgm_read_byte(&animation[frame-1][i])<<(offset));
 23c:	fa 01       	movw	r30, r20
 23e:	84 91       	lpm	r24, Z+
 240:	90 e0       	ldi	r25, 0x00	; 0
 242:	0c 2c       	mov	r0, r12
 244:	02 c0       	rjmp	.+4      	; 0x24a <main+0x7c>
 246:	88 0f       	add	r24, r24
 248:	99 1f       	adc	r25, r25
 24a:	0a 94       	dec	r0
 24c:	e2 f7       	brpl	.-8      	; 0x246 <main+0x78>
 24e:	ee 81       	ldd	r30, Y+6	; 0x06
 250:	ff 81       	ldd	r31, Y+7	; 0x07
 252:	80 83       	st	Z, r24
						if (frame<FRAMES&&frame>0) screen[i] = screen[i]|(pgm_read_byte(&animation[frame][i])>>(8-offset));
 254:	f1 e0       	ldi	r31, 0x01	; 1
 256:	fe 15       	cp	r31, r14
 258:	70 f0       	brcs	.+28     	; 0x276 <main+0xa8>
 25a:	fd 01       	movw	r30, r26
 25c:	84 91       	lpm	r24, Z+
 25e:	90 e0       	ldi	r25, 0x00	; 0
 260:	00 2e       	mov	r0, r16
 262:	02 c0       	rjmp	.+4      	; 0x268 <main+0x9a>
 264:	95 95       	asr	r25
 266:	87 95       	ror	r24
 268:	0a 94       	dec	r0
 26a:	e2 f7       	brpl	.-8      	; 0x264 <main+0x96>
 26c:	ee 81       	ldd	r30, Y+6	; 0x06
 26e:	ff 81       	ldd	r31, Y+7	; 0x07
 270:	20 81       	ld	r18, Z
 272:	28 2b       	or	r18, r24
 274:	20 83       	st	Z, r18
 276:	8e 81       	ldd	r24, Y+6	; 0x06
 278:	9f 81       	ldd	r25, Y+7	; 0x07
 27a:	01 96       	adiw	r24, 0x01	; 1
 27c:	9f 83       	std	Y+7, r25	; 0x07
 27e:	8e 83       	std	Y+6, r24	; 0x06
 280:	11 96       	adiw	r26, 0x01	; 1
 282:	6f 5f       	subi	r22, 0xFF	; 255
 284:	7f 4f       	sbci	r23, 0xFF	; 255
 286:	4f 5f       	subi	r20, 0xFF	; 255
 288:	5f 4f       	sbci	r21, 0xFF	; 255
			// for each frame...
			for (frame=0;frame<=FRAMES;frame++){
				// scroll every frame to left
				for (offset=0;offset<8;offset++){
					// Fill screen buffer
					for (i=0;i<5;i++){
 28a:	84 15       	cp	r24, r4
 28c:	95 05       	cpc	r25, r5
 28e:	51 f6       	brne	.-108    	; 0x224 <main+0x56>
						if (frame==0)     screen[i] = (pgm_read_byte(&animation[frame][i])>>(8-offset));
						if (frame>0)      screen[i] = (pgm_read_byte(&animation[frame-1][i])<<(offset));
						if (frame<FRAMES&&frame>0) screen[i] = screen[i]|(pgm_read_byte(&animation[frame][i])>>(8-offset));
					}
					// Now paint the screen the SPEED times
					paint(screen, SPEED);
 290:	68 e0       	ldi	r22, 0x08	; 8
 292:	c3 01       	movw	r24, r6
 294:	1c df       	rcall	.-456    	; 0xce <paint>
 296:	01 50       	subi	r16, 0x01	; 1
 298:	10 40       	sbci	r17, 0x00	; 0
		    uint8_t screen[5]; 		// buffer for paint
			
			// for each frame...
			for (frame=0;frame<=FRAMES;frame++){
				// scroll every frame to left
				for (offset=0;offset<8;offset++){
 29a:	00 23       	and	r16, r16
 29c:	51 f0       	breq	.+20     	; 0x2b2 <main+0xe4>
 29e:	7f 82       	std	Y+7, r7	; 0x07
 2a0:	6e 82       	std	Y+6, r6	; 0x06
 2a2:	d4 01       	movw	r26, r8
 2a4:	66 e2       	ldi	r22, 0x26	; 38
 2a6:	70 e0       	ldi	r23, 0x00	; 0
 2a8:	a5 01       	movw	r20, r10
					// Fill screen buffer
					for (i=0;i<5;i++){
						if (frame==0)     screen[i] = (pgm_read_byte(&animation[frame][i])>>(8-offset));
						if (frame>0)      screen[i] = (pgm_read_byte(&animation[frame-1][i])<<(offset));
 2aa:	61 01       	movw	r12, r2
 2ac:	c0 1a       	sub	r12, r16
 2ae:	d1 0a       	sbc	r13, r17
 2b0:	b9 cf       	rjmp	.-142    	; 0x224 <main+0x56>
		{
			uint8_t i,offset,frame;	// some variables
		    uint8_t screen[5]; 		// buffer for paint
			
			// for each frame...
			for (frame=0;frame<=FRAMES;frame++){
 2b2:	f3 94       	inc	r15
 2b4:	93 e0       	ldi	r25, 0x03	; 3
 2b6:	9f 15       	cp	r25, r15
 2b8:	08 f4       	brcc	.+2      	; 0x2bc <main+0xee>
 2ba:	ff 24       	eor	r15, r15
				// scroll every frame to left
				for (offset=0;offset<8;offset++){
					// Fill screen buffer
					for (i=0;i<5;i++){
						if (frame==0)     screen[i] = (pgm_read_byte(&animation[frame][i])>>(8-offset));
						if (frame>0)      screen[i] = (pgm_read_byte(&animation[frame-1][i])<<(offset));
 2bc:	e5 e0       	ldi	r30, 0x05	; 5
 2be:	fe 9e       	mul	r15, r30
 2c0:	c0 01       	movw	r24, r0
 2c2:	11 24       	eor	r1, r1
 2c4:	08 e0       	ldi	r16, 0x08	; 8
 2c6:	10 e0       	ldi	r17, 0x00	; 0
		    uint8_t screen[5]; 		// buffer for paint
			
			// for each frame...
			for (frame=0;frame<=FRAMES;frame++){
				// scroll every frame to left
				for (offset=0;offset<8;offset++){
 2c8:	36 e2       	ldi	r19, 0x26	; 38
 2ca:	83 2e       	mov	r8, r19
 2cc:	30 e0       	ldi	r19, 0x00	; 0
 2ce:	93 2e       	mov	r9, r19
 2d0:	88 0e       	add	r8, r24
 2d2:	99 1e       	adc	r9, r25
 2d4:	21 e2       	ldi	r18, 0x21	; 33
 2d6:	a2 2e       	mov	r10, r18
 2d8:	20 e0       	ldi	r18, 0x00	; 0
 2da:	b2 2e       	mov	r11, r18
 2dc:	a8 0e       	add	r10, r24
 2de:	b9 1e       	adc	r11, r25
					// Fill screen buffer
					for (i=0;i<5;i++){
						if (frame==0)     screen[i] = (pgm_read_byte(&animation[frame][i])>>(8-offset));
						if (frame>0)      screen[i] = (pgm_read_byte(&animation[frame-1][i])<<(offset));
						if (frame<FRAMES&&frame>0) screen[i] = screen[i]|(pgm_read_byte(&animation[frame][i])>>(8-offset));
 2e0:	ef 2c       	mov	r14, r15
 2e2:	ea 94       	dec	r14
 2e4:	dc cf       	rjmp	.-72     	; 0x29e <main+0xd0>

000002e6 <digitalWrite>:
		}
}

// digitalWrite from Arduino modified for use absolute pins
void digitalWrite(uint8_t pin, uint8_t val)
{
 2e6:	e8 2f       	mov	r30, r24
 2e8:	f0 e0       	ldi	r31, 0x00	; 0
 2ea:	df 01       	movw	r26, r30
 2ec:	a5 58       	subi	r26, 0x85	; 133
 2ee:	bf 4f       	sbci	r27, 0xFF	; 255
 2f0:	ac 91       	ld	r26, X
	uint8_t bit = digitalPinToBitMask[pin];
	uint8_t port = digitalPinToPort[pin];
 2f2:	e4 59       	subi	r30, 0x94	; 148
 2f4:	ff 4f       	sbci	r31, 0xFF	; 255
 2f6:	e0 81       	ld	r30, Z
	volatile uint8_t *out;

    if (port == PB) {
 2f8:	e2 30       	cpi	r30, 0x02	; 2
 2fa:	19 f4       	brne	.+6      	; 0x302 <digitalWrite+0x1c>
 2fc:	e8 e3       	ldi	r30, 0x38	; 56
 2fe:	f0 e0       	ldi	r31, 0x00	; 0
 300:	04 c0       	rjmp	.+8      	; 0x30a <digitalWrite+0x24>
		 out = &PORTB; 
	} else 
	if (port == PD) { 
 302:	e4 30       	cpi	r30, 0x04	; 4
 304:	11 f4       	brne	.+4      	; 0x30a <digitalWrite+0x24>
 306:	e2 e3       	ldi	r30, 0x32	; 50
 308:	f0 e0       	ldi	r31, 0x00	; 0
	     out = &PORTD; 
	}

	if (val == LOW) *out &= ~bit;
 30a:	66 23       	and	r22, r22
 30c:	21 f4       	brne	.+8      	; 0x316 <digitalWrite+0x30>
 30e:	80 81       	ld	r24, Z
 310:	a0 95       	com	r26
 312:	8a 23       	and	r24, r26
 314:	02 c0       	rjmp	.+4      	; 0x31a <digitalWrite+0x34>
	else *out |= bit;
 316:	80 81       	ld	r24, Z
 318:	8a 2b       	or	r24, r26
 31a:	80 83       	st	Z, r24
 31c:	08 95       	ret

0000031e <_exit>:
 31e:	f8 94       	cli

00000320 <__stop_program>:
 320:	ff cf       	rjmp	.-2      	; 0x320 <__stop_program>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -