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

📄 fm_drv.msa

📁 5807收音机模块用于炬力平台
💻 MSA
字号:
         module   FM_I2CDRV/******************************************************************	FM Driver for C to call.	by  Allen	20081023          V0.01*******************************************************************///为3951准备的汇编与C的转接口//==================================================================public  FM_Initpublic  FM_Exitpublic  FM_SetFreqpublic  FM_MUTEpublic  FM_Standbypublic  FM_Searchpublic  FM_GetStatuspublic  FM_VolumeSetextern  FM_INIT_Drvextern  FM_EXIT_Drvextern  FM_SETFREQ_Drvextern  FM_SEARCH_Drvextern  FM_SETMUTE_Drvextern  FM_STANDBY_Drvextern  FM_STEREO_Drvextern  FM_GETSTATUS_Drvextern  FM_VolumeSet_Drvextern  FM_resultextern  WSET_XTAL//==================================================================    RSEG    FM_CTRL_Dbuffer      defs    5   //方便I2C进行操作定义一个临时存放一些频率信息或其他操作命令的buffer/*******************************************************************Function prototype:	bool FM_Init(m_FMPlaystatus.mode,SearchLevel)INPUT:  1.Byte Bandmode(0x01=JP;0x00=US)        2.Byte Searchlevel(default 0x0b)OUTPUT: 1 = true;0 = false*******************************************************************/FM_Init:        PUSH    DE        PUSH    HL        LD      HL,LWRD buffer        LD      A,E                 //band info.        LD      (HL),A        INC     HL        LD      A,C                 //search lev        LD      (HL),A        INC     HL        LD	DE,LWRD WSET_XTAL        LD	A,(DE)        LD      (HL),A              //Crystal set        INC	HL        LD	(HL),A              //buffer byte4 clear        INC	HL        LD	(HL),A              //buffer byte5 clear        LD      DE,LWRD buffer        CALL    LWRD FM_INIT_Drv     //INitialization FM        LD      A,(LWRD FM_result)        POP     HL        POP     DE        RET/*******************************************************************Function prototype:	FM_Exit();INPUT:  OUTPUT: *******************************************************************/FM_Exit:        PUSH    AF        CALL    LWRD FM_EXIT_Drv     //disable bus        POP     AF        RET/*******************************************************************Function prototype:	bool FM_SetFreq(Tempfreq<<6 +0x0010)INPUT:  1.Word Tempfreq(US mode:0~210,the corresponding frequncy = Tempfreq*0.1+87 )		       (JP mode:0~140,the corresponding frequncy = Tempfreq*0.1+76)OUTPUT: 1 = true;0 = false*******************************************************************/FM_SetFreq:        PUSH    DE        PUSH    HL        LD      HL,LWRD buffer      //buffer中为频率值,2byte buffer[E,D,...]      	LD	(HL),E              //Low byte        INC     HL        LD      (HL),D              //High byte        LD      DE,LWRD buffer        CALL    LWRD FM_SETFREQ_Drv        LD      A,(LWRD FM_result)        POP     HL        POP     DE        RET/*******************************************************************Function prototype:	FM_MUTE(para);INPUT:  1.Byte para(0x00=mute 0x01 = release mute)OUTPUT: 1 = true;0 = false*******************************************************************/FM_MUTE:        PUSH   DE        LD      A,E        CALL    LWRD FM_SETMUTE_Drv        LD      A,(LWRD FM_result)        POP     DE        RET/*******************************************************************Function prototype:	FM_Standby(void);INPUT:  OUTPUT: 1 = true;0 = false*******************************************************************/FM_Standby:        PUSH    DE        LD      DE,LWRD buffer        LD      A,00H        LD      (DE),A        CALL    LWRD FM_STANDBY_Drv        LD      A,(LWRD FM_result)        POP     DE        RET/*******************************************************************Function prototype:	FM_Search(Tempfreq<<6 +0x0010,Direct);INPUT:  1.Word Tempfreq(US mode:0~210,the corresponding frequncy = Tempfreq*0.1+87 )		       (JP mode:0~140,the corresponding frequncy = Tempfreq*0.1+76)	2.Direct  search up or search down,0 = down;1= upOUTPUT: 1 = true;0 = false*******************************************************************/FM_Search:        PUSH    DE        PUSH    HL        LD      HL,LWRD buffer          //buffer中为频率值,2byte        LD      (HL),E        INC     HL        LD      (HL),D        INC     HL        LD      A,C        LD      (HL),A                  // Search direct        LD      DE,LWRD buffer        CALL    LWRD FM_SEARCH_Drv        LD      A,(LWRD FM_result)        POP     HL        POP     DE        RET/*******************************************************************Function prototype:	FM_GetStatus(&d_FMStatus)INPUT:  an address which you want to restore the data you have read        from FM	OUTPUT: 1 = true;0 = false*******************************************************************/FM_GetStatus:        PUSH   DE        LD      DE,LWRD buffer        CALL    LWRD FM_GETSTATUS_Drv        LD      HL,LWRD buffer        POP     DE        LD      A,(HL)        LD      (DE),A        INC     DE        INC     HL        LD      A,(HL)        LD      (DE),A        INC     HL        INC     DE        LD      A,(HL)        LD      (DE),A        LD      A,(LWRD FM_result)        RET/*******************************************************************Function prototype:	FM_VolumeSet((BYTE)param);INPUT:  1.param volume level(0~31)	OUTPUT: 1 = true;0 = false*******************************************************************/FM_VolumeSet:        PUSH    DE        LD      A,E        LD      DE,LWRD buffer        LD      (DE),A        CALL    LWRD FM_VolumeSet_Drv        LD      A,(LWRD FM_result)        POP     DE        RET//==============================================        END

⌨️ 快捷键说明

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