Oops! It appears that you have disabled your Javascript. In order for you to see this page as it is meant to appear, we ask that you please re-enable your Javascript!

Reading 1 switch

Home Forums MPLAB XC8 Tutorial Discussions Reading 1 switch

Tagged: 

This topic contains 1 reply, has 2 voices, and was last updated by  Bitahwa Bindu 3 months, 1 week ago.

  • Author
    Posts
  • #5077

    Donakid
    Participant

    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.

     

     

    • This topic was modified 3 months, 1 week ago by  Donakid.
  • #5079

    Bitahwa Bindu
    Keymaster

    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: https://www.studentcompanion.co.za/reading-switches-with-pic-microcontroller-xc8/

     

You must be logged in to reply to this topic.

Select your currency
EUR Euro
USD United States (US) dollar