FMUSER Wirless Transmit Video And Audio More Easier !

[email protected] WhatsApp +8618078869184
Language

    18B20 C procedure

     

    18B20 C procedure // Access DQ and VCC 4.7K pull-up resistor #include "reg52.h" #include "intrins.h" #include "1602.c" #define uchar unsigned char # Define uint unsigned int // # Define Clearscreen LCD_EN_COMMAND (0x01) 1602 clear screen sbit dq = "p1" ^ 0; / * Operation command code Skip ROM 0XCC Send Temperature Conversion 0xBE Write EEPROM 0x4E * / ///////////// low level driver routine /////////// void Init18B20 (void); // initialize void Write18B20 (uchar ch); // write data unsigned char Read18B20 (void); // read data void Delay15 (uchar n); void Delay10ms (uint delay_num); void Display (void); ///////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////S , 87, 93}; Code Uchar Decimall [] = {00, 25, 50, 75, 00, 25, 50, 75, 200, 25, 50, 75, 100, 25, 50, 75}; Uint ResultTemperatureH, ResultTemperatureLH, ResultTemperatureLLL; / / Elear, decimal high, decimal low uint resultignal; // symbol bit Main () {uint temh, teml, delay, k = 0; for (;;) {init18b20 (); Write18b20 (0xcc); // Skip ROM _NOP_(); // Write18B20 (0x4e); // Write EEPROM // Write18B20 (0x00); // / w w18b20 (0x00); // TL WRITE18B20 (0x7f); // 12 BITS temperature resolution init18b20 (); Write18b20 (0xcc); // Skip ROM _NOP_(); Write18b20 (0x44); // Send Temperature Conversion Instruction Delay10ms (25); Delay10ms (25); Delay10ms (25); Delay10ms (25); // Waiting 1s Conversion INIT18B20 (); Write18B20 (0xcc); // Skip ROM WRITE18B20 (0xBE); // Send Temperature Conversion Instruction Teml = "READ18B20" (); // Read Light Temperature Value Temh = "Read18B20" (); // Read High temperature value Delay10ms (2); temh = (temh<<4) | (Teml>>4); teml = "teml" & 0x0f; // Take low 4-bit IF (Temh & 0x80) {temh = ~ temh; teml = ~ Teml + 1; ResultSignal = "1"; // negative} else resultignal = "0"; // ResultTemperatureelh = "decimalh" [TEML]; ResultTemperatureEll = "decimall" [TEML]; resulttemperatureureh = "temh"; display (); For (delay = 0; delay<60000; delay ++); for (delay = 0; delay<20000; delay ++);}} Void Display (void) {uint i, j, q; lcd_init (); clearscreen; lcd_en_command (0x01); delay_nms (2); Q = "ResultTemperatureH / 100"; i = (ResultTemperatureH% 100) / 10; j = " ResultTemperatureH - "(i * 10 + q * 100); LCD_write_string (0, LINE1," Jaq1217 18B20 "); if (ResultSignal) {LCD_write_string (0, LINE2," T is: -. ");} else {LCD_write_string ( 0, LINE2, "T IS: +.");} LCD_WRITE_CHAR (0x07, Line2, Q | 0x30); LCD_WRITE_CHAR (0x08, Line2, I | 0x30); LCD_WRITE_CHAR (0x09, Line2, J | 0x30); LCD_WRITE_CHAR (0x0b , LINE2, (ResultTemperatureLH / 10) | 0x30); LCD_write_char (0x0c, LINE2, (ResultTemperatureLH% 10) | 0x30); LCD_write_char (0x0d, LINE2, (ResultTemperatureLL / 10) | 0x30); LCD_write_char (0x0e, LINE2, (ResultTemperatureLL % 10) | 0x30); UNSIGNED Char {UNSIGNED CHAR CH; Unsigned Char q; For (q = 0; q<8; q ++) {CH = CH>>1; DQ = "0"; _nop_(); dq = "1"; _nop _(); _nop _(); _nop_(); _nop_(); if (dq == 1) {CH = "CH | 0x80"; Else {CH = "CH" & 0x7f;} delay15 (3); DQ = "1";} Return (CH);} Void write18b20 (uchar i; for (i = 0; I<8; i ++) {dq = "0"; delay15 (1); dq = "ch" & 0x01; delay15 (3); dq = "1 "; CH =" ch ">>1; _nop_();}} void Init18B20 (void) {DQ = "0"; Delay15 (33); // delay is at least 480us DQ = "1"; Delay15 (10); // least delay 100us / * if (DQ == 1) return 0; // Initialization fail else return 1; DQ = 1; DELAY15 (18); * /} void Delay15 (uchar n) {do {_nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); n-;} while (n);} void delay_num) {uchar i; while (delay_num--) {for (i = 0; I<125; i ++ ) {;}}}, Technology area Alexa voice service software extension STM32Cube Combined with DNN API drivers to drive future neural network applications Four integration design for high-end mobile communications and automotive markets A frame capture open source graphic debugger application design The latest security technology that is about to be standard configuration: Rear view camera system

     

     

     

     

    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