A lot of help
Jefferson
Posts: 8
Hello,
i've been wanting to make a counter with a display.
Two buttons, each triggering a different result.
If button1 is pressed, the IN's should be paused for x seconds.
The counter would add 1 point, a led would be flashing x seconds, a buzzer would sound once.
Unless the counter hits 999, then it should return to 0.
After x seconds, IN's would go back to 0.
If button2 is pressed, the IN's should be paused for y seconds.
The counter would add 2 points, a led would be flashing y seconds, a buzzer would sound twice after two seconds.
After Y seconds the IN's schoud go back to 0.
When idle the led should be burning.
I know it is a lot to ask, but could someone help me translate this into something that might work?
Or put me on the right track?
The display would be a 3x7 segment.
I'm not at all familiar with programming, i've always been more of a "hammer" kind of guy.
But this time i want to make something and it needs a "brain".
A propeller chip is probably a bit over the top for this application, but you've got to work with what you've got.
And when i get more understandig of the language, a project gets more perspective.
Kind regards,
and any help is greatly appreciated,
Jef from Antwerp
·
i've been wanting to make a counter with a display.
Two buttons, each triggering a different result.
If button1 is pressed, the IN's should be paused for x seconds.
The counter would add 1 point, a led would be flashing x seconds, a buzzer would sound once.
Unless the counter hits 999, then it should return to 0.
After x seconds, IN's would go back to 0.
If button2 is pressed, the IN's should be paused for y seconds.
The counter would add 2 points, a led would be flashing y seconds, a buzzer would sound twice after two seconds.
After Y seconds the IN's schoud go back to 0.
When idle the led should be burning.
I know it is a lot to ask, but could someone help me translate this into something that might work?
Or put me on the right track?
The display would be a 3x7 segment.
I'm not at all familiar with programming, i've always been more of a "hammer" kind of guy.
But this time i want to make something and it needs a "brain".
A propeller chip is probably a bit over the top for this application, but you've got to work with what you've got.
And when i get more understandig of the language, a project gets more perspective.
Kind regards,
and any help is greatly appreciated,
Jef from Antwerp
·
Comments
Have you already bought BASIC Stamp or Propeller hardware?
Ken Gracey
Edit: after re-reading, it appears you already have a Prop chip for the project.
mostly because there's a lot of documentation and examples of this sort of thing using a Stamp
and very little yet using a Propeller.
You have a variety of tasks to learn:
1) You need to learn how to read a pushbutton and how to wire it to the Propeller or Stamp or whatever
2) You need to learn how to drive a 3-digit 7-segment display.
There's a ready-made driver for 7 segment displays in the Object Exchange.
Have a look at it: obex.parallax.com/objects/142/
3) You need to learn how to directly control individual LEDs
4) You need to learn how to control some kind of buzzer. The details will depend on the kind of buzzer.
I suggest you have a look at the Propeller Education Kit tutorials and there are some beginner tutorials as wekk:
http://forums.parallax.com/showthread.php?p=791527. Controlling a buzzer is pretty much
the same as controlling a small motor and I believe there are some examples of this in these tutorials.
Start with the BASIC Stamp in this case; it will be much easier. If you bought the Prop from Antratek, I'm sure they can take it back in exchange for a Parallax 90005 kit (if they don't respond in your favor please contact me directly and I will facilitate the exchange). 90005 includes everything you need for your project - LEDs, buttons, BASIC Stamp, etc. Prototype it, then move it to a "permanent" board like the BASIC Stamp Super Carrier Board.
Sure, you can do this with a Propeller. But you indicated this is your first experience. You can start the learning process with a simple tool, and finish the project more quickly. I think you'll be happier with the end result going this direction. Once you get the hang of the BASIC Stamp, some of the Prop's capabilities will seem more useful, and you will probably want to redo the project with a TV for output.
Ken Gracey
Parallax, Inc.
Hope you did not get discouraged by the previous posts. I don't know the Basic stamps, but I can imagine that it would be slightly easier with a stamp. But the propeller/SPIN is still one of the easiest platforms for beginners. I'm currently teaching my 11 year old son how to program in SPIN.
But for being helpful we need some more informations about your hardware setup. Which propeller board do you have? Which 7 segment displays do you use? Did you already get the propeller running with one of the demo-programs? I'd start with the Education kit lab http://www.parallax.com/Portals/0/Downloads/docs/prod/prop/Web-PELabsFunBook-v1.0.pdf
There you can find explained code for switching on/off LEDs and reading a button.
Like MagIO2 said what I would suggest is write us up a do to do list from start to finish we can each take a part fo the code and configure it
So if you already have the schematic and a detailed list of what you wnat the circuit to do we can get started....
Mike
Thanks very much for the overwhelming reply,yes, the prop comes from Antratek, but i'd rather use this because it would be possible to use a tv. (in the future)
I've got these 7 segement displays
: http://www.kingbright.com/manager/upload/pdf/SA40-19SRWA(Ver1191283743.10)
And this is a IC that could be used for interfacing between prop and·the 7segment 3digit display
: http://www.maxim-ic.com/quick_view2.cfm/qv_pk/1339
And i've got the propeller proto board.
I'll do my very best to write down a detailed list of what needs to happen.
I'll keep it as simple as possible, and then i can add and edit the program as i get along.
Thanks mikediv and MagIO2
I will write it down this evening, first gotta do some work.
Best regards,
Jef
·
4 are needed for PC and EEPROM connection, so you have 7 left for LED and buttons.
First of all you only need the knowledge of switching on and off a LED. The mentioned lab will teach you things like that. When you are more familiar with the prop you can add one transistor and drive the LEDs with PWM, so you can dim the brightness in a next lesson. Then maybe you can drive the 7 lines of the displays multiplexed. In that way you learn something about busses and you will only need 7+3 pins to drive the whole display. So, in the end you know how the MAX works internally and learned a lot. And sure, then you can switch to using the MAX reducing the number of needed pins to 3 for driving the display.
Is it a project you have to finish fast or do you prefere the learning aspect of it?
And yes, that is all i want to do for now, just to get me going.
I want to make something to help me with ball practice,
so there is a mechanical part too, and if i have the electronicsand code, i can begin with this.
Once this is finished i'm sure i will want to learn a lot more about the possibilities of the propeller, so i can add things like a TV for displaying past scores and so on.
If you don't have the MAX-IC you can use the Seven-segment display-object
from the obex
download the object and take a look inside the files.
Then came back with any question you have about these file. How to modify them, what to keep, what to drop
whatever your question will be feel free to ask as many concrete questions as you like.
best regards
Stefan
Pin0 = PressureSwitch1······ These would be regular microswitches
Pin1 = PressureSwitch2
Pin2 = Reset
Pin3 = LED
Pin4 = Buzzer
Pin5-15 = 3x7Segment Display
At startup Pin3 = 1
When Pin0 = 1 ,Pin0 and Pin1 should be "0" for x seconds
·meanwhile Pin3 should toggle for x seconds
and Pin4 = 1 for 1s
Count·+1
When Pin1 = 1, Pins0 and 1 should be "0" for y seconds
·meanwhile Pin3 should toggle for y seconds
and Pin4 = 1 for 1s after two second pause
Count +2
If·Count = 999 then reset and toggle Pin4 five times
Happy easter to everyone,
Jef
·
@Jefferson,
Since this is your first ever Propeller project, might I suggest that you consider
breaking this project down into it's 5 or 6 steps. Start with reading a switch,
then toggling an LED, activating a buzzer, then go to learning how to use one
LED display, etc. There is wisdom in using some additional driver IC's (like the MAX),
however this is all doable with a single Propeller.
IIUC, you will need 15 I/O pins, leaving you plenty to upgrade the project later.
Take your time and tackle each part of this project separately, learning how
each function works as you go. We are all here to help you if you get stuck at
any point along the way. After you understand each function, then you'll
have the knowledge to start combining them into your target project.
OBC
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
New to the Propeller?
Visit the: The Propeller Pages @ Warranty Void.
www.parallax.com/Portals/0/Downloads/docs/prod/prop/32212-32812-Protoboard_Introduction.pdf
This will get you started with some BASICS and setup as well as cover goal #3.
OBC
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
New to the Propeller?
Visit the: The Propeller Pages @ Warranty Void.
Post Edited (Oldbitcollector) : 4/13/2009 2:04:19 PM GMT
i borrowed the things i needed from work,
and will start this thing step by step.
I choose to solder little pins onto the proto board, and continue from there to a bread board with a flat cable;
so there's room enough, and i cant mess up the proto board.
I will start by reading a button, and lighting/toggeling a LED and so on.
I will be sure to post my progress as soon as it's there
finally had some time to catch up,
i'm able to make a led blink, and the pushbutton exercise from the labsfunbook works also.
Leaving the 7segments aside for a while, i looked at he object file and could not understand most of it.
exept noticed that the displays i have are common anode
and for now the buzzer will be another led
Now i want to "program" a button,
i'll first dig in to the funbook some more,
regards,
jef
_xinfreq = 5_000_000
_clkmode = xtal1 + pll16x
PUB ButtonsandLEDs
Dira [noparse][[/noparse]0..3] := %1100····· 'Pin 0 = greenLED Pin 1 = RedLED Pin 2&3 = pushbutton n/o
································· ' so 0&1 are outputs 2&3 are inputs
Outa [noparse][[/noparse]0..3] := %1000····· ' the green LED should be on
If outa := 1
··· repeat 20
·· ··· outa [noparse][[/noparse]0] := 1
······waitcnt (clkfreq/2 + cnt)
····· outa [noparse][[/noparse]0] := 0
····· waitcnt (clkfreq/2 + cnt)
····· outa [noparse][[/noparse]0..3] := %1000········ ' the two leds toggle 20 times on startup,
············································ 'it does not matter if i push a button
your codeline
does two things where I guess you intended only one thing
what it really does bit 0 of the outa-register will be set one by the part "outa := 1"
where ":=" is the assigning-operator
after that the value of outa is taken with the if-command
all values different from zero are interpreted as logical TRUE
what I guess what you intended compare a certain SINGLE IO-PIN and if the IO-PIN is HIGH
then do the blinking
therefore you have to use the comparing-operator which is TWO times the equalsign
"==" is ONE compare-if-equal-operator
you need a second repeat-loop
you code starts running and is run through before your finger reached the button
(or you have to press the button already before the boot-process has finished)
you have to specify the IO-PIN
let's assume you want to use IO-PIN No 4
than your code would look like this
best regards
Stefan
it has been a while,
Can you help me out with a basic program, that has a counter for the 7 segment displays, and the ability to count every time a button is pushed.
I took some pictures and hope they will make things more clear.
I have wired the displays( a, b and c)·with two flat cables (1·and 2).
Can someone tell me how i schould connect the 7 segment displays to the propeller proto board,
and how i can connect one push button (n/o) so the counter adds one to the count everytime the switch closes.
I'll then try to add more·buttons and some leds· tot the program on my own.
Thanks in advance if anyone is prepared to give me a push in the back with this programming,
and if there is more information needed i'll be more then happy to share
Best regards
Jef