FMUSER Wirless Transmit Video And Audio More Easier !

[email protected] WhatsApp +8618078869184
Language

    51 single-chip drive LCD1602 program detailed (including LCD1602 special interface description)

     

    51 single-chip LCD1602 program detailed LCD1602 Industrial characteristic LCD. 1602 means that the contents of the LCD are 16x2, which can be displayed two rows, 16 characters per line. Be Special interface description RS: Register Select the input RS = 1: Point to the data register RS = 0: Pointing the command register RW: Read and write control input RW = 0: Write operation RW = 1: read operation E: Enable signal input High power is effective when reading operation; When writing, the falling edge is effective; Programming: #Include "reg51.h" #Include "intrins.h" // there is a definition of NOP functions / * For the delay is short, require the "_nop_" function in US-Level, this function is quite assembled, delayed several microseconds. The NOP instruction is a single cycle instruction, and the delay time can be calculated from the crystal frequency rate, for 12m crystal, delay 1us. * / #Define uchar unsigned char #Define uint unsigned int SBIT RS = P2 ^ 6; / / Define Data Command Select SBIT RW = P2 ^ 5; // Defines the read and write selection SBIT E = P2 ^ 7; // Defining Enable // Note: Which Io port is specifically fixed by your own wiring, not necessarily writing this! Uchar text1 [] = "welcome to"; // The character to be displayed in the first line Uchar text2 [] = "limited"; // The character of the second line to display Void delay_ms (uint z) // millisecond delay function { UINT I, J; For (i = z; i "0; i -) for (j = 110; J "0; J -); } / / Why is you going to judge? / * Because the LCD1602 control chip is also a CPU, it takes longer when handling some of the instructions sent by the host computer. Such as reset commands, full screen clearance commands, etc. In addition, the CPU speed of the LCD1602 is slower. When the upper machine is faster, the LCD1602CPU is not completed, and the subsequent command will not be ignored, which causes the command sequence to reach the LCD1602CPU correctly, so that it is not normal. * / _Nop_(); E = 1; _Nop_(); TEMP = P0; // Read the status word of the LCD1602 at this time _Nop_(); E = 0; Return (Temp & 0x80); // If you are busy / * Status word is the highest bit of Temp (8-bit 2), the highest bit is 1 indicates that the read and write is prohibited, and 0 means it allows read and write, that is, TEMP & 0x80 has a 1 reputation, get 0 means not busy * / } / * In the information of the LCD1602, the read and write operation has a corresponding timing chart, and it is necessary to understand the specific workflow of the LCD1602 to carefully study the timing chart! * / Void LCD1602_WriteCom (Uchar COM) // Write command { While (LCD1602_Readbusy ()); // Judging RS = 0; // command RW = 0; // Write _Nop_(); P0 = COM; // Preparing to send commands _Nop_(); E = 1; // By the timing diagram, the data exchange is allowed to allow data to be exchanged. _Nop_(); _Nop_(); E = 0; // By the timing diagram, the enable end is low after completing the data exchange _Nop_(); _Nop_(); } Void LCD1602_WriteData (Uchar DAT) // Write Data { While (LCD1602_Readbusy ()); // Judging RS = 1; // Data RW = 0; // Write _Nop_(); P0 = DAT; _Nop_(); E = 1; _Nop_(); _Nop_(); E = 0; _Nop_(); _Nop_(); } Void LCD1602_init () // Initialization function { DELAY_MS (15); WRITE_COM (0x38); // Display mode settings DELAY_MS (5); WRITE_COM (0x38); DELAY_MS (5); WRITE_COM (0x38); Write_com (0x0c); // Show Write_com (0x01); // Display clear screen Write_com (0x06); // Show cursor } Void main () { Uchar i, j; LCD1602_INIT (); LCD1602_WriteCom (0x80); // 0x80 is the address of the first character of the first line For (i = 0; i "10; i ++) LCD1602_WRITEDATA (Text1 [i]); LCD1602_WriteCom (0x80 + 0x40); // 0xc0 is the address of the first character of the second line / * There are many ways to represent, you can use 0xc0, 0x80 + 0x40, 0x80 | 0x40, etc. * / For (j = 0; j "10; j ++) LCD1602_WriteData (Text2 [J]); } In fact, LCD1602 has a lot of fun instructions, such as moving right away, everyone can take a look at the relevant instructions in LCD1602, will have a more profound experience.

     

     

     

     

    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