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

📄 pproject.s

📁 公交报站系统
💻 S
📖 第 1 页 / 共 5 页
字号:
	rcall _Set_A0
	rjmp L104
L103:
	.dbline 401
;  while(s--)				//快进s段
;  {
	.dbline 402
;   Set_CE(0);
	clr R16
	rcall _Set_CE
	.dbline 403
;   Set_CE(1);
	ldi R16,1
	rcall _Set_CE
L106:
	.dbline 405
;   do
;    NOP();
	nop
L107:
	.dbline 406
	lds R2,_EOM_Flag
	tst R2
	brne L106
	.dbline 407
	ldi R24,1
	sts _EOM_Flag,R24
	.dbline 408
L104:
	.dbline 400
	mov R2,R20
	clr R3
	subi R20,1
	tst R2
	brne L103
	.dbline 409
;   while(EOM_Flag);		//检测EOM标志位,为0时有效
;   EOM_Flag=1;			
;  }
;  Set_A0(0);	 			//M6模式
	clr R16
	rcall _Set_A0
	.dbline -2
	.dbline 410
; }
L102:
	rcall pop_gset1
	.dbline 0 ; func end
	ret
	.dbsym r s 20 c
	.dbend
	.dbfunc e Play _Play fV
	.even
_Play::
	.dbline -1
	.dbline 414
; 
; //语音播放程序
; void Play(void)
; {
	.dbline 415
;  Set_CE(0);				//CE线的一个低电平,触发芯片的放音操作
	clr R16
	rcall _Set_CE
	.dbline 416
;  Set_CE(1);
	ldi R16,1
	rcall _Set_CE
L110:
	.dbline 418
;  do
;   NOP();
	nop
L111:
	.dbline 419
;  while(EOM_Flag);		//检测EOM标志位,为0时有效
	lds R2,_EOM_Flag
	tst R2
	brne L110
	.dbline 420
;  EOM_Flag=1;			//重新赋EOM标志位为1
	ldi R24,1
	sts _EOM_Flag,R24
	.dbline -2
	.dbline 421
; }
L109:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e Inform _Inform fV
;              i -> R20
;              m -> R20
	.even
_Inform::
	rcall push_gset1
	mov R20,R16
	.dbline -1
	.dbline 427
; 
; 
; //****************************语音报站程序****************************//
; //报站
; void Inform(uchar m)
; {
	.dbline 429
;  uchar i;
;  if(Pst_Flag)				//若为上行方向
	lds R2,_Pst_Flag
	tst R2
	breq L114
	.dbline 430
;   Snd_Info[0]=m;			//顺序报站
	sts _Snd_Info,R20
	rjmp L115
L114:
	.dbline 432
;  else					//若为下行方向
;   Snd_Info[0]=17-m;		//逆序报站
	ldi R24,17
	sub R24,R20
	sts _Snd_Info,R24
L115:
	.dbline 433
;  Set_PD(1);				//语音芯片复位
	ldi R16,1
	rcall _Set_PD
	.dbline 434
;  delay(20000);
	ldi R16,32
	rcall _delay
	.dbline 435
;  Set_PD(0); 
	clr R16
	rcall _Set_PD
	.dbline 436
;  for(i=0;i<2;i++)
	clr R20
	rjmp L119
L116:
	.dbline 437
	.dbline 438
	ldi R24,<_Snd_Info
	ldi R25,>_Snd_Info
	mov R30,R20
	clr R31
	add R30,R24
	adc R31,R25
	ldd R16,z+0
	rcall _Seek_Segment
	.dbline 439
	rcall _Play
	.dbline 440
L117:
	.dbline 436
	inc R20
L119:
	.dbline 436
	cpi R20,2
	brlo L116
	.dbline -2
	.dbline 441
;  {
;   Seek_Segment(Snd_Info[i]);		//搜索相应语音信息段
;   Play();							//播放
;  } 
; }
L113:
	rcall pop_gset1
	.dbline 0 ; func end
	ret
	.dbsym r i 20 c
	.dbsym r m 20 c
	.dbend
	.dbfunc e Pre_Inform _Pre_Inform fV
