EASy68K  
It is currently Sun Dec 16, 2018 10:24 am

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Display string
PostPosted: Wed Aug 18, 2010 4:23 am 
Offline
User avatar

Joined: Mon Aug 16, 2010 3:17 pm
Posts: 4
Location: Malaysia
If button 3 is pressed, the program will display a string on the seven segment display in a motion from left to right continuously.
I have written the code...but address and bus error during exception processing...
what does that mean....can any1 help??
My code is as follows:

Code:
;Main

      ORG       $1000
      MOVE.L   #INTPROG3,INT3      ;INITIALIZE INTERRUPT
      TRAP      #15
      DC.W           7

START      MOVE.W      #$2100,SR       ;INITIALLIZE STATUS REGISTER
           MOVE.L      #$20000,A7      ;INITIALLIZE SSP
           TRAP      #15      ;GET ADDRESS OF SEVEN SEGMENT DISPLAY
           CLR         D0
           CLR         D1
           CLR         D2
           CLR         D3
      CLR         D4
           CLR         D5
           CLR         D6
           CLR         D7
      
;Subroutine Interrupt Level 3(Display string of group members)
INTPROG3   JSR         SEVEN_CLR
           LEA         $4000,A0
RELOOP     MOVE.L      #INITIAL,A0
LOOP       EXG         D0,D1
           EXG         D1,D2
           EXG         D2,D3
           EXG         D3,D4
           EXG         D4,D5
           EXG         D5,D6
           EXG         D6,D7
           MOVE.B      D0,SEVEN0
           MOVE.B      D1,SEVEN1
           MOVE.B      D2,SEVEN2
           MOVE.B      D3,SEVEN3
           MOVE.B      D4,SEVEN4
           MOVE.B      D5,SEVEN5
           MOVE.B      D6,SEVEN6
           MOVE.B      D7,SEVEN7
           JSR         DELAY
           MOVE.B      (A0)+,D0
           CMP.B       #SPACE,D0
           BEQ         RELOOP
           BRA         LOOP
           RTE

;Subroutine Delay
DELAY         LEA       $8000,A6     
      MOVE.L      (A6),-(A7)
              MOVE.L      #$200000,(A6)
UP            NOP
              SUB.L       #1,(A6)
              BNE         UP
              MOVE.L      (A7)+,(A6)
              RTS
           
;Subroutine SEVEN SEGMENT ZERO
SEVEN_CLR    MOVE.B      #0,SEVEN0
              MOVE.B      #0,SEVEN1
              MOVE.B      #0,SEVEN2
              MOVE.B      #0,SEVEN3
              MOVE.B      #0,SEVEN4
              MOVE.B      #0,SEVEN5
              MOVE.B      #0,SEVEN6
              MOVE.B      #0,SEVEN7
              
             RTS

;Data Path
              ORG         $4000
INITIAL          DC.B        G,N,O,H,C,SPACE
              DC.B        W,A,H,C,SPACE
              DC.B       I,N,I,A,S,U,H,SPACE
      DC.B       A,J,A,R,SPACE
      
;Data Path for Alphabet
C      EQU       %00111001
H      EQU         %01110110
O      EQU       %00111111
N      EQU       %01010100
G      EQU       %00111101
R      EQU        %00110001
A      EQU          %01110111
W      EQU       %01101010
U      EQU       %00111110
S      EQU       %01101101
I      EQU       %00000110
J      EQU         %11111000
SPACE      EQU       %00000000

;Data Path for I/O Device
SEVEN0      EQU       $E0000000
SEVEN1      EQU       $E0000002
SEVEN2      EQU       $E0000004
SEVEN3      EQU       $E0000006
SEVEN4      EQU       $E0000008
SEVEN5      EQU       $E000000A
SEVEN6      EQU       $E000000C
SEVEN7      EQU       $E000000E

;Data Path for Interrupt
INT1         EQU         $64
INT2          EQU         $68
INT3        EQU         $6C
INT4        EQU         $70
INT5        EQU         $74
INT6        EQU         $78
INT7         EQU         $7C


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 18, 2010 1:13 pm 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1087
There are several issues with this code.

The END START directive is missing at the bottom of the code.

MOVE.L #INTPROG3,INT3 never runs because it is above the START label when program execution begins.

TRAP #15
DC.W 7
is not a valid trap #15 command

INTPROG3 subroutine/interrupt handler contains an infinite loop. Each time an interrupt occurs information would be pushed on the system stack but never removed.

_________________
Prof. Kelly


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 18, 2010 4:39 pm 
Offline
User avatar

Joined: Mon Aug 16, 2010 3:17 pm
Posts: 4
Location: Malaysia
First of all, thanks for answering me...
the problem is that i need to show the string repetitively if other buttons are not pressed...
what should i do to avoid the infinite loop...
thx a lot...


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 19, 2010 2:53 am 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1087
Try placing the display loop inside the main program body and using the interrupt handler to set a variable that is used by the display loop to control the display.

_________________
Prof. Kelly


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 19, 2010 5:38 pm 
Offline
User avatar

Joined: Mon Aug 16, 2010 3:17 pm
Posts: 4
Location: Malaysia
Sorry...i dun quite understand...
wat does it mean by using the interrupt handler to set a variable that is used by the display loop to control the display.
can u give me an example??


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 19, 2010 9:07 pm 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1087
Code:
* Main display loop

LOOP
    IF.B DISPLAY_ON <NE> #0 THEN.S
       
        ;display scrolling text
       
    ENDI
    BRA     LOOP    ***** INFINITE LOOP *****
   
* Interrupt handler
INT3
    MOVE.B  #1,DISPLAY_ON   ; enable display
    RTE

* Interrupt handler
INT4
    CLR.B   DISPLAY_ON      ; disable display
    RTE
   
* variables
DISPLAY_ON  DC.B    0

_________________
Prof. Kelly


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 20, 2010 4:48 am 
Offline
User avatar

Joined: Mon Aug 16, 2010 3:17 pm
Posts: 4
Location: Malaysia
thx..it worked....
thx a lot....


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group