Develop a program to display a number, on a single 7 segment LED display

In summary: I ended up with a program that displays the number 9 digits long, one digit at a time, on a single 7 segment LED display. Each digit will be ON for 1 second and OFF for 0.5 Seconds. Once all digits have been displayed the program will stop and the display will be OFF.
  • #1
MirrorM
10
0
Hello

Can someone please help with the following question. Thanks

Develop a program for the Motorola MC68HC11 using the THRSim11 simulator software. The program is to display a number 9 digits long, one digit at a time, on a single 7 segment LED display. Each digit will be ON for 1 second and OFF for 0.5 Seconds. Once all digits have been displayed the program will stop and the display will be OFF.

The program will make use of all CPU internal registers, and will include subroutines for initializing the peripheral registers and the time delays.

Use the following table of information to commence the program.

LABEL MNEMONIC OPERAND COMMENT
prb equ $1004 Perpheral Port B
ddrb equ $1006 Data direction register B
prc equ $1003 Peripheral port C
ddrc equ $1007 Data direction register C

org $0000
hexpat fcb $3f,$06 Hex bit patterns for
fcb $5b,$4f displaying digits 0 to 9
fcb $66,$6d
fcb $7d,$07
fcb $7f,$6f
number fcc '0010049631' Student number with EOD marker

org $00a0
start
 
Computer science news on Phys.org
  • #2
What exactly is your problem?

-- AI
 
  • #3
The problem is I can't get the thing to work. I can get it to display the first 2 hexpat numbers and that's it, but I need it to display the student number, using the hexpat data, i think.
 
  • #4
I haven't worked with Motorola chips. I downloaded the THRSim11 software to check it out. It was fun working with the LEDs and the 7 segment displays.

Anyways,
I noticed that 7 segment display pins 0 to 7 are connected to PB0 to PB7 by default in the simulation software. Now i tried your hex values for 0 to 9 and it didnt work, it means that you have changed the connections. (Or if u haven't changed the connections, then the problem you have stated demands you to change connections).

As for displaying the values is concerned, i will give you an algorithm which you can use. (I am not well aware of the motorola instruction set, so an algorithm is better i suppose)

Assume that the student number is stored in memory at say NUM
Also assume that the LED pins are connected to PB0 to PB7
1. Store hex values of 0 to 9 (i will refer to them as H[0] to H[9]
2. Load one byte of NUM from memory to a register (say Reg)
3. Check whether Reg has value 0 or 1 or 2 ... or 9
4. If Reg has value i then call print procedure with argument H
5. Give 1 second delay
6. Reset all pins and wait for 0.5 seconds
7. If the byte read from NUM was the last byte, stop the process else go to step 2 (which should load the next byte)

The print procedure
1. Load H into register say Reg1
2. calculate Reg1 & 1 and set that value to PB7
3. Shift Reg1 to right by 1 and go to step 2
4. Repeat 2 and 3 eight times.

-- AI
 
  • #5
Ive been trying to get this to work all night without any luck. I can get it to display the required number of digits but they don't look right, I think the hexpat data is incorrect, is there any way I can check it or maybe my program isn't looking at the hexpat data, but I think it is. please help.
 
  • #6
Your simulator has gives u a very easy way to play with your LEDs.
Start the 7 segment display in your simulator and goto View>Pins and choose the appropriate pins to which your 7 segment display is connected.

A Pins window shows up where u can invert the bits and apply all possible combinations to the pins. You can check whether your hexpat data works or not (it doesn't work for default connections, you need to rewire them if you want to use your hexpat data or you can generate an hexpat data of your own, it isn't very hard)

-- AI
 
  • #7
any luck? What program did you end up with?
 

1. What is a 7 segment LED display?

A 7 segment LED display is a type of electronic display that consists of seven segments arranged in a specific pattern to form numbers or letters. Each segment can be individually turned on or off to create different combinations, making it a popular choice for displaying numbers in digital devices.

2. How does a 7 segment LED display work?

A 7 segment LED display works by using light-emitting diodes (LEDs) to create the segments that form numbers or letters. Each segment is controlled by a corresponding electrical input, and when the input is activated, the LED lights up to display the desired segment. By combining different segments, numbers and letters can be displayed on the screen.

3. How can I program a 7 segment LED display to display a number?

To program a 7 segment LED display to display a number, you will need to use a microcontroller or a development board such as Arduino. You will need to connect the individual segments of the display to different digital pins on the microcontroller and write a code that controls which segments are turned on or off to display the desired number.

4. Can I display letters on a 7 segment LED display?

Yes, you can display letters on a 7 segment LED display by combining the different segments in a specific pattern. Some displays come with an extra segment that allows for the display of letters as well as numbers. You will need to refer to a datasheet for your specific display to determine the correct pattern for displaying letters.

5. How many numbers can be displayed on a single 7 segment LED display?

A single 7 segment LED display can display all the numbers from 0 to 9. However, by using multiple displays and arranging them in a specific pattern, you can display larger numbers or even words and sentences. The number of digits that can be displayed depends on the number of segments available and the complexity of the pattern used.

Similar threads

  • Introductory Physics Homework Help
Replies
2
Views
8K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
6K
  • Engineering and Comp Sci Homework Help
Replies
10
Views
13K
Back
Top