It is currently Mon Mar 30, 2020 9:08 am

 All times are UTC

 Page 1 of 1 [ 5 posts ]
 Print view Previous topic | Next topic
Author Message
 Post subject: 7 segment displaysPosted: Wed Jun 22, 2011 11:50 am

Joined: Sun Jun 19, 2011 1:36 am
Posts: 7
Location: Midwest
How would you write a program to read a decimal number from the keyboard and then display the number on the 7 segment display array? For this question it can be a two digit number but I later need to come up with a 7 or 8 digit number. I know how to read numbers off the keyboard using the "tasks" but no clue how to put said number onto the 7 segment display.

Top

 Post subject: Posted: Wed Jun 22, 2011 2:59 pm

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1118
From clockDigital in the EASy68K examples folder. The comments in the segment7 subroutine explain how to call it.

Code:
*-----------------------------------------------------------
*         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  \$00         digit off
dc.b  \$40         dash

ds.w  0            force word boundary

*----------------------------------------------------------
* Display a digit on the 7-segment display
* Pre:  D3.B contains 1 digit to display
*       A2 points to 7-segment LED to use
* Post: A2 points to next 7-segment LED

segment7:
movem.l   d3/a0,-(a7)      save registers
lea   digits,a0         bit pattern table
and.l   #\$00ff,d3
move.b   (a0,d3),(a2)   display digit
movem.l   (a7)+,d3/a0      restore registers
rts

Note! The segments in the 7-segment display are mapped to every other address in memory. It was fairly common in 68000 computers to have hardware mapped in this manner. The MOVEP instruction is useful when working with this type of peripheral because it accesses every second memory address.

_________________
Prof. Kelly

Top

 Post subject: further clarificationPosted: Wed Jun 22, 2011 3:45 pm

Joined: Sun Jun 19, 2011 1:36 am
Posts: 7
Location: Midwest
That code that was listed will not actually display a number typed from the keyboard right? That is only code for how display decimals on the 7 seg display right?

Top

 Post subject: Posted: Wed Jun 22, 2011 6:49 pm

Joined: Mon Jul 26, 2010 11:43 pm
Posts: 198
Location: Aurora, IL
It displays a single digit, and presupposes you have the address of the LED panel set up.

http://www.easy68k.com/EASy68Kforum/viewtopic.php?t=985

Do you need to read the number a digit at a time? If so use the TRAPs to get characters and process them, if not there is another TRAP to get a decimal number of input.

We're generally loathed to answer homework questions here, dig around a little in the forum and the code examples.

Top

 Post subject: Posted: Wed Jun 22, 2011 7:24 pm

Joined: Sun Jun 19, 2011 1:36 am
Posts: 7
Location: Midwest
From what I was told it would seem that I need to write it to where as I type it on the keyboard it will show up in the 7-seg display.

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 5 posts ]

 All times are UTC

#### Who is online

Users browsing this forum: No registered users and 5 guests

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

Search for:
 Jump to:  Select a forum ------------------ EASy68K Forum    FAQ    Latest Features    EASy68K Questions    68000 Programming Questions    Wish List    Wishes Granted    Undocumented Features    Documented Features    General Discussion    EASy68K Projects