Find the single chip microcomputer door to meet the counter program, the single chip microcomputer c

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

    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:

    Initializer*

    ru bit ;Define the detection interface.

    qing bit ;Define the zeroing interface.

    shi bit ;The definition shows ten digits.

    ge1 bit ;Define display digits.

    org 0000h

    jmp start

    org 0030h

    start:

    mov r0,#0h

    Main function *main:mov dptr, table

    lcall display ;Invoke display subroutines.

    jnb ru,lop1 ;Check whether there is a signal on the interface.

    jnb qing,start ;Check whether the screen is cleared.

    jmp main

    lop1:inc r0 ;The counter is added by one.

    jmp main

    Displays subroutines*

    display:

    mov a,r0

    mov b,#10 ;Break down the ten-bit display.

    div ab ;Break down the single-digit display.

    mov r1,b

    movc a,@a+dptr ;The look-up table displays.

    mov p0,a

    clr shi

    lcall delay

    setb shi

    mov a,r1

    movc a,@a+dptr

    mov p0,a

    clr ge1

    lcall delay

    setb ge1

    ret*10ms delay*

    delay:

    mov r2,#

    yan:mov r3,#

    djnz r3,$

    djnz r2,yan

    rettable:

    db 01h,02h,03h,04h,05h,06h,07h,08h,09hend

  2. Anonymous users2024-02-04

    How many do you want to display? And this topic is very simple, think about it yourself.

  3. Anonymous users2024-02-03

    To be honest, after using C, I really don't want to read a compilation of more than 20 lines.

    Moreover, the brother did not have a single comment, which is not a good habit.

  4. Anonymous users2024-02-02

    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:

    Initializer*

    ru bit ;Define the detection interfaceqing bit; Define the zeroing interface shi bit; Define and display ten digits of ge1 bit; The definition displays the single digit org 0000h

    jmp start

    org 0030h

    start:

    mov r0,#0h

    Main function *main:mov dptr, table

    lcall display ;invoke display subroutine jnb ru,lop1 ; Determine whether the interface has a signal jnb qing, start; Check whether to clear the JMP main

    lop1:inc r0 ;Counter plus one JMP main

    Displays subroutines*

    display:

    mov a,r0

    mov b,#10 ;Breaking down the ten bits shows div ab; Decomposing the single digits shows MOV R1,B

    movc a,@a+dptr ;The lookup table shows MOV P0,A

    clr shi

    lcall delay

    setb shi

    mov a,r1

    movc a,@a+dptr

    mov p0,a

    clr ge1

    lcall delay

    setb ge1

    ret*10ms delay*

    delay:

    mov r2,#

    yan:mov r3,#

    djnz r3,$

    djnz r2,yan

    rettable:

    db 01h,02h,03h,04h,05h,06h,07h,08h,09hend

  5. Anonymous users2024-02-01

    I have ready-made products.

    Two digits, according to the number of products on the assembly line, automatically add one, add to 20, and automatically clear zero;

    After the two-digit digit is cleared to zero, another four-digit number will be automatically added by one.

    The above can be understood as the current output;

    In addition, there are several sets of digital displays, which can set daily quotas, display the current difference, etc.

  6. Anonymous users2024-01-31

    I don't have time to write programs.

    Here are 2 ideas for you.

    1: Use crystal shock, internal clock to do Very good 2: This universal simple program Search a lot on the Internet What baidu google's is very good to make.

  7. Anonymous users2024-01-30

    If you add 200 points, someone may write, and if no one writes, I will write it for you.

  8. Anonymous users2024-01-29

    You can connect the counting signal to the external interrupt IO port and add the following statement to the interrupt service function of the external interrupt:

    static int count=0;

    count++;

  9. Anonymous users2024-01-28

    I can't help you with 61 MCU, if it's a 51 MCU, it's no problem to do this design, and it's okay to come to me.

  10. Anonymous users2024-01-27

    There are many problems, mainly errors in the use of Chinese characters.

    include to import header files.

    unsigned b[10]=;Encoding of 0-9.

    void delay(void) is a delay subroutine, which is the first 1 second before the delay is missing.

    unsigned char i,j,k;

    for(i=20;i>0;i--)

    for(j=2;j>0;j--)

    for(k=250;k>0;k--)

    void inc cnt (void) press the k1 key to count positively, from 0 to 99

    unsigned char x, y, z;

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

    void dec cnt( void ) Press the K2 key to count down, which can be counted from 99 to 00

    unsigned char x, y, z;

    for(x=10;x>0;x--) to invoke the delay subroutine.

    else }}

    void main( void ) volts main function.

    unsigned char key;

    p2=0x00;

    p0=0x3f;

    for(;;

  11. Anonymous users2024-01-26

    From the distribution diagram of 51 single-chip microcomputer RAM data memory, it can be seen that from 80H-FFH address unit (also 128 bytes) for the special register (SFR) unit, and the address from 00H-7FH unit (a total of 128 bytes) is the user data RAM, the user data unit, which only refers to the register that the user can define when programming, is generally used for calculation, temporary storage or conversion, if there is no such unit, then basically the single-chip microcomputer has no effect.

    Therefore, as a single-chip microcomputer selection, the size of RAM also directly determines its cost, there is no waste phenomenon as the landlord said, and the size of the RAM can be determined according to the complexity of their own programs.

    The RAM distribution of 51 single-chip microcomputers is shown in the following figure.

  12. Anonymous users2024-01-25

    The special registers are not in the RAM, but are uniformly addressed with the RAM, and the PC pointer is in the CPU.

    To add: from a structural point of view, special registers and RAM can't be together, because they're not the same thing at all. Just for the convenience of use, unified addressing.

    The CPU uses the same addressing method for RAM, special registers and even the peripherals you connect yourself, so the special registers and RAM are uniformly addressed for the convenience of users.

    As a user, what you should care about is how big the RAM really is.

    The RAM of the 51 microcontroller is 128 bytes, which is only as big as 80-FF, so its memory is so large, and there is no RAM in other spare places. So there will be no waste.

  13. Anonymous users2024-01-24

    The special register SFR is in the RAM, which is located in the upper 128 bits, and the RAM that can really be used freely by the user is located in the lower 128 bits of RAM (52, the upper 128 bits can also be freely used by the user, but 52 for the access of the high 128 bits of RAM, it is distinguished by addressing, which will not be discussed here).

    The RAM that the user is free to use is for the user to store intermediate results or temporary data storage.

    The size of the internal RAM, for the MCU with the same structure, also determines the complexity of the function in the design software, and the RAM is relatively small, which determines that the function should not be too complex.

    Of course, RAM can also be externally extended, but its access speed is much lower than that of internal RAM.

  14. Anonymous users2024-01-23

    How can a special register be located in RAM, but the high 128byteRAM address overlaps with the special register address, which is only distinguished by the access method. Special registers are used for control of internal and external devices of the microcontroller, and are connected to the CPU through the internal bus.

    RAM role:

    1. Store some program variables (some variable compilers store them in registers such as r0, r1, etc.).

    2. Stack storage when the function is called.

  15. Anonymous users2024-01-22

    Interrupt means to enter a break every once in a while, and each time you enter an interrupt, distance km++

    p1=~distance_km;

    Perform distance km++ for the first time; distance km becomes 1, p1 = distance km; The value of 1 negation is assigned to the P1 port, (the digital tube is a common anode, so the port light-emitting diode with input of 0 is lit,) 1 is 1111 1110, that is, the lowest light-emitting diode is lit.

    Perform distance km++ for the second time; distance km becomes 2, p1 = distance km; 2 The inverse value is assigned to the P1 port, that is, 1111 1101 The second light-emitting diode is lit, and so on.

  16. Anonymous users2024-01-21

    Distance km is a bit inverted 0001010 originally becomes 1110101 The original LED current limiting resistor pulls up 0 is effective, and the purpose of doing this is to make 1 effective light on.

Related questions
12 answers2024-02-09

A: The bit-addressing area is located between 20F and 2Fh in the data memory. The registers in this interval can be bit-addressed, and they can be bit-manipulated and bit-arithmetic. >>>More

8 answers2024-02-09

void key0()

if(p1_0!=1) *If the key 0 is pressed. >>>More

4 answers2024-02-09

The introductory course of MCU C language programming is not difficult, it is not easy to say, and the first thing to understand is to understand what these two things are when learning MCU C language? The introductory programming of single-chip microcomputer is mainly to learn C language, followed by circuit and programming language. >>>More

7 answers2024-02-09

It's too urgent now, you haven't learned the principle of microcomputer yet! >>>More

6 answers2024-02-09

Crash, it may be that the on-site interference is too severe. Anyway, even have abandoned chips that don't have internal program memory and EEPROM. The reason is that it is often not a program problem, but a board and PCB design problem. >>>More