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

📄 zero_detect.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.
;==================================================================================
																					
;==================================================================================
;  Program Name		:	F_Light.asm
;  Description		:	Initialize the system	 
;  Reference		:	SPMC65P2404A/2408A Data Sheet
;  Revision history	:
;---------------------------------------------------------------------------------- 
;  Version		Date 		Description
;  1.0.0    	2004-11-13	First Edition
;==================================================================================

.SYNTAX  6502								;Process standard 6502 addressing syntax
.LINKLIST									;Generate linklist information
.SYMBOLS									;Generate symbolic debug information
;**********************************************************************************
;constant
;**********************************************************************************
.PAGE0 
IB_10msCount		DS		1				;10ms counting
.DATA
;**********************************************************************************
.CODE
;==================================================================================
;	Function:		F_Light
;	Description:	shows the point of zero-cross of AC220V
;	Input:			none
;	Output:			none
;	Destroy:		A
;	Stacks:			1
;==================================================================================
F_Light:	
		inc		IB_10msCount
		lda		IB_10msCount
		and		#$3F
		sta		IB_10msCount
		
		lda		P_IOA_Buf
		and		#$C0
		ora		IB_10msCount
		sta		P_IOA_Data
		sta		P_IOA_Buf
		rts              

;====================================================================
;	Function:		F_IRQ0_Init
;	Description:	Initialize IRQ0 interrupt at PB4 with rising edge
;	Input:			none
;	Output:         none
;	Destroy:		A
;	Stacks:			1
;====================================================================
F_IRQ0_Init:	      
        lda     #C_IRQOpt1_IRQ0ES       ;IRQ0 rising edge
        sta     P_IRQ_Opt1              
        sta     P_IRQ_Opt1              
        lda		#$FF
        sta		P_INT_Flag0				;clear INT request flag
        lda     #C_INT_IRQ0IE            ;IRQ0 INT enable bit
        sta		P_INT_Ctrl0		
    	rts
    	
;====================================================================
;	Function:		F_IO_Init
;	Description:	Initialize PA5~PA0 as output,PB4 as input
;	Input:			none
;	Output:         none
;	Destroy:		A
;	Stacks:			1
;====================================================================
F_IO_Init:	
        lda		P_IOA_Buf
        and		#$C0
        sta		P_IOA_Data
        sta		P_IOA_Buf

        lda		P_IOA_Attrib           	
        and		#$C0
        sta		P_IOA_Attrib  
             
        lda		P_IOA_Dir           	
        ora		#$3F
        sta		P_IOA_Dir  
        
        lda		P_IOB_Dir
        and		#$EF
        sta		P_IOB_Dir
        
        lda		P_IOB_Attrib
        and		#$EF
        sta		P_IOB_Attrib
        
        lda		P_IOB_Buf
        and		#$EF
        sta		P_IOB_Data
        sta		P_IOB_Buf
          
        rts	

⌨️ 快捷键说明

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