📄 afe_639.inc
字号:
#ifndef AFE_639_INC
#define AFE_639_INC
#include SPI.inc
;/*
; The RAM-Map of the AFE's configuration register (8 byte)
;*/
extern AFE.ConfMap
extern AFE.Buffer
extern AFE.LoadCfg, AFE.SafeCfg, AFE.ReadCfg, AFE.WriteCfg, AFE.WriteRegister, AFE.ReadRegister, AFE.WriteNVerifyRegister
extern AFE.CalcColumnParity
#define AFE.Alert PORTC,2 ; SPI Clock Output
#define AFE.CMDClampOn B'00000000'
#define AFE.CMDClampOff B'00100000'
#define AFE.CMDSleep B'01000000'
#define AFE.CMDAGCOn B'01100000'
#define AFE.CMDAGCOff B'10000000'
#define AFE.CMDSR B'10100000'
#define AFE.ModDepth12 B'00110000'
#define AFE.ModDepth25 B'00100000'
#define AFE.ModDepth75 B'00010000'
#define AFE.ModDepth50 B'00000000'
;/*
;
; This macro initialises the AFE
;
;*/
AFE.Init macro
call AFE.LoadCfg
call AFE.WriteCfg
; call AFE.ReadCfg
AFE.SendCMDSoftReset
banksel PORTA ;just debugging
btfss AFE.Alert
goto $-1
endm
;/*
;
; This macro sends a clamp on command to the AFE by using the SPI-Bus.
; The clamp on command switches the transistor at the LF-Input to low resistance.
; So use this macro for LF-Talkback.
;
;
; @example
; AFE.SendCMDClampOn
; @end-ex
; @ex-desc This sends the command
;
; @status Tested
;
; @stacklevel /*/SPI.Write
; @registers /*/SPI.Write
; @calls SPI.Write /*/SPI.Write
;
;
;*/
AFE.SendCMDClampON macro
banksel SPI.BufferH
movlw AFE.CMDClampOn
movwf SPI.BufferH
call SPI.Write
endm
;/*
;
; This macro sends a clamp off command to the AFE by using the SPI-Bus.
; The clamp on command switches the transistor at the LF-Input to high resistance.
; So use this macro for LF-Talkback.
;
;
; @example
; AFE.SendCMDClampOff
; @end-ex
; @ex-desc This sends the command
;
; @status Tested
;
; @stacklevel /*/SPI.Write
; @registers /*/SPI.Write
; @calls SPI.Write /*/SPI.Write
;
;
;*/
AFE.SendCMDClampOFF macro
banksel SPI.BufferH
movlw AFE.CMDClampOff
movwf SPI.BufferH
call SPI.Write
endm
;/*
;
; This macro sends a Sleep command to the AFE by using the SPI-Bus.
; The AFE will enter the sleep mode.
; It will wake up by the next transmission over the SPI-Bus.
;
;
; @example
; AFE.SendCMDSleep
; @end-ex
; @ex-desc This sends the command
;
; @status Written
;
; @stacklevel /*/SPI.Write
; @registers /*/SPI.Write
; @calls SPI.Write /*/SPI.Write
;
;
;*/
AFE.SendCMDSleep macro
banksel SPI.BufferH
movlw AFE.CMDSleep
movwf SPI.BufferH
call SPI.Write
endm
;/*
;
; This macro sends a AGC Preserve On command to the AFE by using the SPI-Bus.
;
;
; @example
; AFE.SendCMDAGCPresON
; @end-ex
; @ex-desc This sends the command
;
; @status Written
;
; @stacklevel /*/SPI.Write
; @registers /*/SPI.Write
; @calls SPI.Write /*/SPI.Write
;
;
;*/
AFE.SendCMDAGCPresON macro
banksel SPI.BufferH
movlw AFE.CMDAGCOn
movwf SPI.BufferH
call SPI.Write
endm
;/*
;
; This macro sends a AGC Preserve Off command to the AFE by using the SPI-Bus.
;
;
; @example
; AFE.SendCMDAGCPresOFF
; @end-ex
; @ex-desc This sends the command
;
; @status Tested
;
; @stacklevel /*/SPI.Write
; @registers /*/SPI.Write
; @calls SPI.Write /*/SPI.Write
;
;
;*/
AFE.SendCMDAGCPresOFF macro
banksel SPI.BufferH
movlw AFE.CMDAGCOff
movwf SPI.BufferH
call SPI.Write
endm
;/*
;
; This macro sends a SoftReset on command to the AFE by using the SPI-Bus.
;
; @example
; AFE.SendCMDSoftReset
; @end-ex
; @ex-desc This sends the command
;
; @status Tested
;
; @stacklevel /*/SPI.Write
; @registers /*/SPI.Write
; @calls SPI.Write /*/SPI.Write
;
;
;*/
AFE.SendCMDSoftReset macro
banksel SPI.BufferH
movlw AFE.CMDSR
movwf SPI.BufferH
call SPI.Write
endm
;/*
;
; This macro enables the LF Channel X at the AFE.
;
; @example
; AFE.EnableChannelX
; @end-ex
; @ex-desc This enables Channel X
;
; @status Written
;
; @stacklevel /*/AFE.WriteRegister /*/AFE.updateColumnParity
; @registers /*/AFE.WriteRegister /*/AFE.updateColumnParity
; @calls AFE.WriteRegister /*/AFE.WriteRegister AFE.updateColumnParity /*/AFE.updateColumnParity
;
;
;*/
AFE.EnableChannelX macro
banksel AFE.ConfMap
movf AFE.ConfMap,w
andlw b'11111110'
movwf AFE.ConfMap
movlw 0x00
call AFE.WriteRegister
AFE.updateColumnParity
endm
;/*
;
; This macro enables the LF Channel Y at the AFE.
;
; @example
; AFE.EnableChannelY
; @end-ex
; @ex-desc This enables Channel Y
;
; @status Written
;
; @stacklevel /*/AFE.WriteRegister /*/AFE.updateColumnParity
; @registers /*/AFE.WriteRegister /*/AFE.updateColumnParity
; @calls AFE.WriteRegister /*/AFE.WriteRegister AFE.updateColumnParity /*/AFE.updateColumnParity
;
;
;*/
AFE.EnableChannelY macro
banksel AFE.ConfMap
movf AFE.ConfMap,w
andlw b'11111101'
movwf AFE.ConfMap
movlw 0x00
call AFE.WriteRegister
AFE.updateColumnParity
endm
;/*
;
; This macro enables the LF Channel Z at the AFE.
;
; @example
; AFE.EnableChannelZ
; @end-ex
; @ex-desc This enables Channel Z
;
; @status Written
;
; @stacklevel /*/AFE.WriteRegister /*/AFE.updateColumnParity
; @registers /*/AFE.WriteRegister /*/AFE.updateColumnParity
; @calls AFE.WriteRegister /*/AFE.WriteRegister AFE.updateColumnParity /*/AFE.updateColumnParity
;
;
;*/
AFE.EnableChannelZ macro
banksel AFE.ConfMap
movf AFE.ConfMap,w
andlw b'11111011'
movwf AFE.ConfMap
movlw 0x00
call AFE.WriteRegister
AFE.updateColumnParity
endm
;/*
;
; This macro disables the LF Channel X at the AFE.
;
; @example
; AFE.EnableChannelX
; @end-ex
; @ex-desc This enables Channel X
;
; @status Written
;
; @stacklevel /*/AFE.WriteRegister /*/AFE.updateColumnParity
; @registers /*/AFE.WriteRegister /*/AFE.updateColumnParity
; @calls AFE.WriteRegister /*/AFE.WriteRegister AFE.updateColumnParity /*/AFE.updateColumnParity
;
;
;*/
AFE.DisableChannelX macro
banksel AFE.ConfMap
movf AFE.ConfMap,w
iorlw 0x01
movwf AFE.ConfMap
movlw 0x00
call AFE.WriteRegister
AFE.updateColumnParity
endm
;/*
;
; This macro disables the signals below AGC-active level.
;
; @example
; AFE.EnableChannelX
; @end-ex
; @ex-desc This enables Channel X
;
; @status Written
;
; @stacklevel /*/AFE.WriteRegister /*/AFE.updateColumnParity
; @registers /*/AFE.WriteRegister /*/AFE.updateColumnParity
; @calls AFE.WriteRegister /*/AFE.WriteRegister AFE.updateColumnParity /*/AFE.updateColumnParity
;
;
;*/
AFE.AGCActive macro
banksel AFE.ConfMap
movf AFE.ConfMap+6,w
iorlw 0x10
movwf AFE.ConfMap+6
movlw 0x06
call AFE.WriteRegister
AFE.updateColumnParity
endm
;/*
;
; This macro disables the signals below AGC-active level.
;
; @example
; AFE.EnableChannelX
; @end-ex
; @ex-desc This enables Channel X
;
; @status Written
;
; @stacklevel /*/AFE.WriteRegister /*/AFE.updateColumnParity
; @registers /*/AFE.WriteRegister /*/AFE.updateColumnParity
; @calls AFE.WriteRegister /*/AFE.WriteRegister AFE.updateColumnParity /*/AFE.updateColumnParity
;
;
;*/
AFE.AGCDeactive macro
banksel AFE.ConfMap
movf AFE.ConfMap+6,w
andlw 0xef
movwf AFE.ConfMap+6
movlw 0x06
call AFE.WriteRegister
AFE.updateColumnParity
endm
;/*
;
; This macro disables the LF Channel Y at the AFE.
;
; @example
; AFE.EnableChannelY
; @end-ex
; @ex-desc This enables Channel Y
;
; @status Written
;
; @stacklevel /*/AFE.WriteRegister /*/AFE.updateColumnParity
; @registers /*/AFE.WriteRegister /*/AFE.updateColumnParity
; @calls AFE.WriteRegister /*/AFE.WriteRegister AFE.updateColumnParity /*/AFE.updateColumnParity
;
;
;*/
AFE.DisableChannelY macro
banksel AFE.ConfMap
movf AFE.ConfMap,w
iorlw 0x02
movwf AFE.ConfMap
movlw 0x00
call AFE.WriteRegister
AFE.updateColumnParity
endm
;/*
;
; This macro disables the LF Channel Z at the AFE.
;
; @example
; AFE.EnableChannelZ
; @end-ex
; @ex-desc This enables Channel Z
;
; @status Written
;
; @stacklevel /*/AFE.WriteRegister /*/AFE.updateColumnParity
; @registers /*/AFE.WriteRegister /*/AFE.updateColumnParity
; @calls AFE.WriteRegister /*/AFE.WriteRegister AFE.updateColumnParity /*/AFE.updateColumnParity
;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -