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

📄 main.lst

📁 旋转16个LED灯控制程序
💻 LST
📖 第 1 页 / 共 5 页
字号:
 414 00bc 0F90      		pop __tmp_reg__ 415 00be 1F90      		pop __zero_reg__ 416 00c0 1895      		reti 417               	/* epilogue end (size=7) */ 418               	/* function __vector_6 size 41 (27) */ 420               	.Lscope2: 423               	.global	__vector_4 425               	__vector_4: 316:main.c        ****     } 317:main.c        ****    318:main.c        ****   #endif 319:main.c        ****  320:main.c        **** } 321:main.c        ****  322:main.c        **** // As we sweep around the circle, we display 256 radial pixel 323:main.c        **** // lines, once per TIMER1 interrupt.  This is broken down into 324:main.c        **** // 16 16-pixel wide characters, and we have two characters 325:main.c        **** // stacked vertically.  To save time, we keep track of the 326:main.c        **** // character number, pixel number (in the character), and 327:main.c        **** // pointers into the eeprom for each of the two chars being 328:main.c        **** // displayed. 329:main.c        ****  330:main.c        **** // This code has to be fast enough to complete execution before 331:main.c        **** // it gets interrupted again - and it must not make any subroutine 332:main.c        **** // calls, since that'll mess up the stack and cause the entire 333:main.c        **** // system to reset. 334:main.c        ****  335:main.c        **** volatile uint8_t pixelNum = 0xFF;		// pixel number 336:main.c        ****  337:main.c        **** // This routine gets called every time the pixel timer runs down; 338:main.c        **** // in other words, once per "scan line", 256 times per revolution 339:main.c        **** // of the SpokePOV.  Its purpose is to update the LEDs. 340:main.c        ****  341:main.c        **** SIGNAL (SIG_TIMER1_COMPA) { 427               	.LM30: 428               	/* prologue: frame size=0 */ 429 00c2 1F92      		push __zero_reg__ 430 00c4 0F92      		push __tmp_reg__ 431 00c6 0FB6      		in __tmp_reg__,__SREG__ 432 00c8 0F92      		push __tmp_reg__ 433 00ca 1124      		clr __zero_reg__ 434 00cc 2F93      		push r18 435 00ce 3F93      		push r19 436 00d0 4F93      		push r20 437 00d2 5F93      		push r21 438 00d4 6F93      		push r22 439 00d6 7F93      		push r23 440 00d8 8F93      		push r24 441 00da 9F93      		push r25 442 00dc AF93      		push r26 443 00de BF93      		push r27 444 00e0 EF93      		push r30 445 00e2 FF93      		push r31 446               	/* prologue end (size=17) */ 342:main.c        ****  343:main.c        ****   // If it has been less than STANDBY_TIMEOUT seconds since the last time we 344:main.c        ****   // got a Hall Effect sensor update, then proceed as normal and 345:main.c        ****   // update the LEDs. 346:main.c        ****    347:main.c        ****   // QUESTION: what is F_CPU?  ANSWER: FREQUENCY OF CPU (clocks/second) 348:main.c        ****    349:main.c        ****   if (sensor_timer.bytes.high_byte < ( (F_CPU/NUM_PIXELS)/256 * STANDBY_TIMEOUT) / 256) {     448               	.LM31: 449 00e4 8091 0000 		lds r24,sensor_timer+1 450 00e8 8230      		cpi r24,lo8(2) 451 00ea 08F0      		brlo .+2 452 00ec 2CC1      		rjmp .L11 350:main.c        ****      351:main.c        ****     // *** PORTA |= 0x1; 352:main.c        ****      353:main.c        ****     // The first thing we do is increment our pixel position; for 354:main.c        ****     // most of the effects, it isn't used, but it comes in handy 355:main.c        ****     // for some 356:main.c        ****      357:main.c        ****     pixelNum++; 454               	.LM32: 455 00ee 8091 0000 		lds r24,pixelNum 456 00f2 8F5F      		subi r24,lo8(-(1)) 457 00f4 8093 0000 		sts pixelNum,r24 358:main.c        ****      359:main.c        ****     // Unlike the char firmware, we don't check for a wraparound and shut 360:main.c        ****     // down the display, because often we're showing full on white patterns 361:main.c        ****      362:main.c        ****     // Update display based on the current code 363:main.c        ****      364:main.c        ****     if (cur_code < 0x80) { 459               	.LM33: 460 00f8 8091 0000 		lds r24,cur_code 461 00fc 87FD      		sbrc r24,7 462 00fe 04C0      		rjmp .L13 365:main.c        ****      366:main.c        ****       clock_scroll(line_shift); 464               	.LM34: 465 0100 8091 0000 		lds r24,line_shift 466 0104 7DDF      		rcall clock_scroll 467 0106 1FC1      		rjmp .L11 468               	.L13: 367:main.c        ****      368:main.c        ****     } else if (cur_code >= 0xF0) { 470               	.LM35: 471 0108 8091 0000 		lds r24,cur_code 472 010c 803F      		cpi r24,lo8(-16) 473 010e 08F1      		brlo .L15 369:main.c        ****      370:main.c        ****       // clock out image to the LEDs 371:main.c        ****        372:main.c        ****       spieeprom_read(eeprom_addr,cPattern,4); 475               	.LM36: 476 0110 44E0      		ldi r20,lo8(4) 477 0112 60E0      		ldi r22,lo8(cPattern) 478 0114 70E0      		ldi r23,hi8(cPattern) 479 0116 8091 0000 		lds r24,eeprom_addr 480 011a 9091 0000 		lds r25,(eeprom_addr)+1 481 011e 00D0      		rcall spieeprom_read 373:main.c        ****       clock_scroll(0); 483               	.LM37: 484 0120 80E0      		ldi r24,lo8(0) 485 0122 6EDF      		rcall clock_scroll 374:main.c        ****        375:main.c        ****       // either move to next line of pixels 376:main.c        ****        377:main.c        ****       if (pixelNum != 0xFF) { 487               	.LM38: 488 0124 8091 0000 		lds r24,pixelNum 489 0128 8F3F      		cpi r24,lo8(-1) 490 012a 51F0      		breq .L16 378:main.c        ****        379:main.c        ****         #ifdef CLOCKWISE 380:main.c        ****          381:main.c        ****           eeprom_addr.word = eeprom_addr.word + 4; 382:main.c        ****        383:main.c        ****         #else 384:main.c        ****          385:main.c        ****           eeprom_addr.word = eeprom_addr.word - 4; 492               	.LM39: 493 012c 8091 0000 		lds r24,eeprom_addr 494 0130 9091 0000 		lds r25,(eeprom_addr)+1 495 0134 0497      		sbiw r24,4 496 0136 9093 0000 		sts (eeprom_addr)+1,r25 497 013a 8093 0000 		sts eeprom_addr,r24 498 013e 03C1      		rjmp .L11 499               	.L16: 386:main.c        ****        387:main.c        ****         #endif 388:main.c        ****          389:main.c        ****       } else { 390:main.c        ****        391:main.c        ****         // or, if we've somehow wrapped around, reset to start of buffer 392:main.c        ****          393:main.c        ****         #ifdef CLOCKWISE 394:main.c        ****          395:main.c        ****       	  eeprom_addr.bytes.high_byte &= 0xFC; 396:main.c        ****       	  eeprom_addr.bytes.low_byte = 0x00; 397:main.c        ****       	 398:main.c        ****       	#else 399:main.c        ****       	 400:main.c        ****        	  eeprom_addr.bytes.high_byte |= 0x03; 501               	.LM40: 502 0140 8091 0000 		lds r24,eeprom_addr+1 503 0144 8360      		ori r24,lo8(3) 504 0146 8093 0000 		sts eeprom_addr+1,r24 401:main.c        ****       	  eeprom_addr.bytes.low_byte = 0xFC; 506               	.LM41: 507 014a 8CEF      		ldi r24,lo8(-4) 508 014c 8093 0000 		sts eeprom_addr,r24 509 0150 FAC0      		rjmp .L11 510               	.L15: 402:main.c        ****  403:main.c        ****      	#endif 404:main.c        ****       	 405:main.c        ****       } 406:main.c        ****        407:main.c        ****     } else if (cur_code >= 0xE0) { 512               	.LM42: 513 0152 8091 0000 		lds r24,cur_code 514 0156 803E      		cpi r24,lo8(-32) 515 0158 08F4      		brsh .+2 516 015a F5C0      		rjmp .L11 408:main.c        ****      409:main.c        ****       // Pac man animations 410:main.c        ****        411:main.c        ****       cPattern[0] = 0x00;			// assume we display a full line of graphics 518               	.LM43: 519 015c 1092 0000 		sts cPattern,__zero_reg__ 412:main.c        ****        413:main.c        ****       if (cur_code == 0xE0) { 521               	.LM44: 522 0160 8091 0000 		lds r24,cur_code 523 0164 803E      		cpi r24,lo8(-32) 524 0166 59F5      		brne .L20 414:main.c        ****        415:main.c        ****       	// Forward-moving pacman - what state are we in 416:main.c        ****       	 417:main.c        ****       	if ( (line_shift & 0x01) == 0 ) { 526               	.LM45: 527 0168 8091 0000 		lds r24,line_shift 528 016c 9927      		clr r25 529 016e 61E0      		ldi r22,lo8(1) 530 0170 70E0      		ldi r23,hi8(1) 531 0172 8627      		eor r24,r22 532 0174 9727      		eor r25,r23 533 0176 482F      		mov r20,r24 534 0178 592F      		mov r21,r25 535 017a 4623      		and r20,r22 536 017c 5723      		and r21,r23 537 017e 80FF      		sbrs r24,0 538 0180 10C0      		rjmp .L21 418:main.c        ****       	 419:main.c        ****       	  if ( (pixelNum > (0x80-PAC_OPEN)) & (pixelNum < (0x80+PAC_OPEN)) ) { 540               	.LM46: 541 0182 20E0      		ldi r18,lo8(0) 542 0184 30E0      		ldi r19,hi8(0) 543 0186 8091 0000 		lds r24,pixelNum 544 018a 8135      		cpi r24,lo8(81) 545 018c 10F0      		brlo .L23 546 018e 262F      		mov r18,r22 547 0190 372F      		mov r19,r23 548               	.L23: 549 0192 40E0      		ldi r20,lo8(0) 550 0194 50E0      		ldi r21,hi8(0) 551 0196 8091 0000 		lds r24,pixelNum 552 019a 803B      		cpi r24,lo8(-80) 553 019c 08F0      		brlo .+2 554 019e 6AC0      		rjmp .L48 555 01a0 67C0      		rjmp .L76 556               	.L21: 420:main.c        ****       	   421:main.c        ****       	    cPattern[0] = 0xFF; 422:main.c        ****       	     423:main.c        ****       	  } 424:main.c        ****       	   425:main.c        ****       	} else { 426:main.c        ****       	 427:main.c        ****       	  if ( (pixelNum > (0x80-PAC_CLOSED)) & (pixelNum < (0x80+PAC_CLOSED)) ) { 558               	.LM47: 559 01a2 242F      		mov r18,r20 560 01a4 352F      		mov r19,r21 561 01a6 8091 0000 		lds r24,pixelNum 562 01aa 8137      		cpi r24,lo8(113) 563 01ac 10F0      		brlo .L27 564 01ae 262F      		mov r18,r22 565 01b0 372F      		mov r19,r23 566               	.L27: 567 01b2 8091 0000 		lds r24,pixelNum 568 01b6 8039      		cpi r24,lo8(-112) 569 01b8 08F0      		brlo .+2 570 01ba 5CC0      		rjmp .L48 571 01bc 59C0      		rjmp .L76 572               	.L20: 428:main.c        ****       	   429:main.c        ****       	    cPattern[0] = 0xFF; 430:main.c        ****       	     431:main.c        ****       	  } 432:main.c        ****  433:main.c        ****       	} 434:main.c        ****       	 435:main.c        ****       } else if (cur_code == 0xE1) { 574               	.LM48: 575 01be 8091 0000 		lds r24,cur_code 576 01c2 813E      		cpi r24,lo8(-31) 577 01c4 49F5      		brne .L30 436:main.c        ****        437:main.c        ****        	// Left pacman, as seen from front 438:main.c        ****       	 439:main.c        ****       	if ( (line_shift & 0x01) == 0 ) { 579               	.LM49: 580 01c6 8091 0000 		lds r24,line_shift 581 01ca 9927      		clr r25 582 01cc 61E0      		ldi r22,lo8(1) 583 01ce 70E0      		ldi r23,hi8(1) 584 01d0 8627      		eor r24,r22 585 01d2 9727      		eor r25,r23 586 01d4 482F      		mov r20,r24 587 01d6 592F      		mov r21,r25 588 01d8 4623      		and r20,r22 589 01da 5723      		and r21,r23 590 01dc 80FF      		sbrs r24,0 591 01de 0FC0      		rjmp .L31 440:main.c        ****       	 441:main.c        ****       	  if ( (pixelNum > (0x40-PAC_OPEN)) & (pixelNum < (0x40+PAC_OPEN)) ) { 593               	.LM50: 594 01e0 20E0      		ldi r18,lo8(0) 595 01e2 30E0      		ldi r19,hi8(0) 596 01e4 8091 0000 		lds r24,pixelNum 597 01e8 8131      		cpi r24,lo8(17) 598 01ea 10F0      		brlo .L33 599 01ec 262F      		mov r18,r22 600 01ee 372F      		mov r19,r23 601               	.L33: 602 01f0 40E0      		ldi r20,lo8(0) 603 01f2 50E0      		ldi r21,hi8(0) 604 01f4 8091 0000 		lds r24,pixelNum 605 01f8 8037      		cpi r24,lo8(112) 606 01fa E0F5      		brsh .L48 607 01fc 39C0      		rjmp .L76 608               	.L31:

⌨️ 快捷键说明

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