📄 ad7877.c
字号:
/***************************************************************************** * AD7877.c
* Frank.liux 2008-12-17 *****************************************************************************/#include "..\include\AD7877.h"
#include "..\include\AD7877_Register.h"
//````````````````````````````````````````````````````````````````````
// Programmed AD7877
//````````````````````````````````````````````````````````````````````
//````````````````````````````````````````````````````````````````````
void AD7877_Init (void)
{
/* prepare AD7877;*/
/*conversion interval timer 8.194ms ;internal reference; Indicates polarity of signal on STOPACQ pin active high
first conversion delay1.024 ms;ADC and reference powered up continuously;ADC acquisition time16 μs;
4 measurements per channel averaged*/
AD7877_Program (AD7877_CONTROL_REG2,
AD7877_TMR_3+
AD7877_POL+
AD7877_PM_2+
AD7877_ACQ_3+
AD7877_AVG_1
);
/*X+ and Y+ in convert Sequencer*/
AD7877_Program (AD7877_SEQUENCER_REG1,
AD7877_XPOS_MS+
AD7877_YPOS_MS
);
/*refer to AD7877 datasheet Page 20 ,it's said that: Control register 1 should be programmed at last.
Master Mode ;the first read register start at X+ REG;Ratiometric Method */
AD7877_Program (AD7877_CONTROL_REG1,
AD7877_MODE_3+
X
);
}//````````````````````````````````````````````````````````````````````
// The Main Function
//````````````````````````````````````````````````````````````````````
//````````````````````````````````````````````````````````````````````
void main ( void) {
// Set_PLL (22,5);
//Set_PLL(); would set the Core clock and system clock ,if you do not want to do so ,the defult value will be
//CCLK = 250Mhz SCLK = 50Mhz
Initial_SPI0 ();
AD7877_Init ();
Initial_AD7877_Interrupt ();
while(1); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -