EASy68K  
It is currently Fri May 29, 2020 4:02 am

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: seven segment
PostPosted: Sun Mar 27, 2011 5:27 pm 
Offline

Joined: Thu Mar 24, 2011 4:40 am
Posts: 4
can any1 guild me on displaying countdown of 30 seconds on seven segment.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 27, 2011 5:43 pm 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1122
Check out clockDigital.X68 in the EASy68K examples folder and this post
http://www.easy68k.com/EASy68Kforum/viewtopic.php?t=964

_________________
Prof. Kelly


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 28, 2011 2:24 am 
Offline

Joined: Mon Jul 26, 2010 11:43 pm
Posts: 198
Location: Aurora, IL
Code:
* 30 second count down demo

        ORG     $1000

START
        move.b  #32,d0                  ; trap task to get address of hardware
        move.b  #1,d1
        trap    #15                     ; get address of 7-segment display
        move.l  d1,a4                   ; A4 = Address of 7-segment display

        clr.w   d0
        move.b  d0,0(a4)                ; Clear 4 MS Digits of 7 seg
        move.b  d0,2(a4)
        move.b  d0,4(a4)
        move.b  d0,6(a4)

        move.l  #3000,d0                ; 30 seconds, in hundreths
loop    bsr     out7
        bsr     delay10ms
        dbra    d0,loop                 ; while(D0--)

        MOVE.B  #9,D0                   ; HALT
        TRAP    #15

*-----------------------------------------------------------

delay10ms
        movem.l d0-d1,-(a7)             ; save registers
        move.b  #23,d0                  ; trap task 23
        move.l  #1,d1                   ; delay 10ms (1/100th second)
        trap    #15
        movem.l (a7)+,d0-d1             ; restore registers
        rts

*-----------------------------------------------------------
*         A
*       -----
*     F|     |B
*      |  G  |
*       -----
*     E|     |C
*      |  D  |
*       -----   .H
*
* Bit Number  7 6 5 4 3 2 1 0
* Segment     H G F E D C B A

* bit patterns to form digits on readout
digits:
        dc.b  $3F                       digit 0
        dc.b  $06                       digit 1
        dc.b  $5B                       digit 2
        dc.b  $4F                       digit 3
        dc.b  $66                       digit 4
        dc.b  $6D                       digit 5
        dc.b  $7D                       digit 6
        dc.b  $07                       digit 7
        dc.b  $7F                       digit 8
        dc.b  $6F                       digit 9
        dc.b  $77                       digit A
        dc.b  $7C                       digit B
        dc.b  $39                       digit C
        dc.b  $5E                       digit D
        dc.b  $79                       digit E
        dc.b  $71                       digit F

        ds.w  0                         force word boundary

*----------------------------------------------------------
* Display 4 decimal digits on the 7-segment display (4 LS Digits)
* Pre:  D0 contains number digit to display
*       A4 points to 7-segment LED to use
* Post:

out7    movem.l d0-d1/a0-a1,-(a7)       ; save registers

        lea     digits,a0               ; bit pattern table
        lea     14(a4),a1               ; A1 = 7 segment base, digit 8 (8-1)*2

        move.w  #4,d1                   ; count = #digits
nxtdig:
        divu.w  #10,d0                  ; D0:LOW=D0/10, D0:HIGH=D0%10
        swap.w  d0                      ; get D0%10 in low order word
        move.b  (a0,d0),(a1)            ; display digit
        clr.w   d0                      ; clear remainder
        swap.w  d0                      ; get quotient back into divend
        suba.l  #2,a1                   ; next 7 segment element, backward
        subq.w  #1,d1                   ; count--
        bne     nxtdig                  ; while(count)

        movem.l (a7)+,d0-d1/a0-a1       ; restore registers
        rts

        END     START


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 28, 2011 9:22 am 
Offline

Joined: Thu Mar 24, 2011 4:40 am
Posts: 4
Thx a lot..


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 31, 2011 5:52 am 
Offline

Joined: Thu Mar 24, 2011 4:40 am
Posts: 4
I have try to run the coding u given me on the training board by using hyper terminal.. n i received this message " Insert 7408 AND IC into test socket A, then press <cr> to continue...." have any idea what it means?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 31, 2011 8:06 am 
Offline

Joined: Thu Mar 24, 2011 4:40 am
Posts: 4
Code:
        org     $080c00

        move.b  #$80,$10000d    *set port A control reg to mode 1x
        move.b  #$ff,$100005    *set all bits port A data reg to input
        move.b  #$80,$10000f    *set port b control reg to mode 1x
        move.b  #$ff,$100007    *set all bits port B data reg to output
ccc     clr     d1
ddd     move.b  #$09,d0
eee     bsr     display
        move.l  d0,d7
        cmpi    #$00,d7
        beq     ppp
        subi    #$01,d7
        move.l  d7,d0
        bra     eee

ppp     move.l  d1,d7
        cmpi    #$09,d7
        beq     ccc
        subi    #$01,d7
        move.l  d7,d1
        bra     ddd
display
        move.l  #$00ff,d5
repeat  move.b  #$fe,$100011
        move.b  d0,$100013
        bsr     delay

        move.b  #$fd,$100011
        move.b  d1,$100013
        bsr     delay

        subq.l  #$1,d5
        bne     repeat
        rts


delay   move.l  #$01ff,d6      *delay count
del1    subq.l  #1,d6
        bne     del1
        rts

        end   


anyone can hepl me modify the coding so that i can display count down of 30 seconds, i run the coding n get countdown from f to zero for the msb segment.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 31, 2011 2:47 pm 
Offline

Joined: Mon Jul 26, 2010 11:43 pm
Posts: 198
Location: Aurora, IL
juggernaut wrote:
I have try to run the coding u given me on the training board by using hyper terminal..

The code is designed to work on EASY68K, I know nothing about your board.

Format your code with the "code" tags, and comment it.


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 13 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:  
cron
Powered by phpBB® Forum Software © phpBB Group