[b][red]This message was edited by dewailers at 2006-9-5 7:53:31[/red][/b][hr]
Hi guys.Am totally new to ass lang.I have to design a game based on the specifications below.Any and all help will be greatly appreciated.
.Using an 8051 microcontroller, construct a system (game) with 8 push buttons and 8LEDs.
Each switch and LED is representing a unique musical note (do,re,mi,fa,so,la,ti,do).
The game starts by randomly playing some musical notes one at a time and turning on the corresponding LED.
The player is required to repeat the correct order by pressing the switches.If correct order is produced,
game proceeds to the next level(longer sequece of musical notes in a shorter time).
If the order is wrong the game restarts.
The game should include a 7-seg display to show the remaining time.
Comments
:
: .Using an 8051 microcontroller, construct a system (game) with 8 push buttons and 8LEDs.
: Each switch and LED is representing a unique musical note (do,re,mi,fa,so,la,ti,do).
: The game starts by randomly playing some musical notes one at a time and turning on the corresponding LED.
: The player is required to repeat the correct order by pressing the switches.If correct order is produced,
: game proceeds to the next level(longer sequece of musical notes in a shorter time).
: If the order is wrong the game restarts.
: The game should include a 7-seg display to show the remaining time.
:
:
:
:
Start coding!!!
No, since I love designing I'll give you some hints here.
Here's some psuedo code (that looks a little like C)
[code]
start:
init everything
level = 0
loop:
for a = 0 to level{
note = randomly generate
output note
array[a] = note
}
t = 1/level*100 //some formula
for a = 0 to level{
if(t-=getInput(t) != array[a]) //ok this looks wierd, but I hope you get it...
goto start
}
level++
goto loop
goto start
output(note){
output to led: note
output as sound: note
}
time getInput(time){
t = currentTime
do {
if got input
return t-currentTime, input //see the wierd code above
}while(t>currenTime-t)
}
[/code]
If you don't get something then reply.
This should be rather easy to convert to assembly
I don't know 8051 assembly, but I know x86, and they should be pretty the same.
: :
: : .Using an 8051 microcontroller, construct a system (game) with 8 push buttons and 8LEDs.
: : Each switch and LED is representing a unique musical note (do,re,mi,fa,so,la,ti,do).
: : The game starts by randomly playing some musical notes one at a time and turning on the corresponding LED.
: : The player is required to repeat the correct order by pressing the switches.If correct order is produced,
: : game proceeds to the next level(longer sequece of musical notes in a shorter time).
: : If the order is wrong the game restarts.
: : The game should include a 7-seg display to show the remaining time.
: :
: :
: :
: :
:
: Start coding!!!
:
: No, since I love designing I'll give you some hints here.
:
: Here's some psuedo code (that looks a little like C)
: [code]
: start:
: init everything
: level = 0
:
: loop:
: for a = 0 to level{
: note = randomly generate
: output note
: array[a] = note
: }
: t = 1/level*100 //some formula
: for a = 0 to level{
: if(t-=getInput(t) != array[a]) //ok this looks wierd, but I hope you get it...
: goto start
: }
: level++
: goto loop
: goto start
:
: output(note){
: output to led: note
: output as sound: note
: }
:
: time getInput(time){
: t = currentTime
:
: do {
: if got input
: return t-currentTime, input //see the wierd code above
: }while(t>currenTime-t)
: }
: [/code]
:
: If you don't get something then reply.
:
: This should be rather easy to convert to assembly
:
: I don't know 8051 assembly, but I know x86, and they should be pretty the same.
:
Thanks for the immediate response.Although i have one question,how do u convert this program to machine language?Like i said,am totally new at this kind of programming.Thanks in advance.
: Thanks for the immediate response.Although i have one question,how do u convert this program to machine language?Like i said,am totally new at this kind of programming.Thanks in advance.
:
I would recomend that you learned some assembly then.
Get a compiler for your specific platform (don't know if it exist...)
Learn the language, and start coding.
One warning though, learning to program could take years...