stc12c5a60s AD转换获取土壤的湿度
AD转换获取土壤的湿度 #include "reg52.h" #include "intrins.h" #define MYID 0x05 #define UPID 0x01 sfr AUXR = 0x8e ; sfr ADC_CONTR = 0xBC ; sfr ADC_RES = 0xBD ; sfr ADC_LOW2 = 0xBE ; sfr P1ASF = 0x9D ; #define ADC_POWER 0x80 #define ADC_FLAG 0x10 #define ADC_START 0x08 #define ADC_SPEEDLL 0x00 #define ADC_SPEEDL 0x20 #define ADC_SPEEDH 0x40 #define ADC_SPEEDHH 0x60 unsigned char bufsend [ 10 ] = { 0 } ; void Delay1ms ( unsigned int x ) //@11.0592MHz { unsigned char i , j ; while ( x -- ) { _nop_ ( ) ; _nop_ ( ) ; _nop_ ( ) ; i = 11 ; j = 190 ; do { while ( -- j ) ; } while ( -- i ) ; } } void UartInit (