下面是写的程序,粘到记事本里看,百度上显得乱。
/* ADS8344 */
#define uchar unsigned char
#define uword unsigned int
sbit ADS_SHDN =
sbit ADS_CS =
sbit ADS_DCLK =
sbit ADS_DIN =
sbit ADS_BUSY =
sbit ADS_DOUT =
// (MSB) (LSB)
// BIT7 BIT6 BIT5 BIT4 BIT3 BIT2 BIT1 BIT0
// SA2 A1 A0 —SGL/DIF PD1 PD0
void ads_com(uchar ads_comchar)
{
uchar i=0
for (i=8i>0i--)
{
ADS_DIN = ads_comchar&0x80//取最高位
ADS_DCLK = 0
ADS_DCLK = 1
ads_comchar<<=1//左移数据
}
}
// (MSB)(LSB)
// BIT15 ...... BIT0
uword ads_dat(void)
{
uword ads_datword = 0
uchar i=0
for (i=16i>0i--)
{
ads_datword<<=1//左移数据
ADS_DCLK = 0
if(DOUT==1) ads_datword = ads_datword|0x01//最低位或
ADS_DCLK = 1
}
return(ads_datword)
}
void main()
{
uword ADS_DataWord = 0
ADS_SHDN = 1
ADS_CS = 1
ADS_DCLK = 0
ADS_CS = 0
// SA2 A1 A0 —SGL/DIF PD1 PD0
// 1000— 1 11
ads_com(0x87)//10000111
ADS_DCLK = 0
ADS_DCLK = 1
while(ADS_BUSY == 1)
ADS_DataWord = ads_dat()
ADS_CS = 1
while(1)
}
设计了利用TMS320LF2407A 与EPM3032A 控制的ADS7805 多通道采集系统的逻辑结构,介绍了系统的工作原理,详细描述了ADS7805、DSP 及CPLD 之间接口的硬件与软
件设计。
关键词 DSP;CPLD;ADS7805
Abstract This paper designs a logic system structure of ADS7805 muli-channel data acquisition based on TMS320LF2407A and EPM3032A, explains the system’s execution principle and decribes the hardware、software design for the interfaces among ADS7805、DSP and CPLD in details.
Keywords DSPCPLDADS7805
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)