#define cs 2//CS1180片选,低电平有效
#define sdi3//CS1180数据输入
#define sdo4//CS1180数据输出
#define sclk5//CS1180时钟
#define drdy6//CS1180数据准备就绪,低电平有效
//写一个字节
void WriteSPI_CS1180(unsigned char DData)
{
unsigned char i;
//sclk=HIGH;
digitalWrite(sclk,HIGH);
for(i=8;i>0;i--)
{
//sdi=(bit)(DData & 0x80);
digitalWrite(sdi,highByte(DData & 0x80));
DData<<=1;
//sclk=LOW;
digitalWrite(sclk,LOW);
//Delay5us();
delayMicroseconds(5);
//sclk=HIGH;
digitalWrite(sclk,HIGH);
//Delay5us();
delayMicroseconds(5);
}
}
//读一个字节
unsigned char ReadSPI_CS1180(void)
{
unsigned char tempdata=0;
unsigned char i=0;
//sclk=HIGH;
digitalWrite(sclk,HIGH);
for(i=8;i>0;i--)
{
tempdata<<=1;
//sclk=LOW;
digitalWrite(sclk
cs1180的arduino驱动程序
最新推荐文章于 2022-03-30 15:29:03 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)