1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

8085 interfacing I/O

Discussion in 'Assembly Language Programming (ALP) Forum' started by yas, Jan 24, 2009.

  1. yas

    yas New Member

    Joined:
    Jan 24, 2009
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Sorry i'm newbie here and like to learn.I had a problem here can anyone give a code/solution for this problem:
    Question:
    Connect a DIP switch to port B and 7 segment(common Cathode) to port C.Write a program to read input from DIP switch connected to port B and display them on each segment of the 7 segment as show below:

    DIP SWITCH 7 segment
    0000 - all segments off
    0001 - segment A on,others off
    0010 - segment B on,others off
    0011 - segment C on, others off
    0100 - segment D on,others off
    0101 - segment E on, others off
    0110 - segment F on,others off
    0111 - segment G on, others off
    1000 - segment DP on,others off
    1001 - all segment on
     
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    What hardware are you using?
    Have you any code samples you could work from? Adapting existing code is a lot easier than writing code from scratch. For example, do you have example code to read from some ports and write to others?
    What's the background to this; are you learning on your own, or are you on a course?
    If you read the switches simultaneously you can treat the resulting value as a number and use switch logic, e.g.
    Code:
    switch (read_DIP())
    {
    case 0: write_7seg(0); break;
    case 1: write_7seg(1); break; // assumes segment A is at bit zero
    case 2: write_7seg(2); break; // assumes segment B is at bit 1
    
    ...and so on. Code also assumes that setting a port bit to 1 will switch a segment on, but if you have inverting logic then of course you will need to invert this.
     
  3. yasirhs

    yasirhs New Member

    Joined:
    Jan 26, 2009
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    0

Share This Page