All About Circuits

Digital Circuits

Microcontroller Principles


20 questions By Tony R. Kuphaldt

Page 2 of 7 0 of 20 answers revealed (0%)
  • Question 4 of 20

    A student decides to build a light-flasher circuit using a microcontroller. The LED is supposed to blink on and off only when the pushbutton switch is depressed. It is supposed to turn off when the switch is released:



    Pseudocode listing Declare Pin0 as an output

    Declare Pin1 as an input

    WHILE Pin1 is HIGH

    Set Pin0 HIGH

    Pause for 0.5 seconds

    Set Pin0 LOW

    Pause for 0.5 seconds

    ENDWHILE

    The LED blinks on and off just fine as long as the pushbutton switch is held when the MCU is powered up or reset. As soon as the switch is released, the LED turns off and never comes back on. If the switch was never pressed during start-up, the LED never comes on! Explain what is happening, and modify the program as necessary to fix this problem.

    Reveal answer
  • Question 5 of 20

    Examine the following schematic diagram and program listing (written in “pseudocode” rather than a formal programming language) to determine what type of basic logic function is being implemented in this microcontroller unit:



    Pseudocode listing Declare Pin0 as an output

    Declare Pin1 and Pin2 as inputs

    LOOP

    IF Pin1 is HIGH, set Pin0 HIGH

    ELSEIF Pin2 is HIGH, set Pin0 HIGH

    ELSE set Pin0 LOW

    ENDIF

    ENDLOOP

    Reveal answer
  • Question 6 of 20

    Examine the following schematic diagram and program listing (written in “pseudocode” rather than a formal programming language) to determine what type of basic logic function is being implemented in this microcontroller unit:



    Pseudocode listing Declare Pin0 as an output

    Declare Pin1 and Pin2 as inputs

    LOOP

    IF Pin1 is LOW, set Pin0 LOW

    ELSEIF Pin2 is LOW, set Pin0 LOW

    ELSE set Pin0 HIGH

    ENDIF

    ENDLOOP

    Reveal answer