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

📄 system.asm

📁 具有原始语音播放功能
💻 ASM
字号:
//======================================================
//  The information contained herein is the exclusive property of
//  Sunnnorth Technology Co. And shall not be distributed, reproduced,
//  or disclosed in whole in part without prior written permission.
//  (C) COPYRIGHT 2003  SUNNORTH TECHNOLOGY CO.
//  ALL RIGHTS RESERVED
//  The entire notice above must be reproduced on all authorized copies.
//========================================================

//========================================================
//  Filename:       SerialPort.asm      
//  Version:        1.0.0 		
//  Date:           2003-8-19
//  Applied body:   unsp serial
//  Description:    
//  Revision history:
//  ----------------------------------------------------------------------------------------
//  Version, YYYY-MM-DD-Index, File-Name: Modified By, Description
//  ----------------------------------------------------------------------------------------
//
//============================================================
.INCLUDE hardware.inc;
.INCLUDE key.inc;	
.define TIMER_DATA_FOR_NKHZ (0xffff - 4100)
.PUBLIC    _User_Init_IO
.PUBLIC    F_User_Init_IO
.PUBLIC    F_System_Init
.PUBLIC    _System_Init
.external  R_InterruptStatus
		                  //包含键盘的API
.code
//======================================================
// Function Name:	F_System_Init
// Description:		Initial key and port.
// Input:			None
// Output:			None
// Destroy:			None;
// Used:			None;
// Stacks:			0;
//======================================================
_System_Init:
F_System_Init:
     r1=0x0020
	 [P_SystemClock]=r1		 
     call F_User_Init_IO;	               //初始化IO口
	 retf
		
//======================================================
// Function Name:	F_User_Init_IO
// Description:		Initial key and port.
// Input:			None
// Output:			None
// Destroy:			None;
// Used:			None;
// Stacks:			0;
//======================================================
_User_Init_IO:		
F_User_Init_IO:
		r1 = 0x0000;					//A口为输入
        [P_IOA_Dir] = r1;				// 
        [P_IOA_Attrib] = r1;
        [P_IOA_Data] = r1;       
		retf;		
//============================================================================================
//函数: System_ServiceLoop
//语法:System_ServiceLoop()
//描述:键盘扫描和清看门狗
//参数:无
//返回:无
//==============================================================================================
.public _System_ServiceLoop;
.public	F_System_ServiceLoop;
_System_ServiceLoop: .PROC                  
F_System_ServiceLoop:
		R1=0x0001;                          // 清看门狗
		[P_Watchdog_Clear]=R1;       	    //
        retf;
        .ENDP;
//============================================================================================
//函数: Init_ADC_DAC
//语法:Init_ADC_DAC()
//描述:ADC,DAC初始化
//参数:无
//返回:无
//=============================================================================================
.PUBLIC F_Init_ADC_DAC 
.PUBLIC _Init_ADC_DAC
F_Init_ADC_DAC:
_Init_ADC_DAC:
		INT OFF;	   
		R1 = 0x0030; 				// 时钟频率为CLKA的Fosc/2
		[P_TimerA_Ctrl] = R1;		//
		R1 = TIMER_DATA_FOR_NKHZ; 	// 根据声音情况调整采样率
		[P_TimerA_Data] = R1;		//
		
		R1 = 0x007d;				// 设置AGC |DAC=2mA |ADE=1
		[P_ADC_Ctrl] = R1;			// 采用自动方式、且通过MIC_IN通道输入,
				
					
	    R1 = 0x00A8;
		[P_DAC_Ctrl] = R1;			//通过定时器A的溢出锁存数据,ADC为自动方式	
		R1 = 0x1000;				//
		[P_INT_Ctrl] = R1;			// 开中断IRQ1_TM		
		INT IRQ;
		retf;

⌨️ 快捷键说明

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