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

  • Thread starter Thread starter MirrorM
  • Start date Start date
  • Tags Tags
    Led Program
AI Thread Summary
The discussion focuses on developing a program for the Motorola MC68HC11 to display a 9-digit student number on a 7-segment LED display using the THRSim11 simulator. The program should display each digit for 1 second and turn off for 0.5 seconds, utilizing internal CPU registers and subroutines for initialization and timing. Users encountered issues with displaying the correct digits, suspecting problems with hex pattern data or pin connections. Suggestions included verifying the connections in the simulator and using an algorithm to load and display each digit sequentially. The conversation emphasizes troubleshooting and refining the program to achieve the desired output.
MirrorM
Messages
10
Reaction score
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
What exactly is your problem?

-- AI
 
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.
 
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
 
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.
 
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
 
any luck? What program did you end up with?
 

Similar threads

Back
Top