日B视频 亚洲,啪啪啪网站一区二区,91色情精品久久,日日噜狠狠色综合久,超碰人妻少妇97在线,999青青视频,亚洲一区二卡,让本一区二区视频,日韩网站推荐

您好,歡迎來電子發(fā)燒友網(wǎng)! ,新用戶?[免費(fèi)注冊]

您的位置:電子發(fā)燒友網(wǎng)>源碼下載>C/C++語言編程>

AD1674 c語言程序

大?。?/span>2 人氣: 2010-08-18 需要積分:10
樓斌的空間

用戶級(jí)別:注冊會(huì)員

貢獻(xiàn)文章:

貢獻(xiàn)資料:


#include
#include
#include

// define P1.0 to check STATUS.
sbit STATUS = P1^0;

unsigned char xdata CTRL? _at_ 0x2FFF;
unsigned char xdata ADSEL _at_ 0x4FFF;
unsigned char hByte;
unsigned char lByte;

void adc_Convert (void)
?{ // Start a conversion with A0 and A/$C$ low.
?? // The convesion takes place on rising CE edge.
?? CTRL? = 0x00;
?? ADSEL = 0x00;
?? // Wait until we have completed a conversion .
?? while(STATUS==1);
?? // Set R/$C$ with A0 low and read the low byte.
?? CTRL? = 0x02;
?? hByte = ADSEL;
?? // Set R/$C$ with A0 high and read the high.
?? CTRL? = 0x03;
?? lByte = ADSEL;
?}


void main(void)
?{ unsigned int delay, MSB , LSB, adc_Res;
?? // Initialize serial interface
?? SCON? = 0xDA;??????? // SCON: mode 1, 8-bit UART, enable rcvr????? */
?? TMOD |= 0x20;??????? // TMOD: timer 1, mode 2, 8-bit reload??????? */
?? TH1?? = 0xFD;???????? // TH1:? reload value for 1200 baud @ 12MHz?? */
?? TR1?? = 1;?????????? // TR1:? timer 1 run????????????????????????? */
?? TI??? = 1;?????????? // TI:?? set TI to send first char of UART??? */
??
?? while(1)
??? { adc_Convert();
????? MSB=(unsigned int)(hByte << 4);
????? LSB=(unsigned int)(lByte >> 4);
????? // adc_Res now has the converted data with 12-bit resolution.
????? adc_Res = MSB + LSB;
????? // Send adc results to the serial interface
????? printf("ADC READINGS: %03Xh\n", adc_Res);
???? // simple delay - it is mcu clock dependent !
????? for (delay=0; delay<10000; delay++)
?????? ;
??? }
?}

非常好我支持^.^

(6) 100%

不好我反對(duì)

(0) 0%

      發(fā)表評(píng)論

      用戶評(píng)論
      評(píng)價(jià):好評(píng)中評(píng)差評(píng)

      發(fā)表評(píng)論,獲取積分! 請遵守相關(guān)規(guī)定!

      ?
      精河县| 桓仁| 诏安县| 汝南县| 上饶县| 肇州县| 同仁县| 元氏县| 内黄县| 平湖市| 凌云县| 舞钢市| 五家渠市| 平远县| 阿巴嘎旗| 潼南县| 灌南县| 乳山市| 邹平县| 北流市| 固阳县| 永新县| 九江市| 肇东市| 襄樊市| 丘北县| 灵石县| 合水县| 罗平县| 吉安市| 旌德县| 松江区| 通州区| 洪江市| 克山县| 施甸县| 乌什县| 朔州市| 东平县| 纳雍县| 青阳县|