68000 Programming problem

Discussion in 'Programmer's Corner' started by JLam, Feb 15, 2005.

  1. JLam

    JLam Thread Starter New Member

    Joined:
    Feb 15, 2005
    Messages:
    2
    Location:
    Malaysia
    Hi, I'm new here, i'm having difficulty completing a program on my own. I was given a task to complet 3 programs. I've completed the first 2 but having problems with the last one. Can anybody help me out here? The description of my tasks are below:

    Hardware Configuration

    The hardware configuration of the 68000 applications boards in the laboratory are as shown in Figure 1. Data to all four seven segment displays is supplied via PortB. A display is activated by outputting a logic 1 on the corresponding Port C control line e.g. outputting a logic 1 will turn on the LSD (Least Significant Digit) display.

    Experiment

    1) Develop a 68000 assembly language program to produce a count down sequence on the LSD seven segment display after switch connected to PC4 has been asserted.

    2) Develop a program that will display the hexadecimal equivalent on the LSD seven segment display of any binary input from PortC bits PC4 to PC7.
    (Hint: Use MOVE. B (A0,D0),D1 - Move the byte value from the memory location pointed to by A0 + D0 into D1 where D0 is the four bit value read from the switches).

    3) Complete a program that will read any byte value from PortC and display the corresponding hexadecimal values on two seven segment displays. It will be necessary to time multiplex the displays so that the correct value is displayed on the right display at the right time.

    Like i mentioned earlier, i've completed task 1 and 2 but i'm stuck with task 3. The circuit diagram of the 7-seg is attached below as well as the program for task 2. My lecturer told me that tasks 2 and 3 are similar but no matter how i tried, i still can't make it work. So if there's a kind soul out there, please help me out :( I'll be so grateful to u :D The attachments are below. Thanks.

    Joseph

    Task 2 program:

    PBDDR EQU $A00007 ; DATA DIRECTION REGISTER (TO CONFIGURE I/O)
    PCDDR EQU $A00009 ;
    PBDR EQU $A00013 ; ADDRESS OF PORTS AS SHOWN IN DIAGRAM
    PCDR EQU $A00019 ;

    ORG $400400

    MOVE.B #$FF,PBDDR ; SET PORT B AS O/P
    MOVE.B #$0F,PCDDR ; SET PORT C 0-3 0/P, 4-7 I/P
    MOVE.B #$01,PCDR ; ENABLE LSD OF 7-SEG DISPLAY

    BEGIN LEA DATA,A0 ; DEFINE DATA ADD
    CLR.B D0 ; RESET D0
    CLR.B D1 ; RESET D1
    MOVE.B PCDR,D0 ; GRAB 4 BIT DATA INPUT FR ABITEC
    ASR.B #4,D0 ; SHIFT 4 BITS TO THE RIGHT AND.B #$0F,D0 ; MAKE LEFT 4 BITS TO BE 0

    CHECK SUB.B #$00,D0 ; CHECK I/P NO.
    BEQ DISPLAY

    INCR ADD.L #$01,D1 ; INCREASE DATA ADD BY $1
    SUB.B #$01,D0 ; SUB I/P NO.
    BNE INCR

    DISPLAY ADDA.L D1,A0 ; ADDING DATA ADD
    MOVE.B (A0),D2 ; LOAD THE DATA
    MOVE.B D2,PBDR ; DISPLAY DATA
    BRA BEGIN ; RESTART

    DATA DC.B $3F,$06,$5B,$4F,$66,$6D,$7D,$07
    DC.B $7F,$6F,$77,$7C,$39,$5E,$79,$71

    END
Similar Threads
Forum Title Date
Programmer's Corner Where to get MC68000 Codes Oct 11, 2011
Programmer's Corner [M68000] move.w (a0)+,(a1)+ causes crash! Apr 3, 2009
Programmer's Corner 68000 - Add two numbers Nov 22, 2008
Programmer's Corner MC68000 motorola May 18, 2005
Programmer's Corner basic question on programming ? Nov 17, 2014

Share This Page