FMUSER Wirless Transmit Video And Audio More Easier !

[email protected] WhatsApp +8618078869184
Language

    18B20 temperature measurement C51 source program

     

    #include # include #define BUSY1 (DQ1 == 0) sbit DQ1 = P0 ^ 4; unsigned char idata TMP; unsigned char idata TMP_d; unsigned char f; void wr_ds18_1 (char dat); unsigned char rd_ds18_1 (); / *************** delay procedure, US units, greater than 10us ************* / void TIme_delay (unsigned char TIme) {TIme = TIme -10; time = time / 6; while (time = 0!) time--;} / ************************************************* **** // * reset ds18b20 * // ************************************** *************** / void ds_reset_1 (void) {unsigned char idata count = 0; DQ1 = 0; time_delay (240); time_delay (240); DQ1 = 1; return;} void check_pre_1 (void) {while (DQ1); while (~ DQ1); time_delay (30);} void read_ROM (void) {int n; ds_reset_1 (); check_pre_1 (); wr_ds18_1 (0x33); for (n = 0; n<8; n ++) {ROM [n] = rd_ds18_1 ();}} / ************************************************* **** // * read a bit from 1820 bit read * // ******************************** ********************* / bit tmrbit_1 (void) {idata char i = 0; bit dat; DQ1 = 0; _nop_(); DQ1 = 1; _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_() ; _nop_(); dat = DQ1; time_delay (50); return dat;} / ************************************************* **** // * read a bety from ds18b20 * // byte read ******************************* ********************** / unsigned char rd_ds18_1 () {unsigned char idata i, j, dat = 0; for (i = 1; i< = 8; i ++) {j = tmrbit_1 (); dat = (j<.1881 (i-1.)) | dat;} return dat;} / ************************************************* **** // * write a bety from ds18b20 write byte * // ******************************** ******************** / void wr_ds18_1 (char dat) {signed char idata i = 0; unsigned char idata j; bit testb; for (j = 1;. j.1881 = 8; j ++) {testb = dat & 0x01; dat = dat>>1; if (testb) {DQ1 = 0; _nop_(); _nop_(); DQ1 = 1; time_delay (60);} else {DQ1 = 0; time_delay (50); DQ1 = 1; _nop_(); _nop_();}}} int get_temp_1 (void) {unsigned char idata a = 0, b = 0; unsigned char idata i; EA = 0; ds_reset_1 (); check_pre_1 (); wr_ds18_1 (0xcc); wr_ds18_1 (0x44); while (BUSY1); ds_reset_1 (); check_pre_1 (); wr_ds18_1 (0xcc); wr_ds18_1 (0xbe); a = rd_ds18_1 (); b = rd_ds18_1 (); i = b; / * If the temperature is negative and b is 1 * / i = (i. 1882.>4); if (i == 0) {f = 0; TMP = ((a>>4) | (b<<4)); a = (a & 0x0f); if (a. 1882.8) {TMP = (TMP + 1);}} else {f = 1; a = a>>4; b = b<<4; TMP = (a | b); TMP = ~ TMP; TMP = (TMP + 1);} EA = 1; return (TMP);} int get_temp_d (void) {unsigned char idata a = 0, b = 0; unsigned char idata i, m; EA = 0; ds_reset_1 (); // reset check_pre_1 (); wr_ds18_1 (0xcc); wr_ds18_1 (0x44); while (BUSY1); ds_reset_1 (); check_pre_1 (); wr_ds18_1 (0xcc); wr_ds18_1 (0xbe); a = rd_ds18_1 (); b = rd_ds18_1 (); i = b; / * If the temperature is negative and b is 1 * / i = (i>>4); if (i == 0) {f = 0; TMP = ((a>>4) | (b<<4)); a = (a & 0x0f) ; TMP_d = a;} else {f = 1; a = ~ a; a = (a + 1); b = ~ b; b = (b + 1); m = a; a = a>>4 ; b = b<<4; TMP = (a | b); m = (m & 0x0f); TMP_d = m;} EA = 1; return (TMP);}, read, technology zone About μClinux transplantation on ARM7 S3C4510B Multi-looped into charge and discharge controller design Interrupt service routines for ARM embedded systems LED dimming engine design based on 8-bit MCU How to display Chinese characters, ASCII characters and color graphics on the LCD monitor

     

     

     

     

    List all Question

    Nickname

    Email

    Questions

    Our other product:

    Professional FM Radio Station Equipment Package

     



     

    Hotel IPTV Solution

     


      Enter email  to get a surprise

      fmuser.org

      es.fmuser.org
      it.fmuser.org
      fr.fmuser.org
      de.fmuser.org
      af.fmuser.org ->Afrikaans
      sq.fmuser.org ->Albanian
      ar.fmuser.org ->Arabic
      hy.fmuser.org ->Armenian
      az.fmuser.org ->Azerbaijani
      eu.fmuser.org ->Basque
      be.fmuser.org ->Belarusian
      bg.fmuser.org ->Bulgarian
      ca.fmuser.org ->Catalan
      zh-CN.fmuser.org ->Chinese (Simplified)
      zh-TW.fmuser.org ->Chinese (Traditional)
      hr.fmuser.org ->Croatian
      cs.fmuser.org ->Czech
      da.fmuser.org ->Danish
      nl.fmuser.org ->Dutch
      et.fmuser.org ->Estonian
      tl.fmuser.org ->Filipino
      fi.fmuser.org ->Finnish
      fr.fmuser.org ->French
      gl.fmuser.org ->Galician
      ka.fmuser.org ->Georgian
      de.fmuser.org ->German
      el.fmuser.org ->Greek
      ht.fmuser.org ->Haitian Creole
      iw.fmuser.org ->Hebrew
      hi.fmuser.org ->Hindi
      hu.fmuser.org ->Hungarian
      is.fmuser.org ->Icelandic
      id.fmuser.org ->Indonesian
      ga.fmuser.org ->Irish
      it.fmuser.org ->Italian
      ja.fmuser.org ->Japanese
      ko.fmuser.org ->Korean
      lv.fmuser.org ->Latvian
      lt.fmuser.org ->Lithuanian
      mk.fmuser.org ->Macedonian
      ms.fmuser.org ->Malay
      mt.fmuser.org ->Maltese
      no.fmuser.org ->Norwegian
      fa.fmuser.org ->Persian
      pl.fmuser.org ->Polish
      pt.fmuser.org ->Portuguese
      ro.fmuser.org ->Romanian
      ru.fmuser.org ->Russian
      sr.fmuser.org ->Serbian
      sk.fmuser.org ->Slovak
      sl.fmuser.org ->Slovenian
      es.fmuser.org ->Spanish
      sw.fmuser.org ->Swahili
      sv.fmuser.org ->Swedish
      th.fmuser.org ->Thai
      tr.fmuser.org ->Turkish
      uk.fmuser.org ->Ukrainian
      ur.fmuser.org ->Urdu
      vi.fmuser.org ->Vietnamese
      cy.fmuser.org ->Welsh
      yi.fmuser.org ->Yiddish

       
  •  

    FMUSER Wirless Transmit Video And Audio More Easier !

  • Contact

    Address:
    No.305 Room HuiLan Building No.273 Huanpu Road Guangzhou China 510620

    E-mail:
    [email protected]

    Tel / WhatApps:
    +8618078869184

  • Categories

  • Newsletter

    FIRST OR FULL NAME

    E-mail

  • paypal solution  Western UnionBank OF China
    E-mail:[email protected]   WhatsApp:+8618078869184   Skype:sky198710021 Chat with me
    Copyright 2006-2020 Powered By www.fmuser.org

    Contact Us