;              i -> R20
;              m -> R20
	.even
_Pre_Inform::
	rcall push_gset1
	mov R20,R16
	.dbline -1
	.dbline 445
; 
; //预报
; void Pre_Inform(uchar m) 
; {
	.dbline 447
;  uchar i;
;  if(Pst_Flag)				//若为上行方向
	lds R2,_Pst_Flag
	tst R2
	breq L121
	.dbline 448
;   Snd_Pre_Info[1]=m;		//顺序预报站
	sts _Snd_Pre_Info+1,R20
	rjmp L122
L121:
	.dbline 450
;  else					//若为下行方向
;   Snd_Pre_Info[1]=17-m;	//逆序预报站
	ldi R24,17
	sub R24,R20
	sts _Snd_Pre_Info+1,R24
L122:
	.dbline 451
;  Set_PD(1);				//语音芯片复位
	ldi R16,1
	rcall _Set_PD
	.dbline 452
;  delay(20000);
	ldi R16,32
	rcall _delay
	.dbline 453
;  Set_PD(0); 
	clr R16
	rcall _Set_PD
	.dbline 454
;  for(i=0;i<3;i++)
	clr R20
	rjmp L128
L125:
	.dbline 455
	.dbline 456
	ldi R24,<_Snd_Pre_Info
	ldi R25,>_Snd_Pre_Info
	mov R30,R20
	clr R31
	add R30,R24
	adc R31,R25
	ldd R16,z+0
	rcall _Seek_Segment
	.dbline 457
	rcall _Play
	.dbline 458
L126:
	.dbline 454
	inc R20
L128:
	.dbline 454
	cpi R20,3
	brlo L125
	.dbline -2
	.dbline 459
;  {
;   Seek_Segment(Snd_Pre_Info[i]);		//搜索相应语音信息段
;   Play();								//播放
;  }
; }
L120:
	rcall pop_gset1
	.dbline 0 ; func end
	ret
	.dbsym r i 20 c
	.dbsym r m 20 c
	.dbend
	.dbfunc e Special _Special fV
;              m -> R20
	.even
_Special::
	rcall push_gset1
	mov R20,R16
	.dbline -1
	.dbline 463
; 
; //播放特殊信息
; void Special(uchar m)
; {
	.dbline 464
;  Set_PD(1);				//语音芯片复位
	ldi R16,1
	rcall _Set_PD
	.dbline 465
;  delay(20000);
	ldi R16,32
	rcall _delay
	.dbline 466
;  Set_PD(0);
	clr R16
	rcall _Set_PD
	.dbline 467
;  Seek_Segment(Snd_Spec[m]);		//搜索相应语音信息段
	ldi R24,<_Snd_Spec
	ldi R25,>_Snd_Spec
	mov R30,R20
	clr R31
	add R30,R24
	adc R31,R25
	ldd R16,z+0
	rcall _Seek_Segment
	.dbline 468
;  Play();							//播放
	rcall _Play
	.dbline -2
	.dbline 469
; }
L129:
	rcall pop_gset1
	.dbline 0 ; func end
	ret
	.dbsym r m 20 c
	.dbend
	.dbfunc e Welcome _Welcome fV
	.even
_Welcome::
	.dbline -1
	.dbline 473
; 
; //欢迎信息
; void Welcome()
; {
	.dbline 474
;  Set_PD(1);				//语音芯片复位
	ldi R16,1
	rcall _Set_PD
	.dbline 475
;  delay(20000);
	ldi R16,32
	rcall _delay
	.dbline 476
;  Set_PD(0); 
	clr R16
	rcall _Set_PD
	.dbline 477
;  Seek_Segment(Snd_Welc);		//搜索相应语音信息段
	lds R16,_Snd_Welc
	rcall _Seek_Segment
	.dbline 478
;  Play();						//播放
	.dbline -2
	.dbline 479
; }
L130:
	.dbline 0 ; func end
	rjmp _Play
	.dbend
	.dbfunc e Key_Scan _Key_Scan fV
