Reading 1 switch

Home Forums MPLAB XC8 Tutorial Discussions Reading 1 switch


Viewing 1 reply thread
  • Author
    • #5077

      Design a system (source code with comments) that will:

      1. <span style=”text-decoration: underline;”>display 2 & 1</span> when the switch is pressed for the first time.
      2. <span style=”text-decoration: underline;”>display 7 & 2</span> when the switch is pressed for the second time.
      3. <span style=”text-decoration: underline;”>display 5 & 4</span> when the switch is pressed for the third time.
      4. <span style=”text-decoration: underline;”>display 3 & 9</span> when the switch is pressed for the fourth time.

      The LEDs are connected from an 8-bit PORTD and switches on PORTA.



    • #5079
      Bitahwa BinduBitahwa Bindu

      Hi, you didn’t post your code!

      The way the forum works, you ask questions based on your code when you encounter some problems, maybe some errors or the code is not working as expected, then we can assist. But we can’t write the full code for you.

      Here is a tutorial how to read the status of a switch, might be helpful:


Viewing 1 reply thread
  • You must be logged in to reply to this topic.
Select your currency
ZARSouth African rand
EUR Euro