#include<io430.h>
#include "oled.h"
#include "bmp.h"
#include "Config.h"
#include "fdc2214.h"
#include "iic.h"
void OLED_JM0(void);
int main( void )
{
WDTCTL = WDTPW + WDTHOLD;
u8 retVal=0;
unsigned int id;
unsigned long Buffer[4]={0};
IIC_Init();
OLED_Init(); //初始化OLED
OLED_Clear();
OLED_ShowString(0,0," FDC2214_Demo ");
do
{
retVal = 0;
retVal = FDC2214_init(); //初始化FDC2214
if(retVal==1)OLED_ShowString(2,2," Init Success ");
if(retVal==0)OLED_ShowString(2,2," Init defeated ");
id=MPU_Read_2Byte(0x2A,LDC13xx16xx_CMD_DEVID);//读设备ID
OLED_ShowString(0,4,"FDC_ID:0X");
OLED_ShowNum(72,4,id,4,16);//显示ASCII字符的码值
}while (retVal!=1);
delay_ms(1000);
OLED_Clear();delay_ms(100);
OLED_ShowString(0,0,"CH0: pf");
OLED_ShowString(0,2,"CH1: pf");
OLED_ShowString(0,4,"CH2: pf");
OLED_ShowString(0,6,"CH3: pf");
while(1)
{
evm_processDRDY(Buffer);//读取电容值电容的值
OLED_ShowNum(32,0,Buffer[0],9,16);//显示电容的值
OLED_ShowNum(32,2,Buffer[1],9,16);//显示电容的值
OLED_ShowNum(32,4,Buffer[2],9,16);//显示电容的值
OLED_ShowNum(32,6,Buffer[3],9,16);//显示电容的值
LED_Clr();
delay_ms(10);
LED_Set();
delay_ms(10);
}
}
void OLED_JM0(void)
{
OLED_DrawBMP(0,0,128,8,BMP1); //图片显示(图片显示慎用,生成的字表较大,会占用较多空间,FLASH空间8K以下慎用)
}
|