;       Debounce -> R22
;          Press -> R20
	.even
_Key_Scan::
	rcall push_lset
	rcall push_gset2
	.dbline -1
	.dbline 484
; 
; //****************************中断服务程序****************************//
; //按键中断INT0服务程序
; void Key_Scan(void)
; {
	.dbline 486
;  uchar Press,Debounce;
;  GIMSK &=0xbf;		  	//关闭中断INT0
	in R24,0x3b
	andi R24,191
	out 0x3b,R24
	.dbline 487
;  Press=Read_1byte(0x70,0x0c);			//读取按下键的键值
	ldi R18,12
	ldi R16,112
	rcall _Read_1byte
	mov R20,R16
	.dbline 488
;  if(Press)
	tst R16
	breq L132
	.dbline 489
;  {
	.dbline 490
;    Debounce=Read_1byte(0x70,0x08);		//读取释放键的键值
	ldi R18,8
	ldi R16,112
	rcall _Read_1byte
	mov R22,R16
	.dbline 491
;    if(Debounce==Press)				//若二者相同,则认为该键被按下
	cp R16,R20
	brne L134
	.dbline 492
;    	Key_Value=Press;
	sts _Key_Value,R20
L134:
	.dbline 493
;  }
L132:
	.dbline 494
;  GIMSK |=0x40;	 			//重新打开中断INT0
	in R24,0x3b
	ori R24,64
	out 0x3b,R24
	.dbline 495
;  Key_Act();
	rcall _Key_Act
	.dbline -2
	.dbline 496
; }
L131:
	rcall pop_gset2
	rcall pop_lset
	.dbline 0 ; func end
	reti
	.dbsym r Debounce 22 c
	.dbsym r Press 20 c
	.dbend
	.dbfunc e Receive_EOM _Receive_EOM fV
	.even
_Receive_EOM::
	rcall push_lset
	.dbline -1
	.dbline 500
; 
; //语音中断INT1服务程序
; void Receive_EOM(void)
; {
	.dbline 501
;  GIMSK &=0x7f;		  	//关闭中断INT1
	in R24,0x3b
	andi R24,127
	out 0x3b,R24
	.dbline 502
;  Set_PD(1);				//语音芯片复位
	ldi R16,1
	rcall _Set_PD
	.dbline 503
;  delay(20000);
	ldi R16,32
	rcall _delay
	.dbline 504
;  Set_PD(0);
	clr R16
	rcall _Set_PD
	.dbline 505
;  EOM_Flag=0;			//设置EOM标志位,为0时有效
	clr R2
	sts _EOM_Flag,R2
	.dbline 506
;  GIMSK |=0x80;		  	//重新打开中断INT1
	in R24,0x3b
	ori R24,128
	out 0x3b,R24
	.dbline -2
	.dbline 507
; }
L136:
	rcall pop_lset
	.dbline 0 ; func end
	reti
	.dbend
	.dbfunc e MAX6959_Initialize _MAX6959_Initialize fV
	.even
_MAX6959_Initialize::
	sbiw R28,1
	.dbline -1
	.dbline 512
