|
51例程
sbit HX711_DOUT=P1^3;
sbit HX711_SCK =P1^4;
unsigned long HX711_Read(void)
unsigned long count;
unsigned char i;
HX711_DOUT=1;
Delay__hx711_us();
HX711_SCK=0;
count=0;
while(HX711_DOUT);
for(i=0;i<24;i++)
{
HX711_SCK=1;
count=count<<1;
HX711_SCK=0;
if(HX711_DOUT)
count++;
}
HX711_SCK=1;
count=count^0x800000;
Delay__hx711_us();
HX711_SCK=0;
return(count);
}
|
|