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

📄 main.asm

📁 采用6502内核单片机,结合无线通讯模块的无线通讯方案,含Asm代码.
💻 ASM
字号:
;==================================================================================
; The information contained herein is the exclusive property of
; Sunplus Technology Co. And shall not be distributed, reproduced,
; or disclosed in whole in part without prior written permission.
;       (C) COPYRIGHT 2004   SUNPLUS TECHNOLOGY CO.                                  
;                   ALL RIGHTS RESERVED
; The entire notice above must be reproduced on all authorized copies.
;==================================================================================
										
;==================================================================================
;	Project Name	:	
;	Applied Body	:	SPMC65P2404A
;	Firmware version:
;	Programer		:
;	Date			:	2005-1-21
;	Description		:	The program present an example of communication with RF.
;						
;	Hardware Connect:	
;	Link File		:	
;	IDE Version		: 	V1.6.5	
;	BODY Version	:	V1.0.0A
;==================================================================================

.SYNTAX  6502							;Process standard 6502 addressing syntax
.LINKLIST								;Generate linklist information
.SYMBOLS								;Generate symbolic debug information
;************************************************************************************
;*																					*
;*      System Register Define														*
;*																					*
;************************************************************************************
.INCLUDE		SPMC65P2404A.inc				;Define all hardware,Registers and ports. 
;************************************************************************************
;************************************************************************************
;*																					*
;*      Data memory Define	                                                        *
;*																					*
;************************************************************************************
.PAGE0									;Define values in the range from 00h to FFh
;************************************************************************************
.DATA									;Define data storage section           
;************************************************************************************																				*
;*      	 Program Area															*
;***********************************************************************************
.CODE            
.INCLUDE		RF.asm           
;************************************************************************************
;*																					*
;*      Power on Reset Process	                                                    *
;*																					*
;************************************************************************************
V_Reset:
		sei									;Disable interrupt
		ldx		#C_STACK_BOTTOM				;Initial stack pointer at $00FF
		txs									;Transfer to stack point  

		jsr		F_RF_Init
		
		cli
F_Main:                  
		ldx		#0
?L_Loop:		
		lda 	P_INT_Flag2
		and 	#C_INT_ITVALIF				;Check Timer base INT?
		beq 	?L_Loop 					;No
		lda 	#C_INT_ITVALIF
		sta 	P_INT_Flag2 				;Clear INT request flag
		inx
		cpx		#4							;4 ms coming?
		bcc		?L_Loop						;no

		jsr		F_Key						;Key scanning
		jsr		F_Light						;LED showing
		
		jsr		F_Lock						;Initialize sending
		jsr		F_Send_Data_Head			;Send indexical data and starting bit
		
		jsr		F_Receive_Init				;Initialize receiving

		lda		GB_KeyDownFlag				;Key down?
		beq		?L_Main_Exit				;yes
		lda		#0
		sta		GB_KeyDownFlag	

		jsr		F_Send_Init	
		
?L_Main_Exit:		
		jmp		F_Main			
					
;************************************************************************************
;*																					*
;*      Interrupt Service Process                         	                        *
;*																					*
;************************************************************************************
V_INT:      						
		pha
		txa
		pha
		tya
		pha
?_CAP1_end:
		lda		P_INT_Flag0
		and		#C_INT_IRQ1IF				;CAP3 INT?
		beq		?L_T1						;NO
		
		;--------------------------------------------------------	
		;CAP3 interrupt process service
		nop
		nop
		jsr		F_Receive
		
		lda		P_INT_Flag0
		ora		#C_INT_IRQ1IF				;clear CAP3 flag
		sta		P_INT_Flag0
		;--------------------------------------------------------	
		;T3 interrupt process service
?L_T1:
		lda		P_INT_Flag1
		and		#C_INT_T3OIF				;T3 INT?
		beq		?V_INT_End					;NO
		
		;--------------------------------------------------------	
		;send datas process service
		lda		GB_Send_Flag
		and		#C_Send_Allow
		beq		?V_INT_End

		jsr		F_Send_Data_Start			;Send starting bit
		jsr		F_Send_Data					;Send ID word and datas
		
		jmp		?L_T1_clear
		
?L_T1_clear:		
		lda		#C_INT_T3OIF
		sta		P_INT_Flag1					;clear T1 flag

?V_INT_End:
		pla
		tay
		pla	
		tax
		pla	
		rti  
		
V_NMI:
		rti
;************************************************************************************
;*																					*
;*      Interrupt Vector Table														*
;*																					*
;************************************************************************************
VECTOR		.SECTION
		DW		V_NMI						;Non-mask interrupt vector(no use)
		DW		V_Reset						;Reset vector
		DW		V_INT						;INT interrupt vector
;************************************************************************************
;*																					*
;*      End of Interrupt Vector Table												*
;*																					*
;************************************************************************************
.END

⌨️ 快捷键说明

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