little project ...
elecnoob
Posts: 123
hi,
it's the first time i want to use the prop. chip so i don't really know the chip, but i programmed already 2 years in vb.net and i also programmed a 8051 but that's in assembly code...
but what i want to do is to make a king of "game console" ...
in this console i want to program 6 games. And 1 of the games is a twister wit 8 in and outputs ..
but now my question is ...
how do i get started the best ...
and can i compare the inputregisters with the output registers?
it's the first time i want to use the prop. chip so i don't really know the chip, but i programmed already 2 years in vb.net and i also programmed a 8051 but that's in assembly code...
but what i want to do is to make a king of "game console" ...
in this console i want to program 6 games. And 1 of the games is a twister wit 8 in and outputs ..
but now my question is ...
how do i get started the best ...
and can i compare the inputregisters with the output registers?
Comments
first of all: good thread-start as you write something about your Software-knowlegde.
you are free to define any of the 32 IO-Pins in any combination as Input or Output.
So for comparing 8 inputs with 8 outputs you would load the status of the inputs to a variable
and compare the content of this variable bitwise with a variable that represents the output-state(s)
Do you think about a game-console with video-output?
What kind of video-output NTSC-TV-Signal or VGA-Signal?
Do you want to make very simple grafics like this stoneold "PONG" game or TRYING to coming close to
Playstation one ?
(the propeller is pretty good at grafics like the Hydra-games show but it stays at quite some
distance to Playstations)
would you like to start at low-cost or is a hydragame starterset not too expesnive?
after answering this questions it's much easier to say something about how to getting started
gest regards
Stefan
it's more something hadwareminded.
to say it easy
it must be 8 led's that the prop. chip must light up in a radom order
so you can "remake it" with normal switches
this is the easy version of the hardware ( the test version")
"how the "console" must look like"
later i want to make a bord that stands up ( where the led's are in ) and on the flor squares where you can step on ( switches)..
tnx stefanL38 for the help
but can i compare the inputregister with th outputregister?
because if this is possible
i can save the binaire code of 1 ledflash" and later if you need to "remake it with the switches" you just compare the inputregister with the output register
when this is the same you can go on .. when it's not you need to start over.
or is there an more easy way to do it ?
Graham
yes i have a propeller proto board
#32212 and i also have the usb connection to attach to this ..
these education kit tutorials... aren't they the same as in the datasheet? because i read these ..
graham:
i know that you can copare with the if function..
but i wasn't sure if could compere these 2 registers .. 8051 if i'm not wrong . .has a special register some you can't copare with an other 1 .. so i wasn't sure about this
From the kinds of questions you're asking and your background, I think you should start with the tutorials and actually do them, not just read them. This is a very different sort of animal from an 8051. It's both simpler in some ways and much more complex and rich in other ways.
If you have the Accessory Kit for the Protoboard, hook up a keyboard and VGA monitor, download FemtoBasic from the Propeller Object Exchange and put it on your Protoboard. It will allow you to "play" with LEDs and switches. It's a simple Basic interpreter rather than Spin, but it has Spin's access to the I/O and all the operators of Spin.
maybe 1 other question . about the comparing of the inputregisters and outpoutregisters..
can i compare the on byte lvl ?
are there adresses in where i can referend to .. ?
but i don't really onderstand the last part of your last post ...
what is the point of doing that ?
The point of using FemtoBasic is that it's an interpreter that allows access to the I/O pins the same way that Spin does (among other things). You could actually wire up your LEDs and switches (temporarily if you want) and see what it takes to make your algorithm work. You can display debug information on the VGA screen and interact via the keyboard. You can even connect an SD card and load/store/run programs from the card. One of the folks at Parallax used this to make a kiosk to run a variety of demonstration programs.
and srry about the ina and outa question . .but it was/ is a part i didn't/don't understand 100%
bbut i will read it again .. and try to understand ...
tnx for all this information
For your random pin function.
I think this is right... but we'll know for sure when Mike Green agrees[noparse]:)[/noparse]
i? will set i to a random number
so x:=i? will set x to the same random number
x:= ||i? will set x to the absolute value of a random number, i
i//8 will return the modulus of i divided by 8
so ||i//8 will return the absolute value of the modulus of i divided by 8 (which is always between 0 and seven)
so x:= ||i?//8 will return a random number between 0 and 7
if you have a continuous range of 8 pins...beginning at startpin
x:=startpin + ||i?//8 will return a what looks like a random pin from your range of pins to the variable x
Rich
because somthimes it's a little complicated
but tnx
x:=startpin + ||i?//8 will return a what looks like a random pin from your range of pins to the variable x
only this i don't really understand ..
and are you sure that it gives a number from 0 to 7?
because a random makes the numebers from -214748368 to +2147483647.
// a remainder operator... so 25//7 returns a 4... the remainder of 25/7... "25 divided by 7 is 3 with a remainder of 4" the result of a // function is always smaller than the number on the right side of the operator. So, if you divide by 8... you will get remainders in the range of zero to seven.
There is a nice discussion of the absolute value operator, || on page 261 of the manual.
The random function is actually a little more complicated than I suggested... see page 264
Unless you want the game to go through the same sequence you have to use the ? function with a variable... that's why I used "i"... you would need to index a value (in this case, i) to give a unique sequence each time... the manual is better at explaining this than anything I can say about it.
These kinds of expressions are naturally confusing... and then one day... you'll start to believe that there can't be a better way to do it.
a pseudocode for this expression would be something like:
X:=i?
x:=||x
x:=x//8
x:=startpin + x
But Spin let's you put the whole thing together so x:=startpin + ||i?//8
Spin is case insensitive... so you can write X or x and it means the same thing.
it works.
Rich
x:=startpin + ||i?//8
thank you very mutch ..
but i still don't understand the startpin thing ( srry )
for the random number .. there shouldn't be a same order of the number ..
for example
1 , 1 , 8 , 6 , 5 =ok
1 , 8 , 7 , 9 , 3 = ok
so it really dosn't matter
I was assuming that you will be using 8 pins AND that they would be consecutive... so 8 pins from say pin 16 through pin 23. The startpin would be pin 16... so you have that as a constant declaration.
Con
startpin=16
And I think that you want to light up an led connected to one of these pins... chosen randomly.
You choose a pin... using the above routine.
I don't understand your third section... but I think you have the right idea.
Rich
and my thirtsection ..
i just wanted to say that numbers may be repeated
you spoke about a sequence in your previose post .. so that's why i said this
And then there is the video... you'll need to ask some pretty girls to demo your U-tube invasion.
Keep us posted.
Rich
the repeat is NOT a problem so i don't need the array
and i also don't need a video because i'm gone make it only hardware .. with led's and that stuff .. look up in 1 of my other postes
but i was looking in the manual pg 106
and i was wondering how i need to put it in a register . .does it save it automaticly in the output register or do i need to save it in the register?
for lighting a led it would be something like this
var
long i
long x
con
startpin = 16
pub twister
dira[noparse][[/noparse]16]~~
x:=startpin + ||i?//8
!outa[noparse][[/noparse]X]
x:=startpin + ||i?//8
dira[noparse][[/noparse]16]~~
!outa[noparse][[/noparse]X]
If you want to make the whole thing... you could make 2 and I'd pay for 1... makes it free to you!!!
I like the video idea.
Don't you want to be famous?
Rich
dira[noparse][[/noparse]startpin]
..
outa[noparse][[/noparse]startpin]
hope you have the ~~ business straight... have to look it up everytime I use it... I prefer 1's and 0's.
Rich
dira[noparse][[/noparse]X ]~~ ==> this is 16 in your post .. but if i say X then it's the number of the random number .. no ?
!outa[noparse][[/noparse]X]
and i will think about it ..
but it's not only a twister that i'm making .. i want to make 5 other games in it to so ..
The first thing anyone should do... is try to figure out how to make some bucks out of their hobby...it keeps the significant others under control.
You could always offload the manufacturing[noparse]:)[/noparse]
Rich
the 1 and o's? what is it about ... ?
because i don't think i read that in the manual..
and then we will see
but the code .. shoul'd it work with the X ?
At the risk of being repetitive, a lot of what you're going through is dealt with in the Propeller Education Kit's tutorials. There's also useful information in the "sticky thread" called "Propeller Programming Tutorials, Object Exchange, Tricks and Traps stickies". I would suggest you start with simple stuff, avoid the fancier operators and statements. The advantage of the tutorials is that they already focus on basic concepts and, when you've used those and gotten stuff to work, then you can try fancier stuff to accomplish the same things and go from there.
then try
output[noparse][[/noparse]x]:=1...
I hate the ~~ because the first time I saw it... I got it backwards... then the next time I saw it... I got it right... then the next time I got it backwards...
etc. When you get old... memory is like that.
Rich
On the video front... one of the ways that you can give PROPer praise to the Parallax team is to go that little extra and bring the Propeller to the attention of other people... a nice video in the right place does that[noparse]:)[/noparse]
AND you have just the right project!!!
does the input and output register save on there own or do i need to save it ..
( i can't find it in the manual and there are no excerises on )
tnx mike for the tip... and i will try to do them .. but i need to get this finished before the end of august because then school starts again .. and i don't have that mutch time...
What do you mean "save on their own"?
There's no "saving" involved. That's why there's no description in the manual. The bits of the INA register always give the state of the I/O pins (they're wired that way). Obviously, if a pin is set up as an output using the DIRA register, the input state is the same as the output register state.
When you set a bit in the OUTA register (and that I/O pin is set up as an output), the I/O pin state becomes what is in the OUTA register bit. The Propeller Block Diagram (in the datasheet and on the website) shows how the output hardware is wired up internally.