Help! 5 hours and 19 errors. EASy68k coding Homework.

Discussion in 'Homework Help' started by EmonMaimon, Dec 9, 2015.

  1. EmonMaimon

    Thread Starter New Member

    Dec 9, 2015
    6
    1
    Hi, I am Emon and it is my first time using EASy68k for a subject this semester. I don't have any experience using this program except for the examples given by the lecturer.

    I've tried hard (seriously my brain is about to explode) and I've spent more than 5 hours on this 1 question and after multiple trails and errors I still can't figure out the right coding. :(

    Please help point out my mistakes. :oops:

     
  2. EmonMaimon

    Thread Starter New Member

    Dec 9, 2015
    6
    1
    This is the question. Sorry forgot to attach it earlier..


    [​IMG]
     
  3. WBahn

    Moderator

    Mar 31, 2012
    17,743
    4,795
    How do you get a 7-segment display to display text messages?

    I know it is a contrived problem (which is fine), but the notion that an altitude sensor can tell you if you are flying or parking is ludicrous. A plane can be parked at a couple kilometers above sea level or it could be a couple kilometers above the ground. Normally WOW sensors (weight-on-wheels) are used.
     
  4. RBR1317

    Active Member

    Nov 13, 2010
    232
    48
    display.png
     
    EmonMaimon likes this.
  5. WBahn

    Moderator

    Mar 31, 2012
    17,743
    4,795
    Okay (and thanks). Is there a 7-seg pattern for every letter of the alphabet, or did they just get lucky? Since there are only 128 possible patterns and since most patterns are not going to be recognizable as a character, I'm guessing that there aren't 36 distinct patters (one for each letter and each digit) and that some are repeated, requiring the reader to be able to choose the correct ones from context.

    (And I have the feeling that they are not actually supposed to do this, but that they are using a generic notion of a display.)
     
  6. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    2,805
    833
    Like this, perhaps? Just picked this coding at random, but it makes my point.
    7segment.png
    Note that many are a stretch, but by choosing a method consistently (like M and W) and in context of the more obvious letters (A, C, F, H, J, L, O, P, S) , plus aided by lowercase - it can produce a semi-readable output.
     
    absf and EmonMaimon like this.
  7. EmonMaimon

    Thread Starter New Member

    Dec 9, 2015
    6
    1
    Well, its just a basic homework so I guess the question is fine. Plus this is not my core subject. :/
     
  8. EmonMaimon

    Thread Starter New Member

    Dec 9, 2015
    6
    1
  9. absf

    Senior Member

    Dec 29, 2010
    1,492
    372
    I put your program onto the 68K EDASM and I got 63 errors.:D

    You have to put some comments on each of the lines so people can understand what you're trying to do...

    I dont know what are these addresses $E00012 and $E00000 for. Can you elaborate a little bit?

    Do you think the following codes

    Code (Text):
    1. MOVE.B $%01111001, D4
    2. MOVE.B $%00110001, D3
    3. MOVE.B $%00110001, D2
    4. MOVE.B $%00111111, D1
    5. MOVE.B $%00110001, D0
    is the same as

    Code (Text):
    1. MOVE.B #%01111001, D4
    2. MOVE.B #%00110001, D3
    3. MOVE.B #%00110001, D2
    4. MOVE.B #%00111111, D1
    5. MOVE.B #%00110001, D0
    Allen

    [ps] I am not an expert on 68000. In fact, I've never used a 68k before.
     
    Last edited: Dec 11, 2015
    EmonMaimon likes this.
  10. EmonMaimon

    Thread Starter New Member

    Dec 9, 2015
    6
    1
    Okay I mixed up the # and $ sign. Thank you! :D
     
  11. absf

    Senior Member

    Dec 29, 2010
    1,492
    372
    There is something wrong with your display routine too...

    I read the "help" file of the simulator and the address of each digit to be displayed are in the range $E00000-$E0000E.

    easy68k_hw.PNG

    easy68k_hw_address.PNG

    But in your program, you just put the digit to be displayed in the same address $E00000....

    So I wrote this simple subroutine for you....

    HTML:
    1. DISPLAY     EQU $E00000         ;ADDRESS OF HARDWARE 7 SEG LED
    2.  
    3. LED:
    4.     MOVE.B    D6,DISPLAY        ;First digit on the left
    5.     MOVE.B    D5,DISPLAY+2
    6.     MOVE.B    D4,DISPLAY+4
    7.     MOVE.B    D3,DISPLAY+6
    8.     MOVE.B    D2,DISPLAY+8
    9.     MOVE.B    D1,DISPLAY+10
    10.     MOVE.B    D0,DISPLAY+12     ;7th digit on the right
    11.     RTS
    12.  
    Just link your program to this subroutine with the instruction

    HTML:
    1.    BSR   LED   ;to display what is in D0-D6
    and you will get the messages that you want to see.

    Allen
     
    EmonMaimon likes this.
  12. absf

    Senior Member

    Dec 29, 2010
    1,492
    372
    Of course, there are more logic problems in your program. One thing I am not sure is....

    Are you using the switches in $E00012 as your sensors S1, S2 and the AL?

    And if so, you have to state which bit is S1, and which bit is S2 ......... in your program. You cannot let people go guess when they are reading or marking your work.

    And where is the PB? Was it not needed?

    You dont seem to understand the use of CMP instruction. It just compares the source with destination, and then it changes the flags in status register without destroying the content of the source/destination as in CMP [BWL] s,d. Read the datasheet of 68000 and you'll understand better. The cheatsheet in the help PDF is only good for reference.

    Allen
     
    Last edited: Dec 11, 2015
    EmonMaimon likes this.
  13. EmonMaimon

    Thread Starter New Member

    Dec 9, 2015
    6
    1
    Thank you Allen for your input. I redo the coding last night and tweak a little bit this morning and I finally got it! :D

    Will keep in mind to write the description for each line :D
     
    absf likes this.
Loading...