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

📄 12864a_c.lss.svn-base

📁 Program using ATMEGA2561 to initialize CFAG12864A series of LCD modules with RGB backlight
💻 SVN-BASE
📖 第 1 页 / 共 3 页
字号:
 700:	83 e8       	ldi	r24, 0x83	; 131
 702:	80 83       	st	Z, r24
  TCCR2B = (1 << CS22) | (1 << CS21) | (1 << CS20);
 704:	87 e0       	ldi	r24, 0x07	; 7
 706:	8c 93       	st	X, r24


  }
 708:	08 95       	ret

0000070a <Initialize_And_Start_Timer_3_32_Hz_and_Backlight>:
//============================================================================
void Initialize_And_Start_Timer_3_32_Hz_and_Backlight(void)
  {
 70a:	e0 e9       	ldi	r30, 0x90	; 144
 70c:	f0 e0       	ldi	r31, 0x00	; 0
 70e:	10 82       	st	Z, r1
  //Stop the timer for now.
  TCCR3A=0x00;
  TCCR3B=0x00;
 710:	a1 e9       	ldi	r26, 0x91	; 145
 712:	b0 e0       	ldi	r27, 0x00	; 0
 714:	1c 92       	st	X, r1

  //Make sure the interrupt is disabled.
  TIMSK3=0;
 716:	10 92 71 00 	sts	0x0071, r1

  //Reset the hardware timer count. The timer is stopped.
  TCNT3=0;
 71a:	10 92 95 00 	sts	0x0095, r1
 71e:	10 92 94 00 	sts	0x0094, r1

  //Set the compare to 255 = 100%, LCD backlight is on.
  OCR3A=255;
 722:	8f ef       	ldi	r24, 0xFF	; 255
 724:	90 e0       	ldi	r25, 0x00	; 0
 726:	90 93 99 00 	sts	0x0099, r25
 72a:	80 93 98 00 	sts	0x0098, r24

// TCCR1A:
// COM1A1 COM1A0 COM1B1 COM1B0 COM1C1 COM1C0 WGM11 WGM10
//    0      1      0      0      0      0     0     1
  //Enable the counter.
  TCCR3A = (1 << WGM30) | (1 << COM3A1);
 72e:	81 e8       	ldi	r24, 0x81	; 129
 730:	80 83       	st	Z, r24
  TCCR3B = (1 << CS32) | (1 << CS30) | (1 << WGM32);
 732:	8d e0       	ldi	r24, 0x0D	; 13
 734:	8c 93       	st	X, r24


  }
 736:	08 95       	ret

00000738 <Initialize_GPIO>:
// Port Direction Initialization.
//
// This routine will set the default processor port directions.
//----------------------------------------------------------------------------
void Initialize_GPIO(void)
{
 738:	9f ef       	ldi	r25, 0xFF	; 255
 73a:	91 b9       	out	0x01, r25	; 1
 *              2: LCD_DB2,             output, low
 *              1: LCD_DB1,             output, low
 *              0: LCD_DB0,             output, low
 */
     DDRA =  0b11111111;
     PORTA = 0b00000000;
 73c:	12 b8       	out	0x02, r1	; 2
 *              3: MISO,                output, low
 *              2: MOSI,                output, low
 *              1: SCK,                 output, low
 *              0: nSS,                 output, low
 */
     DDRB =  0b10111111;
 73e:	8f eb       	ldi	r24, 0xBF	; 191
 740:	84 b9       	out	0x04, r24	; 4
     PORTB = 0b01110000;
 742:	80 e7       	ldi	r24, 0x70	; 112
 744:	85 b9       	out	0x05, r24	; 5
 *              3: LCD_CS2,             output, high
 *              2: LCD_RST,             output, low
 *              1: LCD_CS3,             output, high
 *              0: NC                   input, pull-up
 */
     DDRC =  0b11111110;
 746:	8e ef       	ldi	r24, 0xFE	; 254
 748:	87 b9       	out	0x07, r24	; 7
     PORTC = 0b11011011;
 74a:	8b ed       	ldi	r24, 0xDB	; 219
 74c:	88 b9       	out	0x08, r24	; 8
 *              3: NC,                  input, pull-up
 *              2: LED2,                input, pull-up
 *              1: LED1,                input, pull-up
 *              0: NC,                  input, pull-up
 */
     DDRD =  0b00000110;
 74e:	86 e0       	ldi	r24, 0x06	; 6
 750:	8a b9       	out	0x0a, r24	; 10
     PORTD = 0b11111001;
 752:	89 ef       	ldi	r24, 0xF9	; 249
 754:	8b b9       	out	0x0b, r24	; 11
 *              3: LCD_BL_GRN,          output, high
 *              2: NC,                  input, pull-up
 *              1: NC,                  input, pull-up
 *              0: NC,                  input, pull-up
 */
     DDRE =  0b00001000;
 756:	88 e0       	ldi	r24, 0x08	; 8
 758:	8d b9       	out	0x0d, r24	; 13
     PORTE = 0b11111111;
 75a:	9e b9       	out	0x0e, r25	; 14
 *              3: NC,                  input, pull-up
 *              2: NC,                  input, pull-up
 *              1: NC,                  input, pull-up
 *              0: NC,                  input, pull-up
 */
     DDRG =  0b00010000;
 75c:	80 e1       	ldi	r24, 0x10	; 16
 75e:	83 bb       	out	0x13, r24	; 19
     PORTG = 0b11111111;
 760:	94 bb       	out	0x14, r25	; 20
}
 762:	08 95       	ret

