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
Click For Summary

Discussion Overview

The discussion revolves around developing a program for the Motorola MC68HC11 microcontroller using the THRSim11 simulator to display a 9-digit student number on a single 7-segment LED display. Participants explore issues related to displaying the digits correctly, the use of hex patterns, and the configuration of the simulator.

Discussion Character

  • Technical explanation, Debate/contested, Experimental/applied

Main Points Raised

  • One participant describes their goal to display a 9-digit number on a 7-segment display, specifying timing for each digit.
  • Another participant questions the specific problem the original poster is facing.
  • A participant suggests that the issue may be related to the connections of the display pins to the microcontroller, indicating that the default connections may not align with the provided hex patterns.
  • One participant proposes an algorithm for displaying the digits, outlining steps for loading values from memory and controlling the display.
  • Another participant expresses frustration with the display not showing the correct digits, suspecting issues with the hex pattern data or program logic.
  • A suggestion is made to use the simulator's features to test the hex pattern data directly by manipulating the pins in the simulator.
  • A participant inquires about the progress of the original poster's program, seeking updates on their attempts.

Areas of Agreement / Disagreement

Participants have not reached a consensus on the specific issues affecting the display. There are multiple competing views regarding the potential causes of the problems, including the correctness of the hex pattern data and the configuration of the simulator connections.

Contextual Notes

Some participants note that the hex pattern data may not work with default connections in the simulator, suggesting that the connections may need to be changed or that new hex patterns should be generated. There is also uncertainty about whether the program correctly accesses the hex pattern data.

Who May Find This Useful

Individuals interested in programming microcontrollers, specifically the Motorola MC68HC11, and those working with 7-segment displays in simulation environments may find this discussion relevant.

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

  • · Replies 2 ·
Replies
2
Views
9K
  • · Replies 1 ·
Replies
1
Views
7K
  • · Replies 10 ·
Replies
10
Views
14K