; 
; //****************************系统初始化程序****************************//
; //MAX6959初始化
; void MAX6959_Initialize(void)
; {
	.dbline 513
;  Write_1byte(0x70,0x01,0x0f);		//设置MAX6959为译码模式
	ldi R24,15
	std y+0,R24
	ldi R18,1
	ldi R16,112
	rcall _Write_1byte
	.dbline 514
;  Write_1byte(0x70,0x02,0x3f);		//设置MAX6959的显示亮度为最高,即63/64
	ldi R24,63
	std y+0,R24
	ldi R18,2
	ldi R16,112
	rcall _Write_1byte
	.dbline 515
;  Write_1byte(0x70,0x03,0x03);		//设置MAX6959扫描所有显示位和按键
	ldi R24,3
	std y+0,R24
	ldi R18,3
	ldi R16,112
	rcall _Write_1byte
	.dbline 516
;  Write_1byte(0x70,0x04,0x21);		//设置MAX6959使其进入正常工作模式,并清除显示
	ldi R24,33
	std y+0,R24
	ldi R18,4
	ldi R16,112
	rcall _Write_1byte
	.dbline 517
;  Write_1byte(0x70,0x06,0x58);		//设置MAX6959进行按键扫描并发出下降沿中断请求
	ldi R24,88
	std y+0,R24
	ldi R18,6
	ldi R16,112
	rcall _Write_1byte
	.dbline -2
	.dbline 518
; }
L137:
	adiw R28,1
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e AVR_Initialize _AVR_Initialize fV
	.even
_AVR_Initialize::
	.dbline -1
	.dbline 522
; 
; //AT90S8535初始化
; void AVR_Initialize()
; {
	.dbline 523
;  DDRA=0xff;		//定义PA口为输出,用于与ISD2560和MAX6959进行数据通信
	ldi R24,255
	out 0x1a,R24
	.dbline 524
;  PORTA=0x16;
	ldi R24,22
	out 0x1b,R24
	.dbline 525
;  DDRB=0xff;		//定义PB口为输出,作为点阵显示器的数据总线
	ldi R24,255
	out 0x17,R24
	.dbline 526
;  PORTB=0xff;
	out 0x18,R24
	.dbline 527
;  DDRC=0xff;		//定义PC口为输出,作为点阵显示器的地址和控制总线
	out 0x14,R24
	.dbline 528
;  PORTC=0x30;
	ldi R24,48
	out 0x15,R24
	.dbline 529
;  SREG=0x80;		//开全局中断
	ldi R24,128
	out 0x3f,R24
	.dbline 530
;  GIMSK=0xc0;	//通用中断控制寄存器设置,打开中断INT0和INT1
	ldi R24,192
	out 0x3b,R24
	.dbline 531
;  MCUCR=0x0a;	//设置外部中断的中断触发方式为下降沿触发
	ldi R24,10
	out 0x35,R24
	.dbline -2
	.dbline 532
; }
L138:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e display _display fV
;              a -> R20
	.even
_display::
	rcall push_gset1
	.dbline -1
	.dbline 539
; 
; 
; 
; //****************************汉字显示程序****************************//
; //显示
; void display()
; {
	.dbline 541
; uchar a;
; PORTC=0x60;			//先显示上半屏
	ldi R24,96
	out 0x15,R24
	.dbline 542
; for(a=0;a<32;a++)
	clr R20
	rjmp L143
L140:
	.dbline 543
; {
	.dbline 544
; if(PORTC==0x6f)		//若上半屏显示完毕,则
	in R24,0x15
	cpi R24,111
	brne L144
	.dbline 545
; PORTC=0x50;			//显示下半屏
	ldi R24,80
	out 0x15,R24
L144:
	.dbline 546
; if(PORTC==0x5f)		//若下半屏显示完毕,则
	in R24,0x15
	cpi R24,95
	brne L146
	.dbline 547
; PORTC=0x60;			//显示上半屏
	ldi R24,96
	out 0x15,R24
L146:
	.dbline 548
	in R24,0x15
	subi R24,255    ; addi 1
	out 0x15,R24
	.dbline 549
	ldi R24,<_text
	ldi R25,>_text
	mov R30,R20
	clr R31
	add R30,R24
	adc R31,R25
	ldd R2,z+0
	out 0x18,R2
	.dbline 550
	ldi R16,32
	rcall _delay
	.dbline 551
	clr R2
	out 0x18,R2
	.dbline 552
L141:
	.dbline 542
	inc R20
L143:
	.dbline 542
	cpi R20,32
	brlo L140
	.dbline -2
	.dbline 553
; PORTC++;			//选通显示列
; PORTB=text[a];			//送显示字型
; delay(20000);			//延时等待,以保证显示的稳定性
; PORTB=0;				//清空显示屏
; }
; }
L139:
	rcall pop_gset1
	.dbline 0 ; func end
	ret
	.dbsym r a 20 c
	.dbend
	.dbfunc e change _change fV
	.area func_lit(rom, con, rel)
