All About Circuits

Digital Circuits

Microcontroller Principles


20 questions By Tony R. Kuphaldt

Page 6 of 7 0 of 20 answers revealed (0%)
  • Question 16 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 same as Pin2, set Pin0 HIGH

    ELSE set Pin0 LOW

    ENDIF

    ENDLOOP

    Reveal answer
  • Question 17 of 20

    Digital computers communicate with external devices through ports: sets of terminals usually arranged in groups of 4, 8, 16, or more. These terminals may be set to high or low logic states by writing a program for the computer that sends a numerical value to the port. For example, here is an illustration of a microcontroller being instructed to send the hexadecimal number 2B to port A and A9 to port B:



    Suppose we wished to use the first seven bits of each port (pins 0 through 6) to drive two 7-segment, common-cathode displays, rather than use BCD-to-7-segment decoder ICs:



    Write the necessary hexadecimal values to be output at ports A and B to generate the display “42” at the two 7-segment display units.

    Reveal answer
  • Question 18 of 20

    One method of driving pixels in a grid-based display is to organize the pixels into rows and columns, then select individual pixels for illumination by the intersection of a specific row line and a specific column line. In this example, we are controlling an 8 × 8 grid of LEDs with two 8-bit (1-byte) ports of a microcontroller:



    Note that a high state is required on one of port B’s pins to activate a row, and a low state is required on one of port A’s pins to activate a column, because the LED anodes connect to port A and the LED cathodes connect to port B.

    Determine the hexadecimal codes we would need to output at ports A and B to energize the LED in the far lower-left corner of the 8 × 8 grid.

    Port A =

    Port B =

    Reveal answer