I can t kneel down and ask the master for help! MCU program explained

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

    The first floor is right, C51 has several control functions for the LCD screen. Help people: the interface of the LCD screen has RS signal (register selection, H data, L instruction) connection, R W read and write signal, LCDEN read and write allowed, D0 D7 data.

    void delay(uint z)

    A time-delay subroutine used for timing coordination when sending data or instructions to an LCD.

    void write com (uchar com) sends instruction byte functions to lcd.

    void write date (uchar date) is a function that sends data bytes to the lcd.

    void write_nyr(uchar add,uchar date)

    Display the 10 digits and single digits of the Date on the first line of the LCD screen.

    void write_sfm(uchar add,uchar date)

    Display the 10 digits and single digits of the date on the second line of the LCD screen.

  2. Anonymous users2024-02-09

    You can't afford to kneel for a long time with such a **? You can't afford to kneel for a long time to take the information, and it's already done.

  3. Anonymous users2024-02-08

    1.It's a cycle, and it's an endless cycle. He is often used in the microcontroller, the function is that as long as the microcontroller is powered on, it makes the program continue to execute the content in the endless loop!

    2.This depends on the hardware circuit of your single-chip microcomputer, and you had better understand the hardware circuit before programming. Usually the common end of the LED is gated with a triode!

    It seems that your LED is connected to the common anode, that is, the 8 LED positive electrodes are connected to the emitter of the triode, the collector is connected to the VCC, and the base is connected to the P1 port. P1=0, the transistor is forward conducted, VCC is added to the LED, if the other end of the LED is low, so that the LED is positively biased, the LED is on. Think about it

    Execute the statement in while(1) non-stop, but when an interrupt occurs, the CPU has to execute the interrupt first, and then return to the while to continue the execution, which is quite a wait for the interrupt! In other words, if there is an interrupt, the CPU should immediately execute the interrupt, and if there is none, it will always execute the one in while(1).

  4. Anonymous users2024-02-07

    1.SP=40H, A=30H before the CALL command is executed, but in the SUBR, the SP is pressed to the stack for 2009H, and the 2009H is sent back to the PC after the RET command is executed, causing the MCU to jump to the 0x2009 to continue executing the instruction, but this position is not the instruction start address specified in the program, so after running, A=30H, Sp=42H

    It's an 8-bit register, right? 0+1+2+..100 gets 16 bits of data, a can't fit it, the program writes like this, the high byte of the result is in r3, and the low byte is in r2:

    mov r0,#101 ;0 100 is 101 digits mov r1,

    mov a,#

    mov b,#

    loop:clr c

    mov a,r2

    add a,r1

    mov r2,a

    mov r3,a

    addc a,#

    mov r3,a

    inc r1

    djnz r0,loop

    3.I don't know the order, then I think 50h and 60h are high two digits, and 51h and 61h are low two digits:

    clr cmov a,51h

    add a,61h

    damov 41h,a

    mov a,50h

    addc a,60h

    da mov 40h,amov

  5. Anonymous users2024-02-06

    (1) After the following procedure is executed, sp=?a=?b=?

    org 2000h

    mov sp, #40h

    mov a , #30h a=30hlcall subr

    add a, #10h a=40hmov b, a b=40hl1: sjmp l1

    subr: mov dptr,#2009hpush dpl 09h

    push dph 20h

    RET So, A=40h, B=40h, Sp=2009h

Related questions
15 answers2024-05-16

Pick up the first sensing; Take the second sensor. As for the LED display program, it is very simple, just write a subprogram. That's it for the basic program, but there are other possibilities to add it yourself according to the actual situation, and the program must pass through two points in turn, otherwise the program will be in an endless loop. >>>More

16 answers2024-05-16

Isn't this thing just a digital tube displaying 16 digits? Prompt you 16 times to get there, let go after you think to press the stop button. If so, the procedure is available for reference: >>>More

7 answers2024-05-16

I'm also a senior in automation control, but I've been working outside, and now the outside form is really different from the school, if you want to engage in single-chip microcomputer, you can start learning, I will probably introduce you to a few steps to directly enter social work: >>>More

10 answers2024-05-16

time=th1*256+tl1;

This is to use the timer t1 to count, time=th1*256+tl1; This is to calculate the time according to the count value of the timer counter t1, th1 is the higher 8 bits of the counter, and the count result is of course multiplied by 256 times, plus the value of the lower 8 bits tl1. >>>More

7 answers2024-05-16

In my experience with keil, header files are best used to describe some functions, not to define variables or anything, and variables are better defined above or inside the main function. >>>More