L362:
	.word `L154
	.word `L167
	.word `L180
	.word `L193
	.word `L206
	.word `L219
	.word `L232
	.word `L245
	.word `L258
	.word `L271
	.word `L284
	.word `L297
	.word `L310
	.word `L323
	.word `L336
	.word `L349
	.area text(rom, con, rel)
	.dbfile E:\张军\AVR\光盘内容\实例源文件\第五章程序\Project\Pproject.c
	.area func_lit(rom, con, rel)
L574:
	.word `L366
	.word `L379
	.word `L392
	.word `L405
	.word `L418
	.word `L431
	.word `L444
	.word `L457
	.word `L470
	.word `L483
	.word `L496
	.word `L509
	.word `L522
	.word `L535
	.word `L548
	.word `L561
	.area text(rom, con, rel)
	.dbfile E:\张军\AVR\光盘内容\实例源文件\第五章程序\Project\Pproject.c
;              m -> R20
	.even
_change::
	rcall push_gset2
	.dbline -1
	.dbline 557
; 
; //换下一个字
; void change()
; {
	.dbline 559
;  unsigned char m;
;  if(!Pre_Flag)				//报站情形
	lds R2,_Pre_Flag
	tst R2
	breq X5
	rjmp L149
X5:
	.dbline 560
;  {
	.dbline 561
;   switch(State)			//判断站名
	lds R20,_State
	clr R21
	cpi R20,1
	ldi R30,0
	cpc R21,R30
	brge X6
	rjmp L150
X6:
	ldi R24,16
	ldi R25,0
	cp R24,R20
	cpc R25,R21
	brge X7
	rjmp L150
X7:
	ldi R24,<L362
	ldi R25,>L362
	mov R16,R20
	mov R17,R21
	subi R16,1
	sbci R17,0
	lsl R16
	rol R17
	add R16,R24
	adc R17,R25
	rcall lpm16
	mov R30,R16
	mov R31,R17
	ijmp
X3:
	.dbline 562
;   {
L154:
	.dbline 564
;    case 1:				//若为第1站
;     if(Word_Number<5)	//判断已显示字数
	lds R24,_Word_Number
	cpi R24,5
	brlo X8
	rjmp L155
X8:
	.dbline 565
;     {
	.dbline 566
;      if(Word_Number<3)	//若未显示完“第1站”,则
	cpi R24,3
	brsh L157
	.dbline 567
;      {
	.dbline 568
;       for(m=0;m<32;m++)
	clr R20
	rjmp L162
L159:
	.dbline 569
	ldi R18,5
	ldi R19,0
	lds R16,_Word_Number
	clr R17
	rcall lsl16
	mov R2,R16
	mov R3,R17
	ldi R24,<_State1
	ldi R25,>_State1
	add R2,R24
	adc R3,R25
	mov R4,R20
	clr R5
	add R4,R2
	adc R5,R3
	mov R30,R4
	mov R31,R5
	lpm
	ldi R24,<_next
	ldi R25,>_next
	mov R30,R20
	clr R31
	add R30,R24
	adc R31,R25
	std z+0,R0
L160:
	.dbline 568
	inc R20
L162:
	.dbline 568
	cpi R20,32
	brlo L159
	.dbline 570

⌨️ 快捷键说明

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