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

📄 lcd_test.s

📁 AVR单片机
💻 S
字号:
	.module lcd_test.c
	.area text(rom, con, rel)
	.dbfile F:\avr\lcdsd1330\lcd_test.c
	.area data(ram, con, rel)
	.dbfile F:\avr\lcdsd1330\lcd_test.c
_sec::
	.blkb 2
	.area idata
	.word 0
	.area data(ram, con, rel)
	.dbfile F:\avr\lcdsd1330\lcd_test.c
	.dbsym e sec _sec I
_min::
	.blkb 2
	.area idata
	.word 0
	.area data(ram, con, rel)
	.dbfile F:\avr\lcdsd1330\lcd_test.c
	.dbsym e min _min I
	.area text(rom, con, rel)
	.dbfile F:\avr\lcdsd1330\lcd_test.c
	.dbfunc e main _main fV
;              o -> R10,R11
;              j -> R20,R21
;              i -> R22,R23
	.even
_main::
	sbiw R28,7
	.dbline -1
	.dbline 41
; /***********************************************************************
; Content: Test for graphic library for Epson SED-1335 based LCD displays.
; Last modified: 15.05.2003
; Copyrights: Free to use, free to change, free to delete :-)
; Compiler: ImageCraft AVR
; Written by: Knut Baardsen @ Baardsen Software, Norway
; Updates: http://www.baso.no
; ***********************************************************************/
; 
; /***********************************************************************
; This software is provided "as is"; Without warranties either express or
; implied, including any warranty regarding merchantability, fitness for 
; a particular purpose or noninfringement. 
; In no event shall Baardsen Software or its suppliers be liable for any 
; special,indirect,incidential or concequential damages resulting from 
; the use or inability to use this software.
; ***********************************************************************/
; 
; 
; /***********************************************************************
; Includes
; ***********************************************************************/
; #include "global.h"
; 
; 
; /***********************************************************************
; Defines and globals 
; ***********************************************************************/
; #define ClockX		   160
; #define ClockY		   120
; #define ClockOR		   40
; #define ClockIR		   2
; int sec = 0;
; int min = 0;
; 
; 
; /***********************************************************************
; Main 
; ***********************************************************************/
; void main()
; {
	.dbline 42
;  int i = 0; 
	clr R22
	clr R23
	.dbline 43
;  int j = 0;
	clr R20
	clr R21
	.dbline 44
;   int o = 0;
	clr R10
	clr R11
	.dbline 46
;   // Init the display
;   lcd_init();
	xcall _lcd_init
	.dbline 47
;   lcd_clear_text();
	xcall _lcd_clear_text
	.dbline 48
;   lcd_clear_graphics();
	xcall _lcd_clear_graphics
	.dbline 50
;   
;    lcd_write_command(0x4f); 
	ldi R16,79
	xcall _lcd_write_command
	.dbline 71
;  /*lcd_write_command(0x46);   
;  lcd_write_data(0x00);       
;  lcd_write_data(0x10);
;  lcd_show_cursor(1);
;  // lcd_show_cursor(0);  
;  lcd_write_command(0x42);
;  for (i = 0;i < 16; i++)
;  {   
;      lcd_write_data(jian4[i]);       
;  } 
;  lcd_write_command(0x46);   
;  lcd_write_data(0x01);       
;  lcd_write_data(0x10);
;    
;  lcd_write_command(0x42);
;  for (i = 16;i < 32; i++)
;  {   
;      lcd_write_data(jian4[i]);       
;  }*/
;  
;  for(j= 0; j < 40 ; j++ )
L2:
	.dbline 72
;  {
	.dbline 73
;     lcd_write_command(0x46); 
	ldi R16,70
	xcall _lcd_write_command
	.dbline 74
;     lcd_write_data(0x00+j);       
	mov R16,R20
	xcall _lcd_write_data
	.dbline 75
;     lcd_write_data(0x10);
	ldi R16,16
	xcall _lcd_write_data
	.dbline 76
; 	lcd_write_command(0x42);
	ldi R16,66
	xcall _lcd_write_command
	.dbline 77
;     for(i = j*240; i < (240*j+240) ; i++)
	ldi R16,240
	ldi R17,0
	movw R18,R20
	xcall empy16s
	movw R22,R16
	xjmp L9
L6:
	.dbline 78
;     {
	.dbline 79
; 	    lcd_write_data(~windows[i]);   
	ldi R24,<_windows
	ldi R25,>_windows
	movw R30,R22
	add R30,R24
	adc R31,R25
	elpm R16,Z
	com R16
	xcall _lcd_write_data
	.dbline 80
;     }
L7:
	.dbline 77
	subi R22,255  ; offset = 1
	sbci R23,255
L9:
	.dbline 77
	ldi R16,240
	ldi R17,0
	movw R18,R20
	xcall empy16s
	movw R24,R16
	subi R24,16  ; offset = 240
	sbci R25,255
	cp R22,R24
	cpc R23,R25
	brlt L6
X0:
	.dbline 81
;  }
L3:
	.dbline 71
	subi R20,255  ; offset = 1
	sbci R21,255
	.dbline 71
	cpi R20,40
	ldi R30,0
	cpc R21,R30
	brlt L2
X1:
L10:
	.dbline 82
;  while(1);  
L11:
	.dbline 82
	xjmp L10
L16:
	.dbline 129
;   
;   // Disable all interrupts
;   CLI();
;   // Set up timer 1 for about 1 second 
;  TCCR1B = 0x00; //stop
;  TCNT1H = 0xE3; //setup
;  TCNT1L = 0xE1;
;  OCR1AH = 0x1C;
;  OCR1AL = 0x1F;
;  OCR1BH = 0x1C;
;  OCR1BL = 0x1F;
;  OCR1CH = 0x1C;
;  OCR1CL = 0x1F;
;  ICR1H  = 0x1C;
;  ICR1L  = 0x1F;
;  TCCR1A = 0x00;
;  TCCR1B = 0x05; //start Timer
;  MCUCR = 0x00;
;  EICRA = 0x00; //extended ext ints
;  EICRB = 0x00; //extended ext ints
;  EIMSK = 0x00;
;  TIMSK = 0x04; //timer interrupt sources
;  ETIMSK = 0x00; //extended timer interrupt sources
;   //lcd_chinesechar(0, 0,jian4 ,2,16,0);
;    // lcd_chinesechar(50, 50,jian4 ,2,16,1);
;   //lcd_chinesechar(10, 12,jian4 ,2,16,1);
;   //while(1);
;   // Draw a frame
;   lcd_rectangle(1,1,320,240,1);
;   lcd_rectangle(3,3,318,238,1);
;   // Write some text
;   
;   
;   lcd_goto(10,4);
;   lcd_write_string(" Baardsen Software");
;   lcd_goto(10,5);
;   lcd_write_string("   Svennahaugen 39");
;   lcd_goto(10,6);
;   lcd_write_string("5516 Haugesund, Norway");
;   //DrawClockOutline();
;   lcd_circle(ClockX,ClockY,ClockIR,1);
;   lcd_circle(ClockX,ClockY,ClockOR,1);
;   i = 0;
;   
;   SEI();
;   while (i < 360)
;   {
	.dbline 130
;     lcd_degree_line(ClockX,ClockY,i,ClockOR-5,ClockOR,1);
	ldi R24,1
	std y+6,R24
	ldi R24,40
	ldi R25,0
	std y+5,R25
	std y+4,R24
	ldi R24,35
	std y+3,R25
	std y+2,R24
	std y+1,R23
	std y+0,R22
	ldi R18,120
	ldi R19,0
	ldi R16,160
	ldi R17,0
	xcall _lcd_degree_line
	.dbline 131
;       i = i + 30;
	subi R22,226  ; offset = 30
	sbci R23,255
	.dbline 132
;   }
L17:
	.dbline 128
	cpi R22,104
	ldi R30,1
	cpc R23,R30
	brlt L16
X2:
L19:
	.dbline 135
;   // Ok, then we enable interrupts and timer which will simulate
;   // a good old analog clock. Enjoy !
;   while(1);
L20:
	.dbline 135
	xjmp L19
X3:
	.dbline -2
L1:
	.dbline 0 ; func end
	adiw R28,7
	ret
	.dbsym r o 10 I
	.dbsym r j 20 I
	.dbsym r i 22 I
	.dbend
	.area vector(rom, abs)
	.org 56
	jmp _timer1_ovf_isr
	.area text(rom, con, rel)
	.dbfile F:\avr\lcdsd1330\lcd_test.c
	.dbfunc e timer1_ovf_isr _timer1_ovf_isr fV
	.even
_timer1_ovf_isr::
	st -y,R0
	st -y,R1
	st -y,R2
	st -y,R3
	st -y,R4
	st -y,R5
	st -y,R6
	st -y,R7
	st -y,R8
	st -y,R9
	st -y,R16
	st -y,R17
	st -y,R18
	st -y,R19
	st -y,R24
	st -y,R25
	st -y,R26
	st -y,R27
	st -y,R30
	st -y,R31
	in R0,0x3f
	st -y,R0
	sbiw R28,7
	.dbline -1
	.dbline 144
; }
; 
; 
; /***********************************************************************
; Interrupt handler for Timer 1 - 1 Second 
; ***********************************************************************/
; #pragma interrupt_handler timer1_ovf_isr:iv_TIM1_OVF
; void timer1_ovf_isr(void)
; {
	.dbline 146
;  //TIMER1 has overflowed
;  TCNT1H = 0xE3; //reload counter high value
	ldi R24,227
	out 0x2d,R24
	.dbline 147
;  TCNT1L = 0xE1; //reload counter low value
	ldi R24,225
	out 0x2c,R24
	.dbline 149
;   // Draw seconds
;   lcd_degree_line(ClockX,ClockY,sec,ClockIR+1,ClockOR-7,0); 
	clr R2
	std y+6,R2
	ldi R24,33
	ldi R25,0
	std y+5,R25
	std y+4,R24
	ldi R24,3
	std y+3,R25
	std y+2,R24
	lds R2,_sec
	lds R3,_sec+1
	std y+1,R3
	std y+0,R2
	ldi R18,120
	ldi R19,0
	ldi R16,160
	ldi R17,0
	xcall _lcd_degree_line
	.dbline 150
;   sec = sec + 6;
	lds R24,_sec
	lds R25,_sec+1
	adiw R24,6
	sts _sec+1,R25
	sts _sec,R24
	.dbline 151
;   lcd_degree_line(ClockX,ClockY,sec,ClockIR+1,ClockOR-7,1); 
	ldi R24,1
	std y+6,R24
	ldi R24,33
	ldi R25,0
	std y+5,R25
	std y+4,R24
	ldi R24,3
	std y+3,R25
	std y+2,R24
	lds R2,_sec
	lds R3,_sec+1
	std y+1,R3
	std y+0,R2
	ldi R18,120
	ldi R19,0
	ldi R16,160
	ldi R17,0
	xcall _lcd_degree_line
	.dbline 153
;   // Draw minute
;   lcd_degree_line(ClockX,ClockY,min,ClockIR+1,ClockOR-15,1); 
	ldi R24,1
	std y+6,R24
	ldi R24,25
	ldi R25,0
	std y+5,R25
	std y+4,R24
	ldi R24,3
	std y+3,R25
	std y+2,R24
	lds R2,_min
	lds R3,_min+1
	std y+1,R3
	std y+0,R2
	ldi R18,120
	ldi R19,0
	ldi R16,160
	ldi R17,0
	xcall _lcd_degree_line
	.dbline 155
;   // Some simple checking....
;   if (sec >= 360) 
	lds R24,_sec
	lds R25,_sec+1
	cpi R24,104
	ldi R30,1
	cpc R25,R30
	brlt L23
X4:
	.dbline 156
;   {
	.dbline 157
;     sec = 0;
	clr R2
	clr R3
	sts _sec+1,R3
	sts _sec,R2
	.dbline 158
;     lcd_degree_line(ClockX,ClockY,min,ClockIR+1,ClockOR-15,0);
	std y+6,R2
	ldi R24,25
	ldi R25,0
	std y+5,R25
	std y+4,R24
	ldi R24,3
	std y+3,R25
	std y+2,R24
	lds R2,_min
	lds R3,_min+1
	std y+1,R3
	std y+0,R2
	ldi R18,120
	ldi R19,0
	ldi R16,160
	ldi R17,0
	xcall _lcd_degree_line
	.dbline 159
;     min = min + 6;
	lds R24,_min
	lds R25,_min+1
	adiw R24,6
	sts _min+1,R25
	sts _min,R24
	.dbline 160
;     lcd_degree_line(ClockX,ClockY,min,ClockIR+1,ClockOR-15,1);
	ldi R24,1
	std y+6,R24
	ldi R24,25
	ldi R25,0
	std y+5,R25
	std y+4,R24
	ldi R24,3
	std y+3,R25
	std y+2,R24
	lds R2,_min
	lds R3,_min+1
	std y+1,R3
	std y+0,R2
	ldi R18,120
	ldi R19,0
	ldi R16,160
	ldi R17,0
	xcall _lcd_degree_line
	.dbline 161
;   }
L23:
	.dbline 162
;   if (min >= 360)
	lds R24,_min
	lds R25,_min+1
	cpi R24,104
	ldi R30,1
	cpc R25,R30
	brlt L25
X5:
	.dbline 163
;   {
	.dbline 164
;     min = 0;
	clr R2
	clr R3
	sts _min+1,R3
	sts _min,R2
	.dbline 165
;   }
L25:
	.dbline -2
L22:
	.dbline 0 ; func end
	adiw R28,7
	ld R0,y+
	out 0x3f,R0
	ld R31,y+
	ld R30,y+
	ld R27,y+
	ld R26,y+
	ld R25,y+
	ld R24,y+
	ld R19,y+
	ld R18,y+
	ld R17,y+
	ld R16,y+
	ld R9,y+
	ld R8,y+
	ld R7,y+
	ld R6,y+
	ld R5,y+
	ld R4,y+
	ld R3,y+
	ld R2,y+
	ld R1,y+
	ld R0,y+
	reti
	.dbend
	.area data(ram, con, rel)
	.dbfile F:\avr\lcdsd1330\lcd_test.c
L15:
	.blkb 23
	.area idata
	.byte 53,53,49,54,32,'H,'a,'u,'g,'e,'s,'u,'n,'d,44,32
	.byte 'N,'o,'r,'w,'a,'y,0
	.area data(ram, con, rel)
	.dbfile F:\avr\lcdsd1330\lcd_test.c
L14:
	.blkb 19
	.area idata
	.byte 32,32,32,'S,'v,'e,'n,'n,'a,'h,'a,'u,'g,'e,'n,32
	.byte 51,57,0
	.area data(ram, con, rel)
	.dbfile F:\avr\lcdsd1330\lcd_test.c
L13:
	.blkb 19
	.area idata
	.byte 32,'B,'a,'a,'r,'d,'s,'e,'n,32,'S,'o,'f,'t,'w,'a
	.byte 'r,'e,0
	.area data(ram, con, rel)
	.dbfile F:\avr\lcdsd1330\lcd_test.c
; }
; 

⌨️ 快捷键说明

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