📄 afe_639.inc
字号:
#ifndef AFE_639_INC
#define AFE_639_INC
#include SPI.inc
;------------------------------------------------------------------------------+
; |
; Module AFE_639 |
; |
;------------------------------------------------------------------------------+
; |
; This class provides access to the Analog Front End. |
; |
; |
;------------------------------------------------------------------------------+
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'
;------------------------------------------------------------------------------+
; |
; AFE.Init() |
; |
;------------------------------------------------------------------------------+
; |
; 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
;------------------------------------------------------------------------------+
; |
; AFE.SendCMDClampON() |
; |
;------------------------------------------------------------------------------+
; |
; 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. |
; |
; |
; |
; Used SFRs: |
; |
; |
; Calls subroutines: |
; SPI.Write |
; |
; |
; Stacklevel: 1 |
; |
; |
; Example: |
; AFE.SendCMDClampOn |
; |
; |
; Description: |
; This sends the command |
; |
;------------------------------------------------------------------------------+
AFE.SendCMDClampON macro
banksel SPI.BufferH
movlw AFE.CMDClampOn
movwf SPI.BufferH
call SPI.Write
endm
;------------------------------------------------------------------------------+
; |
; AFE.SendCMDClampOFF() |
; |
;------------------------------------------------------------------------------+
; |
; 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. |
; |
; |
; |
; Used SFRs: |
; |
; |
; Calls subroutines: |
; SPI.Write |
; |
; |
; Stacklevel: 1 |
; |
; |
; Example: |
; AFE.SendCMDClampOff |
; |
; |
; Description: |
; This sends the command |
; |
;------------------------------------------------------------------------------+
AFE.SendCMDClampOFF macro
banksel SPI.BufferH
movlw AFE.CMDClampOff
movwf SPI.BufferH
call SPI.Write
endm
;------------------------------------------------------------------------------+
; |
; AFE.SendCMDSleep() |
; |
;------------------------------------------------------------------------------+
; |
; 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. |
; |
; |
; |
; Used SFRs: |
; |
; |
; Calls subroutines: |
; SPI.Write |
; |
; |
; Stacklevel: 1 |
; |
; |
; Example: |
; AFE.SendCMDSleep |
; |
; |
; Description: |
; This sends the command |
; |
;------------------------------------------------------------------------------+
AFE.SendCMDSleep macro
banksel SPI.BufferH
movlw AFE.CMDSleep
movwf SPI.BufferH
call SPI.Write
endm
;------------------------------------------------------------------------------+
; |
; AFE.SendCMDAGCPresON() |
; |
;------------------------------------------------------------------------------+
; |
; This macro sends a AGC Preserve On command to the AFE by using the |
; SPI-Bus. |
; |
; |
; |
; Used SFRs: |
; |
; |
; Calls subroutines: |
; SPI.Write |
; |
; |
; Stacklevel: 1 |
; |
; |
; Example: |
; AFE.SendCMDAGCPresON |
; |
; |
; Description: |
; This sends the command |
; |
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -