The single chip microcomputer realizes the LED light, which flashes when the button is pressed and g

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

    Remember to indent the program in the future, otherwise it will be ugly, you have to flash for too long when you press the button again when it is flashing, then your single-chip microcomputer will be confused, whether to start from scratch or continue to execute? The processing of hardware is put into the main function, and your delay is actually software and hardware, which is great, and the LED in the interrupt function is a local variable, and the assignment is still the best, and the local variable system will randomly assign the value, not necessarily the 0 you think

  2. Anonymous users2024-02-04

    What does the landlord mean by writing this?

  3. Anonymous users2024-02-03

    <>2. Add a header file and create a delay function.

    3. Create the C main function.

    4. Add an endless loop effect.

    5. Light up the LED light. p1=0x7e;Binary 11111110.

    6. Add a delay effect.

    Notes:Many companies have launched compatible models of the 51 series, which will have a large market for a long time to come. 51 single-chip microcomputer is a basic entry single-chip microcomputer, or the most widely used one.

    It should be noted that the 51 series microcontroller generally does not have self-programming capabilities.

  4. Anonymous users2024-02-02

    LED should be a variable, a variable that represents whether the LED light is on or off. When you press the switch, s1==0, you will execute led=!led.

    led=!The meaning of LED is the meaning of the opposite, that is, if the original LED light is on, it will become off after the execution of the statement; It turns out that if it is extinguished, it will turn light up after the statement is executed. Press the button to hit the io of the control light, and you can reverse it.

    For example, if(key1==1).

    How do you get an assembler that uses four independent buttons to control the four LEDs on and off?

    The microcontroller is connected to the cathode of four light-emitting diodes L1-L4, and connected to four switches K1-K4 program: org 00h

    start: mov a,p1

    anl a,#0f0h

    rr arr a

    orl a,#0f0h

    mov p1,a

    sjmp start

    It is possible to detect a single keystroke, or multiple keys at the same time.

    Process: Start - read the data from port P1 to port A - move the data in port A to the right 4 times - the content in port A and the data in the F0h phase or the data in port --A to port P1 - return to the start.

  5. Anonymous users2024-02-01

    Press 1 once to turn on, and press again to turn off.

    。I wrote the detection pin ==0 myself, and then de-shake, waiting for release or something was written, but the effect is, when you press it, it has an effect, and it has no effect when you let it go (return to the original state). That is, let him shine, press it and light it up, and let it go and it will be extinguished.

    Embarrassment. What I need is 1 button to make 5 LEDs into running lights.

  6. Anonymous users2024-01-31

    1. First of all, open the programming software Keil uVision4 and create a new engineering file.

    project—— new uvision project...

    Click image for full size" class="ikqb_img_alink">

    2. Then select AT89C52 with the model of Atmel and click OK.

    3. Click the New button on the toolbar to create a new document, then click Save, enter the path to save, and enter the name.

    4. Right-click to add this file to the project folder.

    5. Open the newly created document and write the program in the document.

    6. Click the icon in the box below, write on the target item crystal oscillator: it means that the crystal oscillator is 12m, then jump to the output item and tick the generated hex file, click OK.

    8. We open the ISIS 7 Professional software, add the program to this circuit, and press the start button.

  7. Anonymous users2024-01-30

    You are not right, after holding down the button, the program runs at high speed, and the LED switch cannot be controlled correctly, and the single-chip microcomputer runs to the ON position or OFF position by releasing the time.

Related questions
8 answers2024-02-09

void key0()

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

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

6 answers2024-02-09

In this case, it depends on sp, ret is equal to (sp) pch, sp-1 sp (sp) pcl, sp-1 sp >>>More

16 answers2024-02-09

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

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