5800.asm

来自「153控制收音5800的源码」· 汇编 代码 · 共 88 行

ASM
88
字号
include "5800.inc"
;===============================================
;	Function:FmTune check fm Frequency 
;===============================================
FmTune:
	 	call		I2cStart

		; Device Id : (A = I2cDevId)
		mov		A,@0x20
		call 		I2cSendByte
		call		I2cGetAck
		jbs		A_buff,ACK
		jmp		FmTuneDone1


		mov		a,Rd5800_Reg_02H
		call 		I2cSendByte
		call		I2cGetAck
		jbs		A_buff,ACK
		jmp		FmTuneDone1

		mov		a,Rd5800_Reg_02L
		call 		I2cSendByte
		call		I2cGetAck
		jbs		A_buff,ACK
		jmp		FmTuneDone1

		mov		a,Rd5800_Channel
		call 		I2cSendByte
		call		I2cGetAck
		jbs		A_buff,ACK
		jmp		FmTuneDone1

		mov		a,Rd5800_Reg_03L
		call 		I2cSendByte
		call		I2cGetAck
		jbs		A_buff,ACK
		jmp		FmTuneDone1
FmTuneDone1:
		call		I2cStop
		mov		A,A_buff
	
		ret



;===============================================
;	Function:5800_init_I2c(I2cAddr,I2cData)
;===============================================
R5800_Init_I2c:
	 	call		I2cStart

		; Device Id : (A = I2cDevId)
		mov		A,@0x20
		call 		I2cSendByte
		call		I2cGetAck
		jbs		A_buff,ACK
		jmp		I2cWriteDone1

		mov		a,@0x00
		mov		I2cAddr,a
con_init_i2c:
		mov		a,I2cAddr
		call		TblFmDefault_bal
		call 		I2cSendByte
		call		I2cGetAck
		jbs		A_buff,ACK
		jmp		I2cWriteDone1

		inc		I2cAddr
		mov		a,I2cAddr
		sub		a,@0x56
		jbs		FLAG,@Z
		jmp		con_init_i2c
		; return true!
		mov		A,@1
		NOP
I2cWriteDone1:
		call		I2cStop
		mov		A,A_buff

	ret

;===============================================
;	Function:SetFmMode(A=FM_MODE)
;===============================================	

⌨️ 快捷键说明

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