最近在调试LDC1000,使用的MCU是STC12C5A60S2 。我依照MSP430的例子写了如下的程序。但是搞不清楚INT和LDCLK这两个引脚的用法。请大家帮忙解决。
附上我的程序片段。
/**************写入初始化的命令***********/
SPI_RW_Reg(RPmax,0x13);
SPI_RW_Reg(RPmin,0x3a);
SPI_RW_Reg(SensorFre ,0x94);
SPI_RW_Reg(LDCConfig,0x17);
SPI_RW_Reg(ClockConfig,0x00);
SPI_RW_Reg(IntPinConfig,0x02);
SPI_RW_Reg(ComThrHL,0x50);
SPI_RW_Reg(ComThrHM,0x14);
SPI_RW_Reg(ComThrLL,0xc0);
SPI_RW_Reg(ComThrLM,0x12);
SPI_RW_Reg(PowerConfig,0x01);
SPI_Read_Buf(DeviceID,&orgVal[0],12);
while(1)
{
SPI_Read_Buf(ProDataL,&proximtyData[0],2); SPI_Read_Buf(FreCouDataL,&frequencyData[0],3);
proximtyDataMAX = ((unsigned char) proximtyData[1]<<8) + proximtyData [0];
frequencyDataMAX = ((unsigned char)frequencyData[1]<<8) + frequencyData[0];
proximtyDataMIN = proximtyDataMAX;
frequencyDataMIN = frequencyDataMAX;
for (i=0;i<100;i++)
{
SPI_Read_Buf(ProDataL,&proximtyData[0],2); SPI_Read_Buf(FreCouDataL,&frequencyData[0],3);
proximtyDataTEMP = ((unsigned char)proximtyData[1]<<8) + proximtyData [0];
frequencyDataTEMP = ((unsigned char)frequencyData[1]<<8) + frequencyData[0];
if (proximtyDataTEMP < proximtyDataMIN)
proximtyDataMIN = proximtyDataTEMP;
if (frequencyDataTEMP < frequencyDataMIN)
frequencyDataMIN = frequencyDataTEMP;
if (proximtyDataTEMP > proximtyDataMAX)
proximtyDataMAX = proximtyDataTEMP;
if (frequencyDataTEMP > frequencyDataMAX)
frequencyDataMAX = frequencyDataTEMP;
}
cheng hang:
这个程序能读到ID 吗- – 我用MSP430读错
weihao king:
回复 cheng hang:
不能读到ID 设备适配到51上INT和LDCLK引脚还搞不大清楚
QIUPING GUO:
回复 weihao king:
INT 中断脚.,LDCLK 时种脚
weihao king:
回复 QIUPING GUO:
那请问 LDCLK的时钟频率应该是多少呢?
QIUPING GUO:
回复 weihao king:
看你需求吧.数据表没给出明确说明.怒是用在那方面的?
weihao king:
回复 QIUPING GUO:
测试距离 1Mhz的分频可以吗? 还有INTB引脚一定要用吗?
weihao king:
回复 Sunny Qin:
恩 好的 谢谢