Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Scoreboard display on LCD (edsim51)

Status
Not open for further replies.

Reiniku

Newbie level 1
Joined
Nov 29, 2010
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,292
Hello! I'm currently learning the basics of microcontrollers and was given the task of creating a scoreboard to display on the LCD (so 4 digits) and have switches to increment and decrement each displayed digit in assembly. So something like:

0000

Switch 1 and 2, decrements and increments the first digit, 3 and 4 for the second... so on and so forth.

Hitting switch 2 from this point would show: 1000

Switch 4 woudl show: 1100

Etc.

I've figure out how to output to the LCD (thanks to the edsim51 examples) so that my program shows "0000" when run, but I'm not sure how to implement the rest of my code.

I'm not asking how to be spoon fed how to do it but more like I could use some guidance. Would it be possible to use the "switch banks" on the screen to do this? There ARE 8 of them. And do I have to use interrupts to increment and decrement the counters?
 

Hi,

if you have no other task, then polled reading of the keys is fine.
So let´s do some pseudo code in C:

Code:
if (switch1 == low)
{
  if (digit1 < 9)
  {
    digit1++;
  }
 
  // Wait until Switch1 is released again
  while (switch1 == low)
  {
  }
}
else if (switch2 == low)
{
  if (digit1 > 0)
  {
    digit1--;
  }
 
  // Wait until Switch2 is released again
  while (switch2 == low)
  {
  }
}
else if (switch3 == low)
{
  if (digit2 < 9)
  {
    digit2++;
  }
 
  // Wait until Switch3 is released again
  while (switch3 == low)
  {
  }
}
else if (switch4 == low)
{
  if (digit2 > 0)
  {
    digit2--;
  }
 
  // Wait until Switch4 is released again
  while (switch4 == low)
  {
  }
}
...and so on

Hope this helps

Regards

Udo
 

Hi friend

First of all, You can use two type of process for reading switch.
One is Interrupt, for this you have to add some type of additional hardware to interrupt signal.
It is easy for program handling.
Second is polling, It is not required additional hardware, but it require constant attention in program flow.

I am using Polling system for reading switch in my all project.

Second thing is that, why do you use 8 switch in your project,
because your requirement is fulfill with only two switch.

I have done this type of project only with two switch

1) <- (digit selection move left side up to first digit and then rotate to forth digit)
2) ^ (digit increment up to 9 and then overflow to 0)

Hope this is help you
Shyam
INDIA
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top