51 single chip microcomputer assembly language key control digital tube plus one plus to 999

Updated on number 2024-03-22
4 answers
  1. Anonymous users2024-02-07

    For assembly: you can define three storage areas, such as 30h, 31h, 32h, all of which are decimal, 30h plus 1 when the key is pressed, 31h plus 1 when added to 10, 31h plus 1, when 31h added to 10, 32h plus 1, you can.

    The display function can be placed in the main function, and the three storage areas can be scanned and sent out separately.

    For C language: define char type up to 256 is not good, then define unsigned int is enough, press the key to let it ++, add to 1000 to return to zero.

    The digital tube display has to separate the hundreds, tens, and single digits of this variable, which is also simple.

    It shouldn't be a big problem when it comes to this, **I won't write it for you, it's boring to write, hehe.

  2. Anonymous users2024-02-06

    low_temp;Single-digit registers.

    mid_temp;Ten-digit registers.

    high_temp;Hundreds of registers.

    start:

    mov low_temp,#0x00

    mov mid_temp,#0x00

    mov high_temp,#0x00

    add_1:

    Determine the button (don't know which port you're using).

    After each key press.

    inc low_temp

    mov a,low_temp

    cjne a,#0x0a,add_1

    mov low_temp,#0x00

    inc mid_temp

    mid_scan:

    mov a,mid_temp

    cjne a,#0x0a,add_1

    mov mid_temp,#0x00

    inc high_temp

    high_scan:

    mov a,high_temp

    cjne a,#0x0a,add_1

    sjmp start

  3. Anonymous users2024-02-05

    To give you a reference;

    1) The starting part, R5 is used to control the direction of taking the seven-segment code, whether it is from the beginning or from the end;

    2) display part;

    This is according to the idea that you take the seven-segment code, and the increment ends with 0, so in order to make the decrement also end with 0;

    So just add 0 in front of it;

    tab:db00h,3fh,06h,5bh,4fh,66h,6dh,7dh,07h,7fh,6fh,77h,7ch,39h,5eh,79h,71h,00h;

    Therefore, when increasing r5=1, pointing to 3fh, decreasing r5=10h, pointing to 71h, 3) the key part, when judging that it is pressed, execute mov r5, 01h;

    When it is judged to be pressed, mov r5, 10h is executed;

  4. Anonymous users2024-02-04

    The ones who are still using the compilation are either school students or masters of playing embedded.

Related questions
9 answers2024-03-22

The method of using two timers is to use the timer t0 to control the frequency and the timer t1 to control the duty cycle. The general programming idea is as follows: the t0 timer interrupt makes an i0 port output high, and starts the timer t1 in the interrupt of the timer t0, and this t1 makes the io port output low, so that changing the initial value of timer t0 can change the frequency, and changing the initial value of timer t1 can change the duty cycle. >>>More

16 answers2024-03-22

Scheduled interrupts, external interrupts?

6 answers2024-03-22

With c, I think about it:

1. It has something to do with hardware, do you know this? >>>More

5 answers2024-03-22

8086 belongs to the micro process unit (MPU) and is a microprocessor. >>>More

9 answers2024-03-22

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