51 single chip microcomputer LCD display program, ask C language master to answer

Updated on technology 2024-05-09
5 answers
  1. Anonymous users2024-02-09

    I don't know what kind of model the LCD you are using, it doesn't seem like 1602.

    If the value is less than 1000, a number with ten white digits will be displayed normally, such as 345; If it is greater than 1000, all 3 assignments are 0x39, i.e. the ASCII character '9', the result will be displayed on the LCD, indicating a range of more than 1000.

    Guess that REQ is the control signal for writing to the LCD, busy is the "busy" signal returned by the LCD, and looping 16 times for is to write 16 characters in the LCDTEM character array to the LCD for display.

  2. Anonymous users2024-02-08

    Roughly this is the meaning: first of all, you have to understand, how is it stored in the single-chip microcomputer, in fact, he saves 000, where the decimal point is displayed is artificially determined by you, the single-chip microcomputer can not calculate the decimal place, so the temperature is stored 000--999, instead of, understand? When it is greater than or equal to 1000, the same content will be displayed, which is the corresponding content of the 0x39.

    For is nothing more than sending out the contents of the lcdtem one by one. I said that to this extent, you should be able to understand, if you still don't understand, **strong foundation accumulation. I'm also from a beginner, I know it's not easy, so I will help you analyze it when I see it, in fact, not everyone will have the patience to help you analyze, you have to analyze more independently, and you don't ask if you can...... don't ask

  3. Anonymous users2024-02-07

    The upstairs is quite right, and I would like to add the following:

    unsigned char lcdtem=0xf9,0x06,0x08,0x30,0xf9,0x07,0x08,0x30,0xf9,0x08,0x08,0x2e,0xf9,0x09,0x08,0x30};

    0xf9, it may be a display write command; 0x06, it could be the 6th column of the display; The next 0x08 could be line 8 of the display; 0x30 is the data to be displayed in this column in this row, which is the ASCII code; 0xf9, 0x06, 0x08, 0x30 form a complete set of commands, there are 4 groups here, of which the last one of the third group is 0x2e, which is the ascii code of the decimal point.

    So what it will show on the display will look like this:

    In the 8th row of the display, column 6 starts to display the hundreds, decimal places, decimal points, and decimal places of the temperature.

  4. Anonymous users2024-02-06

    The if statement is a choice statement in the C language, and the meaning of this procedure is that if the temperature (if) satisfies "=1000", then the value 0x39 is assigned to lcdtem[3], lcdtem[7], and lcdtem[15], respectively, and the 0x39 is the ASCII character' 9', so the result displayed on the LCD is that if the temperature is greater than 1000 if the condition is not met, ten data in the array lcdtem will be displayed normally.

    In the for loop, REQ is used to control the LCD display, 1 is true, 0 is FLASE, and I=0; i<16;i++ is to loop this operation 16 times.

  5. Anonymous users2024-02-05

    In the number system, the character has its encoding, for example, if you display 7 on the LCD, the meaning of this 7 is a jujube character, then you have to add a quotation mark, because after adding a quotation mark, the compiler will know that it is a "character" and not a number (in fact, the quotation mark 7 will be translated by the compiler into 37h, corresponding to the ASIIIC code of 7). Why do you have to use "characters", because the LCD only recognizes the characters, it only displays the "characters", just like the above example, the LCD knows that 37h is the character 7, so it will display the word Lu Zi 7. If you don't use quotation marks, then the compiler simply sends it over as a constant, and when it comes to the lcd, the LCD "looks.""To 07h, it certainly won't show the character 7 out.

    To display the array from the PC, rewrite a function as follows:

    void lcd_printstr(unsigned char * pch)

    unsigned char chnum=20;There are a maximum of several characters in a string, here are 20, which can be changed.

    while(chnum!=0) Loop fetch characters when a string cannot exceed 20 to prevent falling into an endless loop.

    if (*pch)!=0x0d ;The string in the array ends with a 0x0d, that is, a carriage return, if it is not a carriage return, it means that the end of the string has not yet been reached, and the string passed from the PC should end with a 0x0d, of course, something else.

    Special characters are also available.

    lcd_write_data(* pch);Displays characters.

    If the above function doesn't automatically move to the right after it is displayed, add a function to move the position of the character here.

    pch++;Point to a character that knows the next one.

    chnum--;The character count is minus 1

    End of cycle. For example, if you store an array of characters in unsgiend char str, you can call the function as follows:

    lcd_printstr(&str);

    Danfeng is auspicious, the dragon is presented, the red peach is celebrated, the apricot welcomes the spring, and the world is full of blessings.

Related questions
4 answers2024-05-09

You use a P1 port to control the dynamic scanning of 8 digital tubes, and the dynamic scanning display of digital tubes needs to be blanked. >>>More

18 answers2024-05-09

Landlord, org 0030h.

How do you understand what I mean? >>>More

16 answers2024-05-09

Scheduled interrupts, external interrupts?

5 answers2024-05-09

If you really want to learn, you don't need to buy a development board. Find a minimal system board, then learn something, buy components and build small circuits by yourself. Run the electronic market by yourself, build the circuit by yourself, in order to know the problem, in order to learn something, buy a development board, according to the circuit on the manual, and then put the program into it, and then the program basically understands, this is not called learning... >>>More

9 answers2024-05-09

16 and 7 are the number of bytes between the PC and the data ** at the time of the lookup command. >>>More