00000764 <update_contrast>:
//============================================================================
void update_contrast(unsigned char contrast)
{
 764:	9f ef       	ldi	r25, 0xFF	; 255
 766:	89 9f       	mul	r24, r25
 768:	c0 01       	movw	r24, r0
 76a:	11 24       	eor	r1, r1
 76c:	64 e6       	ldi	r22, 0x64	; 100
 76e:	70 e0       	ldi	r23, 0x00	; 0
 770:	0e 94 27 04 	call	0x84e	; 0x84e <__udivmodhi4>
 774:	67 bd       	out	0x27, r22	; 39
     OCR0A = ((unsigned short)contrast * 255) / 100;
//     OCR0A = ((uword)contrast * 128) / 100;
}
 776:	08 95       	ret

00000778 <update_backlight_R>:
//============================================================================
void update_backlight_R(unsigned char backlight)
{
 778:	9f ef       	ldi	r25, 0xFF	; 255
 77a:	89 9f       	mul	r24, r25
 77c:	c0 01       	movw	r24, r0
 77e:	11 24       	eor	r1, r1
 780:	64 e6       	ldi	r22, 0x64	; 100
 782:	70 e0       	ldi	r23, 0x00	; 0
 784:	0e 94 27 04 	call	0x84e	; 0x84e <__udivmodhi4>
 788:	70 93 89 00 	sts	0x0089, r23
 78c:	60 93 88 00 	sts	0x0088, r22
     OCR1A = ((unsigned short)backlight * 255) / 100;
//     OCR2A = ((uword)backlight * 255) / 100;
//    OCR3A = ((uword)backlight * 255) / 100;
}
 790:	08 95       	ret

00000792 <update_backlight_G>:
//============================================================================
void update_backlight_G(unsigned char backlight)
{
 792:	9f ef       	ldi	r25, 0xFF	; 255
 794:	89 9f       	mul	r24, r25
 796:	c0 01       	movw	r24, r0
 798:	11 24       	eor	r1, r1
 79a:	64 e6       	ldi	r22, 0x64	; 100
 79c:	70 e0       	ldi	r23, 0x00	; 0
 79e:	0e 94 27 04 	call	0x84e	; 0x84e <__udivmodhi4>
 7a2:	60 93 b3 00 	sts	0x00B3, r22
//     OCR1A = ((uword)backlight * 255) / 100;
     OCR2A = ((unsigned short)backlight * 255) / 100;
//    OCR3A = ((uword)backlight * 255) / 100;
}
 7a6:	08 95       	ret

