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

📄 8255.s

📁 这是一款基于AVR单片机的直流稳压电源的设计项目
💻 S
📖 第 1 页 / 共 5 页
字号:
; };
; 
; const unsigned char dliu[]=	 {0x11,0xA6,0x70,0x02,0xD2,0x1A,0xD7,0x12,0xDA,0x32,0x02,0x00,0x01,0x07,0x04,0x02,
; 0x01,0x00,0x07,0x00,0x07,0x04,0x07,0x00
; };
; 
; const unsigned char guo[]=  {0x11,0x16,0xF0,0x04,0x14,0x64,0x04,0x04,0xFF,0x04,0x04,0x00,0x04,0x02,0x01,0x02,
; 0x04,0x04,0x05,0x05,0x05,0x04,0x04,0x00
; };
; 
; const unsigned char si[]={0x88,0x86,0xA2,0xCA,0x92,0x83,0xFA,0x82,0x82,0x8A,0x86,0x00,0x00,0x04,0x04,0x04,
; 0x02,0x01,0x00,0x01,0x02,0x04,0x00,0x00
; };
; 
; 
; 
; 
; const unsigned char ji[]={0xFF,0x81,0x99,0xE7,0x08,0xC9,0x09,0xF9,0x09,0xC9,0x08,0x00,0x07,0x00,0x00,0x02,
; 0x01,0x04,0x04,0x07,0x00,0x00,0x03,0x00
; };
; 
; 
; 
; 
; const unsigned char yu[]={0x11,0x15,0xFD,0x13,0x30,0x01,0xFD,0x07,0xF5,0x05,0xFD,0x00,0x04,0x04,0x07,0x00,
; 0x04,0x04,0x02,0x01,0x01,0x02,0x04,0x00
; };
; 
; 
; 
; const unsigned char zhi[]= {0x10,0x17,0xF5,0x55,0x57,0x5D,0x57,0x55,0xF5,0x17,0x10,0x00,0x04,0x04,0x07,0x05,
; 0x05,0x05,0x05,0x05,0x07,0x04,0x04,0x00
; };
; 
; 
; const unsigned char bo[]={0x08,0xD1,0x3A,0x00,0xFC,0x24,0xE4,0x3F,0xA4,0x64,0x0C,0x00,0x01,0x07,0x04,0x03,
; 0x04,0x04,0x02,0x01,0x02,0x04,0x04,0x00
; };
; 
; const unsigned char xing[]={0x12,0x12,0xFE,0x12,0x12,0xFF,0x92,0x48,0x24,0x13,0x80,0x00,0x04,0x03,0x00,0x00,
; 0x00,0x07,0x04,0x02,0x02,0x01,0x00,0x00
; };
; 
; 
; 
; 
; const unsigned char zfv[]=   {0x20,0xE0,0x20,0x80,0x60,0x20,0x00,0x00,0x03,0x01,0x00,0x00
; };
; 
; 
; const unsigned char zfA[]= {0x00,0xE0,0x9C,0xF0,0x80,0x00,0x02,0x03,0x00,0x00,0x03,0x02
; };
; 
; 
; const unsigned char zfm[]={0xE0,0x20,0xE0,0x20,0xC0,0x00,0x03,0x00,0x03,0x00,0x03,0x00
; };
; 
; 
; const unsigned char sz0[]={0xF8,0x04,0x04,0x04,0xF8,0x00,0x01,0x02,0x02,0x02,0x01,0x00
; };
; 
; 
; const unsigned char sz1[]={0x00,0x08,0xFC,0x00,0x00,0x00,0x00,0x02,0x03,0x02,0x00,0x00
; };
; 
; 
; 
; const unsigned char sz2[]={0x18,0x84,0x44,0x24,0x18,0x00,0x03,0x02,0x02,0x02,0x02,0x00
; };
; 
; const unsigned char sz3[]={0x08,0x04,0x24,0x24,0xD8,0x00,0x01,0x02,0x02,0x02,0x01,0x00
; };
; 
; 
; const unsigned char sz4[]={0x40,0xB0,0x88,0xFC,0x80,0x00,0x00,0x00,0x00,0x03,0x02,0x00
; };
; 
; 
; const unsigned char sz5[]={0x3C,0x24,0x24,0x24,0xC4,0x00,0x01,0x02,0x02,0x02,0x01,0x00
; };
; 
;  
; const unsigned char sz6[]={0xF8,0x24,0x24,0x2C,0xC0,0x00,0x01,0x02,0x02,0x02,0x01,0x00
; };
; 
; const unsigned char sz7[]={0x0C,0x04,0xE4,0x1C,0x04,0x00,0x00,0x00,0x03,0x00,0x00,0x00
; };
; 
; 
; 
; const unsigned char sz8[]={0xD8,0x24,0x24,0x24,0xD8,0x00,0x01,0x02,0x02,0x02,0x01,0x00
; };
; 
; 
; const unsigned char sz9[]={0x38,0x44,0x44,0x44,0xF8,0x00,0x00,0x03,0x02,0x02,0x01,0x00
; };
; 
; 
; const unsigned char xiaoshu[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00
; };
; 
; const unsigned char  kongke[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
; };
; 
; const unsigned char dqing[]= {0x10,0xF1,0x02,0x00,0x2A,0xEA,0xAA,0xBF,0xAA,0xEA,0x2A,0x00,0x00,0x07,0x02,0x01,
; 0x00,0x07,0x02,0x02,0x02,0x07,0x00,0x00
; };
; 
; const unsigned char chong[]=	{0x04,0x05,0xF5,0x55,0x55,0xFF,0x55,0x55,0xF5,0x05,0x04,0x00,0x04,0x05,0x05,0x05,
; 0x05,0x07,0x05,0x05,0x05,0x05,0x04,0x00
; };
; 
; const unsigned char qi[]=  {0x00,0x00,0xFE,0xD2,0x52,0x53,0x52,0x52,0x52,0xDE,0x00,0x00,0x04,0x03,0x00,0x07,
; 0x04,0x04,0x04,0x04,0x04,0x07,0x00,0x00
; };
; const unsigned char pin[]={0x90,0x5E,0xF0,0x1F,0xD4,0x11,0xFD,0x05,0xF7,0x05,0xFD,0x00,0x04,0x04,0x02,0x01,
; 0x04,0x04,0x02,0x01,0x00,0x01,0x06,0x00
; };
; 
; const unsigned char lv[]={0x42,0x46,0x2A,0x52,0x6A,0xD7,0x6A,0x52,0x2A,0x46,0x02,0x00,0x01,0x01,0x01,0x01,
; 0x01,0x07,0x01,0x01,0x01,0x01,0x01,0x00
; };
; const unsigned char zfM[]={0xFC,0x3C,0xC0,0x3C,0xFC,0x00,0x03,0x00,0x03,0x00,0x03,0x00
; };
; const unsigned char zfk[]={0x04,0xFC,0x80,0xE0,0x20,0x20,0x02,0x03,0x02,0x00,0x03,0x02
; };
; 
; const unsigned char *num[]={sz0,sz1,sz2,sz3,sz4,sz5,sz6,sz7,sz8,sz9};
; 
; 
; //8255
; void delay(unsigned int t)
;  {
	.dbline 289
;   unsigned int i,j;
;   for(i=0;i<t;i++)
	clr R20
	clr R21
	xjmp L5
L2:
	.dbline 290
;   for(j=0;j<10;j++)
	clr R22
	clr R23
	xjmp L9
L6:
	.dbline 291
;    ;
L7:
	.dbline 290
	subi R22,255  ; offset = 1
	sbci R23,255
L9:
	.dbline 290
	cpi R22,10
	ldi R30,0
	cpc R23,R30
	brlo L6
X0:
L3:
	.dbline 289
	subi R20,255  ; offset = 1
	sbci R21,255
L5:
	.dbline 289
	cp R20,R16
	cpc R21,R17
	brlo L2
X1:
	.dbline -2
L1:
	.dbline 0 ; func end
	xjmp pop_xgsetF000
	.dbsym r i 20 i
	.dbsym r j 22 i
	.dbsym r t 16 i
	.dbend
	.dbfunc e writePA _writePA fV
;              d -> R10
	.even
_writePA::
	st -y,R10
	mov R10,R16
	.dbline -1
	.dbline 327
;  }
; /*void writePC(unsigned char d,unsigned char x)//PA的第d个端口置X x=0或1
; {
; WROFF; LEOFF;
; shuju=0X09;
; delay(1);
;   LEON ;
;   delay(1);
;  LEOFF;
;   delay(1);
;   if(x==1)
;   shuju=lastPA|(1<<d);
;   if(x==0)
;   shuju=lastPA&~(1<<d);
;   lastPA=shuju;
;   WRON ;
; delay(5);WROFF;
; 
; }*/
; /*void writePB(unsigned char d)
; { 
; WROFF; 
;  LEOFF;
; shuju=0X05;
;   delay(1);
;   LEON ;
;     delay(1);
;  LEOFF;
;     delay(1);
;   shuju=d;
;   WRON ;
;   delay(5);WROFF;
; 
; }*/
; void writePA(unsigned char d)
; { 
	.dbline 329
; 
; WROFF; 
	sbi 0x15,0
	.dbline 330
; A00;
	cbi 0x15,1
	.dbline 331
;   A10;
	cbi 0x15,6
	.dbline 332
;   delay(1);
	ldi R16,1
	ldi R17,0
	xcall _delay
	.dbline 333
;   shuju=d;
	out 0x18,R10
	.dbline 334
;   WRON ;
	cbi 0x15,0
	.dbline 335
;   delay(5);
	ldi R16,5
	ldi R17,0
	xcall _delay
	.dbline 336
;    WROFF;
	sbi 0x15,0
	.dbline -2
L10:
	.dbline 0 ; func end
	ld R10,y+
	ret
	.dbsym r d 10 c
	.dbend
	.dbfunc e writecommand _writecommand fV
;              d -> R10
	.even
_writecommand::
	st -y,R10
	mov R10,R16
	.dbline -1
	.dbline 340
; 
; }
; void writecommand(unsigned char d)
; { WROFF; 
	.dbline 340
	sbi 0x15,0
	.dbline 341
;  A01;
	sbi 0x15,1
	.dbline 342
;  A11;
	sbi 0x15,6
	.dbline 343
;  delay(1);
	ldi R16,1
	ldi R17,0
	xcall _delay
	.dbline 344
;  shuju=d;
	out 0x18,R10
	.dbline 345
;   WRON ; 
	cbi 0x15,0
	.dbline 346
;  delay(5);
	ldi R16,5
	ldi R17,0
	xcall _delay
	.dbline 347
;  WROFF;
	sbi 0x15,0
	.dbline -2
L11:
	.dbline 0 ; func end
	ld R10,y+
	ret
	.dbsym r d 10 c
	.dbend
	.dbfunc e write_command _write_command fV
;        cmdcode -> R10
	.even
_write_command::
	st -y,R10
	mov R10,R16
	.dbline -1
	.dbline 353
; }
; 
; 
; //LCD
; void write_command(unsigned char cmdcode)
;  {
	.dbline 354
;   RS0;
	cbi 0x3,3
	.dbline 355
;   RW0;
	cbi 0x3,5
	.dbline 356
;   writePA(cmdcode);
	mov R16,R10
	xcall _writePA
	.dbline 357
;   delay(1);
	ldi R16,1
	ldi R17,0
	xcall _delay
	.dbline 358
;   E1;
	sbi 0x3,6
	.dbline 359
;   delay(1);
	ldi R16,1
	ldi R17,0
	xcall _delay
	.dbline 360
;   E0;
	cbi 0x3,6
	.dbline -2
L12:
	.dbline 0 ; func end
	ld R10,y+
	ret
	.dbsym r cmdcode 10 c
	.dbend
	.dbfunc e write_data _write_data fV
;       Dispdata -> R10
	.even
_write_data::
	st -y,R10
	mov R10,R16
	.dbline -1
	.dbline 366
;  }
; 
; 
; 
; void write_data(unsigned char Dispdata)
;  {
	.dbline 367
;   RS1;
	sbi 0x3,3
	.dbline 368
;   RW0;
	cbi 0x3,5
	.dbline 369
;   writePA(Dispdata);
	mov R16,R10
	xcall _writePA
	.dbline 370
;   delay(1);
	ldi R16,1
	ldi R17,0
	xcall _delay
	.dbline 371
;   E1;
	sbi 0x3,6
	.dbline 372
;   delay(1);
	ldi R16,1
	ldi R17,0
	xcall _delay
	.dbline 373
;   E0;
	cbi 0x3,6
	.dbline -2
L13:
	.dbline 0 ; func end
	ld R10,y+
	ret
	.dbsym r Dispdata 10 c
	.dbend
	.dbfunc e tongdao _tongdao fV
;              i -> R16
	.even
_tongdao::
	.dbline -1
	.dbline 377
;      }      
; //通道
; void tongdao(unsigned char i)
; {if(i==1) {PORTC&=~(1<<4);PORTC&=~(1<<3); PORTC|=(1<<2);}
	.dbline 377
	cpi R16,1
	brne L15
X2:
	.dbline 377
	.dbline 377
	cbi 0x15,4
	.dbline 377
	cbi 0x15,3
	.dbline 377
	sbi 0x15,2
	.dbline 377
L15:
	.dbline 378
;  if(i==2) {PORTC|=(1<<4);;PORTC&=~(1<<3); PORTC|=(1<<2);}
	cpi R16,2
	brne L17
X3:
	.dbline 378
	.dbline 378
	sbi 0x15,4
	.dbline 378
	.dbline 378
	cbi 0x15,3
	.dbline 378
	sbi 0x15,2
	.dbline 378
L17:
	.dbline 379
;  if(i==0) {PORTC&=~(1<<4);PORTC&=~(1<<3); PORTC&=~(1<<2);}
	tst R16
	brne L19
X4:
	.dbline 379
	.dbline 379
	cbi 0x15,4
	.dbline 379
	cbi 0x15,3
	.dbline 379
	cbi 0x15,2
	.dbline 379
L19:
	.dbline -2
L14:
	.dbline 0 ; func end
	ret
	.dbsym r i 16 c
	.dbend
	.dbfunc e Clr_Scr _Clr_Scr fV
;              k -> R20
;              j -> R22
	.even
_Clr_Scr::
	st -y,R20
	st -y,R22
	.dbline -1
	.dbline 384
; }	                                                                                                            
; 															
;  
; void Clr_Scr()    //清屏
;  {
	.dbline 386
;   unsigned char j,k;
;   for(k=0;k<8;k++)
	clr R20
	xjmp L25
L22:
	.dbline 387
;    {
	.dbline 388
;     LCDCS21;
	sbi 0x3,2
	.dbline 389
; 	LCDCS10;
	cbi 0x3,1
	.dbline 390
; 	delay(10);
	ldi R16,10
	ldi R17,0
	xcall _delay
	.dbline 391
;     write_command((Page_Add+k));
	mov R16,R20
	subi R16,72    ; addi 184
	xcall _write_command
	.dbline 392
;     write_command((Col_Add+0));
	ldi R16,64
	xcall _write_command
	.dbline 393
;     for(j=0;j<64;j++) 
	clr R22
	xjmp L29
L26:
	.dbline 394
; 	 write_data(0x00);
	clr R16
	xcall _write_data
L27:
	.dbline 393
	inc R22
L29:
	.dbline 393
	cpi R22,64
	brlo L26
X5:
	.dbline 395
;     LCDCS20;
	cbi 0x3,2
	.dbline 396
; 	LCDCS11;
	sbi 0x3,1
	.dbline 397
;     delay(10);
	ldi R16,10
	ldi R17,0
	xcall _delay
	.dbline 398
;     write_command((Page_Add+k));
	mov R16,R20
	subi R16,72    ; addi 184
	xcall _write_command
	.dbline 399
;     write_command((Col_Add+0));
	ldi R16,64
	xcall _write_command
	.dbline 400
;     for(j=64;j<128;j++) 
	ldi R22,64
	xjmp L33
L30:
	.dbline 401
; 	 write_data(0x00);
	clr R16
	xcall _write_data
L31:
	.dbline 400
	inc R22
L33:
	.dbline 400
	cpi R22,128
	brlo L30
X6:
	.dbline 402
;    }
L23:
	.dbline 386
	inc R20
L25:
	.dbline 386
	cpi R20,8
	brlo L22
X7:
	.dbline -2
L21:
	.dbline 0 ; func end
	ld R22,y+
	ld R20,y+
	ret
	.dbsym r k 20 c
	.dbsym r j 22 c
	.dbend
	.dbfunc e disp_zf _disp_zf fV
;              j -> R20
;              i -> R12
;             sz -> y+8
;              X -> R10
;              Y -> R22
	.even
_disp_zf::
	xcall push_xgsetF03C
	mov R10,R18
	mov R22,R16
	.dbline -1
	.dbline 407
;  }
; 
; 
; void disp_zf(unsigned char Y,unsigned char X, const unsigned char  *sz)
;  {
	.dbline 408
;   unsigned char j=0,i=0;
	clr R20
	.dbline 408
	clr R12
	.dbline 409
;   for(j=0;j<2;j++)
	xjmp L38
L35:
	.dbline 410
;    {
	.dbline 411
;     write_command((Page_Add+Y+j));
	mov R16,R22
	subi R16,72    ; addi 184
	add R16,R20
	xcall _write_command
	.dbline 412
;     write_command((Col_Add+X));
	mov R16,R10
	subi R16,192    ; addi 64
	xcall _write_command
	.dbline 413
;     for(i=0;i<6;i++) 
	clr R12
	xjmp L42
L39:
	.dbline 414
; 	 write_data(sz[6*j+i]);
	ldi R24,6
	mul R24,R20
	movw R30,R0
	mov R2,R12
	clr R3
	add R30,R2
	adc R31,R3
	ldd R0,y+8
	ldd R1,y+9
	add R30,R0
	adc R31,R1
	elpm R16,Z
	xcall _write_data
L40:
	.dbline 413
	inc R12
L42:
	.dbline 413
	mov R24,R12
	cpi R24,6
	brlo L39
X8:
	.dbline 415
;    }
L36:
	.dbline 409
	inc R20
L38:
	.dbline 409
	cpi R20,2
	brlo L35
X9:
	.dbline -2
L34:
	.dbline 0 ; func end
	xjmp pop_xgsetF03C
	.dbsym r j 20 c
	.dbsym r i 12 c
	.dbsym l sz 8 pkc
	.dbsym r X 10 c
	.dbsym r Y 22 c
	.dbend
	.dbfunc e disp_hz _disp_hz fV
;              j -> R20
;              i -> R12
;             hz -> y+8
;              X -> R10
;              Y -> R22
	.even
_disp_hz::
	xcall push_xgsetF03C
	mov R10,R18
	mov R22,R16
	.dbline -1
	.dbline 421
;  }
; 
; /*---------------------指定位置显示汉字16*16-----------------------*/
; 
; void disp_hz(unsigned char Y,unsigned char X, const unsigned char  *hz)
;  {
	.dbline 422
;   unsigned char j=0,i=0;
	clr R20
	.dbline 422
	clr R12
	.dbline 423
;   for(j=0;j<2;j++)
	xjmp L47
L44:
	.dbline 424
;    {
	.dbline 425
;     write_command((Page_Add+Y+j));         //列在前行在后
	mov R16,R22
	subi R16,72    ; addi 184
	add R16,R20
	xcall _write_command
	.dbline 426
;     write_command((Col_Add+X));
	mov R16,R10
	subi R16,192    ; addi 64
	xcall _write_command
	.dbline 427
;     for(i=0;i<12;i++) 
	clr R12
	xjmp L51
L48:
	.dbline 428
; 	 write_data(hz[12*j+i]);
	ldi R24,12
	mul R24,R20
	movw R30,R0
	mov R2,R12
	clr R3
	add R30,R2
	adc R31,R3
	ldd R0,y+8
	ldd R1,y+9
	add R30,R0
	adc R31,R1
	elpm R16,Z
	xcall _write_data
L49:
	.dbline 427
	inc R12
L51:
	.dbline 427
	mov R24,R12
	cpi R24,12
	brlo L48
X10:
	.dbline 429
;    }
L45:
	.dbline 423
	inc R20
L47:
	.dbline 423
	cpi R20,2
	brlo L44
X11:
	.dbline -2
L43:
	.dbline 0 ; func end
	xjmp pop_xgsetF03C
	.dbsym r j 20 c
	.dbsym r i 12 c
	.dbsym l hz 8 pkc
	.dbsym r X 10 c
	.dbsym r Y 22 c
	.dbend
	.dbfunc e init_lcd _init_lcd fV
	.even
_init_lcd::
	.dbline -1
	.dbline 434
;  }
; 
; /*------------------初始化LCD屏--------------------------*/
; void init_lcd()
;  {
	.dbline 435
;   RST0;
	cbi 0x3,7
	.dbline 436
;   delay(1);
	ldi R16,1
	ldi R17,0
	xcall _delay
	.dbline 437
;   RST1;
	sbi 0x3,7
	.dbline 438
;   delay(1);
	ldi R16,1
	ldi R17,0
	xcall _delay
	.dbline 440
; 
;   LCDCS21;
	sbi 0x3,2
	.dbline 441
;   LCDCS11;
	sbi 0x3,1
	.dbline 443
; 
;   delay(100);
	ldi R16,100
	ldi R17,0
	xcall _delay
	.dbline 444
;   write_command(Disp_Off);
	ldi R16,62
	xcall _write_command
	.dbline 445
;   write_command((Page_Add+0));
	ldi R16,184
	xcall _write_command
	.dbline 446
;   write_command((Start_Line+0));
	ldi R16,192
	xcall _write_command
	.dbline 447
;   write_command((Col_Add+0));
	ldi R16,64
	xcall _write_command

⌨️ 快捷键说明

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