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

📄 main.lst

📁 减少单片机IO资源占用,采用AD口加电阻网点方式扩展按键.含汇编代码.
💻 LST
📖 第 1 页 / 共 5 页
字号:
   451                      <       	CB_CAP1_ES:			EQU		1			; Polarity control of capture1 interrupt for bit mode. 
   452                      <       	CB_CAP0_ES:			EQU		0			; Polarity control of capture0 interrupt for bit mode.
   453                      <       ;	
   454                      <       ;-----------------------------------------------------------------------------------------------------
   455                      <       P_IOA_Buf:				EQU     $59	
   456                      <       	C_IOA_Buf7:			EQU		%10000000	; Output data Latch of PORTA bit7.
   457                      <       	C_IOA_Buf6:			EQU		%01000000	; Output data Latch of PORTA bit6.
   458                      <       	C_IOA_Buf5:			EQU		%00100000	; Output data Latch of PORTA bit5.
   459                      <       	C_IOA_Buf4:			EQU		%00010000	; Output data Latch of PORTA bit4.
   460                      <       	C_IOA_Buf3:			EQU		%00001000	; Output data Latch of PORTA bit3.
   461                      <       	C_IOA_Buf2:			EQU		%00000100	; Output data Latch of PORTA bit2.
   462                      <       	C_IOA_Buf1:			EQU		%00000010	; Output data Latch of PORTA bit1.
   463                      <       	C_IOA_Buf0:			EQU		%00000001	; Output data Latch of PORTA bit0.	
   464                      <       P_IOB_Buf:				EQU     $5A           
   465                      <       	C_IOB_Buf7:			EQU		%10000000	; Output data Latch of PORTB bit7.
   466                      <       	C_IOB_Buf6:			EQU		%01000000	; Output data Latch of PORTB bit6.
   467                      <       	C_IOB_Buf5:			EQU		%00100000	; Output data Latch of PORTB bit5.
   468                      <       	C_IOB_Buf4:			EQU		%00010000	; Output data Latch of PORTB bit4.
   469                      <       	C_IOB_Buf3:			EQU		%00001000	; Output data Latch of PORTB bit3.
   470                      <       	C_IOB_Buf2:			EQU		%00000100	; Output data Latch of PORTB bit2.
   471                      <       	C_IOB_Buf1:			EQU		%00000010	; Output data Latch of PORTB bit1.
   472                      <       	C_IOB_Buf0:			EQU		%00000001	; Output data Latch of PORTB bit0.	
   473                      <       P_IOC_Buf:				EQU     $5B              
   474                      <       	C_IOC_Buf3:			EQU		%00001000	; Output data Latch of PORTC bit3.
   475                      <       	C_IOC_Buf2:			EQU		%00000100	; Output data Latch of PORTC bit2.
   476                      <       	C_IOC_Buf1:			EQU		%00000010	; Output data Latch of PORTC bit1.
   477                      <       	C_IOC_Buf0:			EQU		%00000001	; Output data Latch of PORTC bit0.	
   478                      <       P_IOD_Buf:				EQU     $5C           
   479                      <       	C_IOD_Buf2:			EQU		%00000100	; Output data Latch of PORTD bit2.
   480                      <       	C_IOD_Buf1:			EQU		%00000010	; Output data Latch of PORTD bit1.
   481                      <       	C_IOD_Buf0:			EQU		%00000001	; Output data Latch of PORTD bit0.
   482                      <       C_RAM_ADDR:				EQU		$60			; RAM Start Address
   483                      <       C_STACK_BOTTOM:			EQU		$0FF		; Stack Bottom Address 
   484                      <       
   485                      <       CB_Bit7					EQU		7			; for bit mode
   486                      <       CB_Bit6					EQU		6			;
   487                      <       CB_Bit5					EQU		5			;
   488                      <       CB_Bit4					EQU		4			;
   489                      <       CB_Bit3					EQU		3			;
   490                      <       CB_Bit2					EQU		2			;
   491                      <       CB_Bit1					EQU		1			;
   492                      <       CB_Bit0					EQU		0			;
   493                              ;**********************************************************************************
   494                              
   495                              ;**********************************************************************************
   496                              ;*																				  *
   497                              ;*      Data memory Define	                                                      *
   498                              ;*																				  *
   499                              ;**********************************************************************************
   500 00000060                     .PAGE0									;Define values in the range from 00h to FFH
   501                              ;**********************************************************************************
   502 000001E0                     .DATA									;Define data storage section
   503                              ;**********************************************************************************
   504                              ;*																				  *
   505                              ;*      	 Program Area														  *
   506                              ;*																				  *
   507                              ;**********************************************************************************
   508 0000F000                     .CODE
   509                              .INCLUDE		AD_Key.asm				;Scanning 16 keys
   510                      <       ;==================================================================================
   511                      <       ; The information contained herein is the exclusive property of
   512                      <       ; Sunplus Technology Co. And shall not be distributed, reproduced,
   513                      <       ; or disclosed in whole in part without prior written permission.
   514                      <       ;       (C) COPYRIGHT 2004   SUNPLUS TECHNOLOGY CO.                                  
   515                      <       ;                   ALL RIGHTS RESERVED
   516                      <       ; The entire notice above must be reproduced on all authorized copies.
   517                      <       ;==================================================================================
   518                      <       										
   519                      <       ;==================================================================================
   520                      <       ;	Project Name	:	
   521                      <       ;	Applied Body	:	SPMC65P2404A
   522                      <       ;	Firmware version:
   523                      <       ;	Programer		:
   524                      <       ;	Date			:	2005-1-19
   525                      <       ;	Description		:	The Program presents how to scan 16 Keys with the function 
   526                      <       ;						of ADC.
   527                      <       ;						
   528                      <       ;	Hardware Connect:	
   529                      <       ;	Link File		:	
   530                      <       ;	IDE Version		: 	V1.6.5	
   531                      <       ;	BODY Version	:	V1.7.0
   532                      <       ;==================================================================================
   533                      <       .SYNTAX  6502							;Process standard 6502 addressing syntax
   534                      <       .LINKLIST								;Generate linklist information
   535                      <       .SYMBOLS								;Generate symbolic debug information
   536                      <       ;**********************************************************************************
   537                      <       ;constant
   538                      <       CB_CmpTimers		EQU		4			;The maximum times of compare
   539                      <       ;**********************************************************************************
   540 00000060             <       .PAGE0 
   541 00000060 FF          <       GB_KeyValue			DS		1			;Keys value	
   542 00000061 FF          <       GB_KeyDownFlag		DS		1			;Keys-down flag,"1" represents down.
   543 00000062 FF          <       IB_KeyupFlag		DS		1			;Keys-up flag,"0" represents up. 
   544 00000063 FF          <       IB_KeyValue			DS		1			;Keys value	for comparing
   545 00000064 FF          <       IB_CmpTimers		DS		1			;The times of comparing
   546 000001E0             <       .DATA
   547                      <       ;**********************************************************************************
   548 0000F000             <       .CODE
   549                      <       ;==================================================================================
   550                      <       ;	Function:		F_ADKeyx16
   551                      <       ;	Description:	Scanning 16 Keys
   552                      <       ;	Input:			None
   553                      <       ;	Output:			GB_KeyValue---------Keys value
   554                      <       ;					GB_KeyDownFlag------Key-Down flag
   555                      <       ;	Destroy:		A
   556                      <       ;	Stacks:			1
   557                      <       ;==================================================================================
   558 0000F000             <       F_ADKeyx16:
   559                      <       ;----------------------------------------
   560                      <       ;AD convert
   561                      <       ;----------------------------------------
   562 0000F000 A5 28       <               lda     P_AD_Ctrl0              
   563 0000F002 29 FE       <               and		#11111110B				;start convert
   564 0000F004 85 28       <               sta     P_AD_Ctrl0
   565                      <       
   566 0000F006             <       L_TestAdcL2:
   567 0000F006 A5 28       <               lda     P_AD_Ctrl0
   568 0000F008 29 01       <       		and		#00000001B				;convertion OK ?
   569 0000F00A F0 FA       <       		beq		L_TestAdcL2				;no
   570                      <       		
   571 0000F00C A5 62       <       		lda		IB_KeyupFlag			;Key up?
   572 0000F00E D0 34       <       		bne		?L_JudgeUp				;No
   573                      <       		
   574 0000F010             <       ?L_KeyCope:
   575 0000F010 A5 2B       <       		lda		P_AD_DataHi				;AD high 8bit value
   576 0000F012 29 0F       <       		and		#$F						;\
   577 0000F014 C9 04       <       		cmp		#$4						;+
   578 0000F016 90 3E       <       		bcc		?L_CmpClr				;+ = The AD value exceed rang? yes	
   579 0000F018 C9 0C       <       		cmp		#$C						;+	 			 
   580 0000F01A B0 21       <       		bcs		?L_Keyup				;/			
   581                      <       		
   582 0000F01C A5 2B       <       		lda		P_AD_DataHi
   583 0000F01E 29 F0       <       		and		#$F0
   584 0000F020 C5 63       <       		cmp		IB_KeyValue				;Compare AD value with the last time
   585 0000F022 F0 05       <       		beq		?L_Inc					;Equal?yes
   586 0000F024 85 63       <       		sta		IB_KeyValue
   587 0000F026 4C 56 F0    <       		jmp		?L_CmpClr		
   588 0000F029             <       ?L_Inc:
   589 0000F029 E6 64       <       		inc		IB_CmpTimers			;\		
   590 0000F02B A5 64       <       		lda		IB_CmpTimers			;+ = 4-time Comparing end? no					
   591 0000F02D C9 04       <       		cmp		#CB_CmpTimers			;+						
   592 0000F02F 90 29       <       		bcc		?L_ADKeyx16Exit			;/			
   593 0000F031 A5 63       <       		lda		IB_KeyValue				;\	
   594 0000F033 4A          <       		lsr		a						;+
   595 0000F034 4A          <       		lsr		a						;+ = Get the key value
   596 0000F035 4A          <       		lsr		a						;+	
   597 0000F036 4A          <       		lsr		a						;+	
   598 0000F037 85 60       <       		sta		GB_KeyValue				;/	
   599 0000F039 A9 01       <       		lda		#1
   600 0000F03B 85 61       <       		sta		GB_KeyDownFlag			;Set the Key-down flag
   601 0000F03D             <       ?L_Keyup:		

⌨️ 快捷键说明

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