000007a8 <update_backlight_B>:
//============================================================================
void update_backlight_B(unsigned char backlight)
{
 7a8:	9f ef       	ldi	r25, 0xFF	; 255
 7aa:	89 9f       	mul	r24, r25
 7ac:	c0 01       	movw	r24, r0
 7ae:	11 24       	eor	r1, r1
 7b0:	64 e6       	ldi	r22, 0x64	; 100
 7b2:	70 e0       	ldi	r23, 0x00	; 0
 7b4:	0e 94 27 04 	call	0x84e	; 0x84e <__udivmodhi4>
 7b8:	70 93 99 00 	sts	0x0099, r23
 7bc:	60 93 98 00 	sts	0x0098, r22
//     OCR1A = ((uword)backlight * 255) / 100;
//     OCR2A = ((uword)backlight * 255) / 100;
    OCR3A = ((unsigned short)backlight * 255) / 100;
}
 7c0:	08 95       	ret

000007c2 <Initialize_contrast_backlight_and_LCD>:
//============================================================================
void Initialize_contrast_backlight_and_LCD()
{
 7c2:	ef 92       	push	r14
 7c4:	ff 92       	push	r15
 7c6:	0f 93       	push	r16
 7c8:	1f 93       	push	r17
	register unsigned char backlight_1;
	register unsigned char backlight_2;
	register unsigned char backlight_3;

    // copy the bitmap from flash to memory
	memcpy_P(display, boot_logo, sizeof(display));
 7ca:	0c ec       	ldi	r16, 0xCC	; 204
 7cc:	10 e0       	ldi	r17, 0x00	; 0
 7ce:	81 e0       	ldi	r24, 0x01	; 1
 7d0:	e8 2e       	mov	r14, r24
 7d2:	82 e0       	ldi	r24, 0x02	; 2
 7d4:	f8 2e       	mov	r15, r24
 7d6:	40 e0       	ldi	r20, 0x00	; 0
 7d8:	54 e0       	ldi	r21, 0x04	; 4
 7da:	b8 01       	movw	r22, r16
 7dc:	c7 01       	movw	r24, r14
 7de:	0e 94 17 04 	call	0x82e	; 0x82e <memcpy_P>

	// Reset the LCD
	ResetLCD();
 7e2:	0e 94 35 03 	call	0x66a	; 0x66a <ResetLCD>

	//Start the timers.
	Initialize_And_Start_Timer_0_LCD_Contrast_PWM();
 7e6:	0e 94 51 03 	call	0x6a2	; 0x6a2 <Initialize_And_Start_Timer_0_LCD_Contrast_PWM>
	Initialize_And_Start_Timer_1_32_Hz_and_Backlight();     // RED  
 7ea:	0e 94 5c 03 	call	0x6b8	; 0x6b8 <Initialize_And_Start_Timer_1_32_Hz_and_Backlight>
	Initialize_And_Start_Timer_2_32_Hz_and_Backlight();     // BLUE
 7ee:	0e 94 73 03 	call	0x6e6	; 0x6e6 <Initialize_And_Start_Timer_2_32_Hz_and_Backlight>
	Initialize_And_Start_Timer_3_32_Hz_and_Backlight();     // GREEN
 7f2:	0e 94 85 03 	call	0x70a	; 0x70a <Initialize_And_Start_Timer_3_32_Hz_and_Backlight>

	// Initializes the LCD, also takes LCD out of reset
	InitializeLCD();
 7f6:	0e 94 3b 03 	call	0x676	; 0x676 <InitializeLCD>

	// Copies from the array in flash to RAM
    memcpy_P(display, boot_logo, sizeof(display));
 7fa:	40 e0       	ldi	r20, 0x00	; 0
 7fc:	54 e0       	ldi	r21, 0x04	; 4
 7fe:	b8 01       	movw	r22, r16
 800:	c7 01       	movw	r24, r14
 802:	0e 94 17 04 	call	0x82e	; 0x82e <memcpy_P>
     PORTG = 0b11111111;
}
//============================================================================
void update_contrast(unsigned char contrast)
{
     OCR0A = ((unsigned short)contrast * 255) / 100;
 806:	89 e1       	ldi	r24, 0x19	; 25
 808:	87 bd       	out	0x27, r24	; 39
//     OCR0A = ((uword)contrast * 128) / 100;
}
//============================================================================
void update_backlight_R(unsigned char backlight)
{
     OCR1A = ((unsigned short)backlight * 255) / 100;
 80a:	2f ef       	ldi	r18, 0xFF	; 255
 80c:	30 e0       	ldi	r19, 0x00	; 0
 80e:	30 93 89 00 	sts	0x0089, r19
 812:	20 93 88 00 	sts	0x0088, r18
}
//============================================================================
void update_backlight_G(unsigned char backlight)
{
//     OCR1A = ((uword)backlight * 255) / 100;
     OCR2A = ((unsigned short)backlight * 255) / 100;
 816:	8f ef       	ldi	r24, 0xFF	; 255
 818:	80 93 b3 00 	sts	0x00B3, r24
//============================================================================
void update_backlight_B(unsigned char backlight)
{
//     OCR1A = ((uword)backlight * 255) / 100;
//     OCR2A = ((uword)backlight * 255) / 100;
    OCR3A = ((unsigned short)backlight * 255) / 100;
 81c:	30 93 99 00 	sts	0x0099, r19
 820:	20 93 98 00 	sts	0x0098, r18
    update_backlight_R(backlight_1);
    update_backlight_G(backlight_2);
    update_backlight_B(backlight_3);


}
 824:	1f 91       	pop	r17
 826:	0f 91       	pop	r16
 828:	ff 90       	pop	r15
 82a:	ef 90       	pop	r14
 82c:	08 95       	ret

0000082e <memcpy_P>:
 82e:	fb 01       	movw	r30, r22
 830:	dc 01       	movw	r26, r24
 832:	02 c0       	rjmp	.+4      	; 0x838 <memcpy_P+0xa>
 834:	05 90       	lpm	r0, Z+
 836:	0d 92       	st	X+, r0
 838:	41 50       	subi	r20, 0x01	; 1
 83a:	50 40       	sbci	r21, 0x00	; 0
 83c:	d8 f7       	brcc	.-10     	; 0x834 <memcpy_P+0x6>
 83e:	08 95       	ret

00000840 <memset>:
 840:	dc 01       	movw	r26, r24
 842:	01 c0       	rjmp	.+2      	; 0x846 <memset+0x6>
 844:	6d 93       	st	X+, r22
 846:	41 50       	subi	r20, 0x01	; 1
 848:	50 40       	sbci	r21, 0x00	; 0
 84a:	e0 f7       	brcc	.-8      	; 0x844 <memset+0x4>
 84c:	08 95       	ret

0000084e <__udivmodhi4>:
 84e:	aa 1b       	sub	r26, r26
 850:	bb 1b       	sub	r27, r27
 852:	51 e1       	ldi	r21, 0x11	; 17
 854:	07 c0       	rjmp	.+14     	; 0x864 <__udivmodhi4_ep>

00000856 <__udivmodhi4_loop>:
 856:	aa 1f       	adc	r26, r26
 858:	bb 1f       	adc	r27, r27
 85a:	a6 17       	cp	r26, r22
 85c:	b7 07       	cpc	r27, r23
 85e:	10 f0       	brcs	.+4      	; 0x864 <__udivmodhi4_ep>
 860:	a6 1b       	sub	r26, r22
 862:	b7 0b       	sbc	r27, r23

00000864 <__udivmodhi4_ep>:
 864:	88 1f       	adc	r24, r24
 866:	99 1f       	adc	r25, r25
 868:	5a 95       	dec	r21
 86a:	a9 f7       	brne	.-22     	; 0x856 <__udivmodhi4_loop>
 86c:	80 95       	com	r24
 86e:	90 95       	com	r25
 870:	bc 01       	movw	r22, r24
 872:	cd 01       	movw	r24, r26
 874:	08 95       	ret

00000876 <_exit>:
 876:	f8 94       	cli

00000878 <__stop_program>:
 878:	ff cf       	rjmp	.-2      	; 0x878 <__stop_program>

⌨️ 快捷键说明

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