Single chip microcomputer TDS water quality detection source program

Publisher:梦中徐来Latest update time:2020-12-21 Source: 51heiKeywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

        LcdWriteData('0'+datas[0]); //Hundreds digit

        //LcdWriteData('2');

       

        LcdWriteCom(0x82+0x40); //Write address 80 indicates the initial address

        LcdWriteData('0'+datas[1]); //ten digits

        //LcdWriteData('2');


        LcdWriteCom(0x83+0x40); //Write address 80 indicates the initial address

        LcdWriteData('0'+datas[2]); //unit



        LcdWriteCom(0x84+0x40); //Write address 80 indicates the initial address

        LcdWriteData('0'+datas[3]); //


        LcdWriteCom(0x85+0x40); //Write address 80 indicates the initial address

        LcdWriteData('0'+datas[4]); //Display decimal point  

       

       

        LcdWriteCom(0x86+0x40); //Write address 80 indicates the initial address

        LcdWriteData('0'+datas[5]); //Display decimal point  

       

               

       


}

/*******************************************************************************

* Function name: TDSDisplay()

* Function: Calculate TDS value

* Input: Temperature

* Output: None

*******************************************************************************/

long caculate_TDS(float temp)


{       

        unsigned long TDS;

        float Kt=0;

        double Ks=0;

        Ks=0.0324*count;

        //Kt=1000000/count;

        temp=temp*0.0625*100+0.5;       

        //temp=temp/100+(int)temp%100*0.01;

        if(temp<10&&temp>=1)

        {

                Kt=Ks*(0.00169*temp+0.5583);

        }

        else if(temp<20&&temp>=10)

        {Kt=Ks*(0.018*temp+0.5473);

        }

        else if(temp<30&&temp>=20)

        {Kt=Ks*(0.00189*temp+0.5281);

        }

    else

    {  Kt=Ks*(0.022*temp+0.45);

    }

     TDS=0.55*Kt;

                 return Ks;

}

/*******************************************************************************

* Function name definition: PutString()

* Description: Send a string

*******************************************************************************/

void PutString(unsigned char *TXStr)  

  {               

         

      while(*TXStr!=0)

      {                     

         SBUF=*TXStr;

         while(TI==0);

         TI = 0;   

          TXStr++;

       }

      

    }   

        /*******************************************************************************

* Function name definition: send()

* Description: Send measured temperature, TDS

*******************************************************************************/

                void send()

                {

                unsigned int shi,gewei,TD1,testno,testnoshi,testnoge;

        unsigned int NO[6];

        unsigned int i ,x;

        unsigned int TD[8];

        char str1[5];

        unsigned int TE[8];

                        if(key==0)

{

                while(!key);

                test++;

                testnoshi=testno/10;

                testnoge=testno%10;

                NO[0]='N';

                NOT[1]='O';

                NO[2]=':';

                NO[3]=testnoshi+0x30;

                NO[4]=test legs+0x30;       

                NO[5]='n';

                                        for(x=0;x<6;x++)

                         {

                SBUF =NO[x];

                 while(!IF);   

                 IF = 0;         

                                                                }

               


                str1[0]='n';

                str1[1]='T';

                str1[2]='D';

                str1[3]='S';

                str1[4]='=';

for(x=1;x<5;x++)//??揟DS=?

                {

   SBUF = str1[x];

……………………


[1] [2]
Keywords:MCU Reference address:Single chip microcomputer TDS water quality detection source program

Previous article:51 MCU Basic Calculator
Next article:Four-way buzzer based on Puzhong Technology 51 single-chip microcomputer

Recommended ReadingLatest update time:2024-11-15 18:46

How to implement custom download in operation in STC microcontroller
Users of STC microcontrollers must have had this experience: when burning a program, they must first click the download command, power off, power on, and perform a cold start. The whole process is quite tedious. Here is a custom download method (no need to power off, no need to load the user download file every time).
[Microcontroller]
How to implement custom download in operation in STC microcontroller
[MCU framework][bsp layer][cx32l003][bsp_i2c] I2C/IIC hardware configuration and use
Introduction to I2C I2C is a two-wire bidirectional serial bus that provides a simple and efficient method for exchanging data between devices. The I2C standard is a true multi-host bus with conflict detection and arbitration mechanisms. It prevents data conflicts when two or more hosts request control of the bus at t
[Microcontroller]
[MCU framework][bsp layer][cx32l003][bsp_i2c] I2C/IIC hardware configuration and use
Analysis of Freescale MCU PWM module (2)
Continue to introduce the PWM module of Freescale HCS12 series microcontroller (4) PWM Prescale Select Register PWMPRCLK selects independent prescaler factors for Clock A and B. Read: Any time Write: Any time The bits of the register can be written at any time, and if the polarity is changed while the PWM signa
[Microcontroller]
Analysis of Freescale MCU PWM module (2)
C language tutorial for single chip microcomputers Lesson 5 Constants
In the previous section, we learned about the data types supported by the KEIL C51 compiler. How are these data types used in the definition of constants and variables? Is there anything to pay attention to? Let's take a look. Wow! You still can't distinguish between constants and variables. Constants are quantities th
[Microcontroller]
C language tutorial for single chip microcomputers Lesson 5 Constants
Lightweight menu for microcontroller
Sometimes I need to use a microcontroller to write some larger programs, but there is no need to use some operating systems. I wrote the following lightweight menu state machine, equipped with a display device and 5 inputs (up, down, left, right and press ) Let’s take a look at the renderings first The above ABC,
[Microcontroller]
Study STM32 summary of single chip microcomputer (msp430, c8051, etc.) general learning method
1. A board has the necessary power supply lines and the necessary simulation download and debug lines (such as J-link for STM32)   2. Install the development environment: keil4 (c51 or ARM series registration), it seems that there is also msp430 series. First, make sure what series the board is. IAR EWARM is (ARM
[Microcontroller]
[51 MCU learning process record] 7 Interrupt timer counter 0 understanding before operation
Disclaimer: is all about my own learning and practice. I am just a rookie. All arguments and opinions only represent me. I cannot be sure that they are the truth of this technology. My purpose is to learn and have the possibility to become an experience that can be shared with others. Therefore, if there are mistakes
[Microcontroller]
[51 MCU learning process record] 7 Interrupt timer counter 0 understanding before operation
Design of kitchen control based on PIC microcontroller
    With the continuous development of intelligent home appliance control technology, multifunctional and intelligent kitchen controllers have become the mainstream of kitchen appliance development. Compared with traditional single kitchen equipment controllers, multifunctional kitchen controllers have the advantages o
[Microcontroller]
Design of kitchen control based on PIC microcontroller
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号