Look at any product listing on parallax store site, you will find links to everything you need for any of their products including schematics, physical layout etc.
How to break a loop? can you do debug(heard that stamps can)?
The command "quit" is one of many ways to end a loop.
The Propeller doesn't have a built in debug statement like the Basic Stamps. You'll need to use on of the serial objects such as "Parallax Serial Terminal.spin".
If you go though one of the tutorials mentioned you'll see how to use objects and loops.
Since you're using a QuickStart board, you can skim most of the first part of the Propeller Education Kit (PEK). The bottom of page 32 give instructions for building a button and LED circuit. It also provides code to detect a button press and code to light a LED. This is a good introduction to the way the ports work.
The touchpads on the QuickStart don't behave the same as a normal button. You'll probably want to use a real button when building the curcuits shown in the PEK.
how do turn on the ports (not lights) for quickstart
The propeller is a bit different when it comes to ports. There is one 32 bit I/O port, but in spin you can set individual pins or groups of pins as inputs or outputs. For instance a serial port object could set one pin to receive and a second pin send data. A second group of 8 pins could be used as a parallel port. See dira (P 104), ina (P 118), outa (P 175) of the propeller manual (v1.2).
In short, the equivalent commands in SPIN from PBASIC's "High" and "Low" commands is the "outa" command. "outa[pin]~" is the same as "LOW pin", and "outa[pin]~~" is the same as "HIGH pin". Before using either of these commands, though, you must set the pin as an output by using the line "dira[pin]~~" (You can set the pin as an input again by using "dira[pin]~", but they are input by default). In addition, SPIN can set multiple pin states at once from one line of code. "outa[1..8]~~", for example, would set pins 1 through 8 high. You can also use this to set a group of pins as outputs, using "dira[0..7]~~", for example, would set pins 0 through 7 as output pins. In addition to being able to set muliple pin states at once, you can also set specific pin states for a group of pins. For example, if you want pins 1,3,5,7, and 8 to be high and 0,2,4,6 to be low, you could set it as the following:
dira[0..8]~~
outa[0..8] := %010101011
repeat
Keep in mind, the outa statement is followed by a repeat loop because the program will end otherwise.
This is just something quick to get you started, you should read through the Propeller manual for full documentation before you start a project. Hope this helps.
Hopefully you've noticed already, but if not, you will find that in the install folder for the spin tool you have the pdf version of the propeller manual. Use it to understand the commands microcontrolled posted above. With the propeller tool there are also two folders with programs. One contains many objects you can use with your code, and the other has many demos. To get to the demos go to program files/parallax inc/propeller tool/library/demos and you will find a program called parallax serial terminal demo which will show you how to do a debug equivalent for the prop.
Ok, lets say you want to turn on the first port (In which I'll assume "port" is what you are calling a pin). Assuming the first is pin 0, you would first start the external clock of the propeller like so:
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
Don't worry about the values here, they are irrelevant to what you are trying to do and this code is simply copy-pasted as a standard constant for starting the clock. Just copy-paste this onto the top of your code anytime you will use the external Xtal (the metal, oval can on the quickstart board, FYI). You will use it for most code.
Since we are not using any variables or objects, we can start the PUB routine. Just name it anything (I'll call it "Start") and space down
PUB Start
Now we add the dira command to make the first port (pin 0) an output
PUB Start
dira[0]~~
Before you add the outa command, put it inside (or followed by) a repeat loop so that the program doesn't end. If this is omitted, the program will not work and the output will not be high. Denote the repeat loop and put the outa command inside, be careful to indent or the loop will repeat infinatly without ever reaching the outa command.
If you want, you can also separate the pin into a constant so that you don't have to change each individual pin declaration in order to change the pin you are setting as high. You could do that like this:
Keep in mind that both of the above code examples compile into exactly the same code, so they are exactly the same and interchangeable. The later is just better coding habit.
That "black thing" is the pin header. What do you have hooked up to it? An LED? If you give me more details I can help you out. What is your circuit on the Quickstart?
OK, turn on all the ports and see if the LED works. The code below will blink all the ports. Run it and see if your LED responds. If it doesn't, you have something wrong with your LED circuit.
Yes. Pins P0 through P7 are connected to the touch switches, and pins P16 through P23 are connected to the LEDs. The quickstart is intended as a sample device, so these are hardwired in for easy experimentation with the programming of the Propeller. If you want something less restrictive, you can either get a protoboard or wire up a Propeller yourself using the appropriate hardware. If you want to use the quickstart without the LED's or the touch switches, you could also just cut the traces with an exacto knife, but I doubt you could get them working again if you wanted to.
The LEDs are buffered, so you can use the p16-p23 without restriction as Input or Output. It is just so that the LEDs will lit up according to the state of the pins.
You also can use the pins with the touch-buttons for other purposes, just avoid touching the buttons then ...
That's really stupid!!! Who's bugger that put that thing together
You can still use all the pins any way you want. As Microcontrolled said, the LEDs are buffered so they don't interfere with the I/O pins. The touchpads also don't interfere with the I/O pins.
I used all 32 I/O pins of a QuickStart to drive 32 servos. No cut traces. The LEDs and touchpads are there to use if you want but you're free to use the pins in other ways.
You should only have trouble with the LED's or touchpads if:
(a. You will be holding the bare board of the device while operating, as you may touch one of the touchpads and send an unwanted signal. This could be especially disruptive if the line is being used for serial communication.
(b. The circuit is sensitive to current draw. Those LED's, though buffered, will draw a few milliamps of current from the IO pin, though it shouldn't be enough to throw off your circuit.
I don't think that the touchpads/LED's will interfere with your circuits unless they are extremely sensitive (in which case they would probably fail anyway) though I would avoid doing anything time sensitive (serial communication, SD card reading, or keyboard/mouse) over P16-P23 as the touchpad may be unintentionally touched and effect the incoming signal.
As I said before, the quickstart was intended as a sample device, which is why it is sold at (or at least near) production cost. It was not intended as a fully versatile prototyping board, but just an affordable device to demonstrate the capabilities of the Propeller. If you want something for a project that requires more versatility, I suggest buying a protoboard.
to be much easier to setup and use. more stable, cheapest, lowest noise due to shorter runs etc. Just duplicate the ckt from the PEK book. No frills, no conflicts.
FF
The big board floating above the prop is a 12 bit r2r parallel DAC (till I get round to using a chip again)
On the quickstart board itself, you would connect your battery to Gnd and Vin, which is pins 39 and 40 on the header, respectively. (39 being ground and 40 being positive)
If you are using a standalone Propeller chip, you would connect a regulated power supply to pins 9, 29, 12, and 32. Positive to 12 and 32, and ground to 9 and 29. If you are just using the quickstart, though, don't worry about this.
You know, you could answer a lot of these questions quicker if you would look at the Quickstart schematic that I linked to in a previous post.
Comments
I think this has been answered several times.
Mike Green's suggestions
Tymkrs suggestion
Doggiedoc's suggestion
Duane Degn's suggestions
Which "development" board did you end up getting? Was it a QuickStart?
FF
The command "quit" is one of many ways to end a loop.
The Propeller doesn't have a built in debug statement like the Basic Stamps. You'll need to use on of the serial objects such as "Parallax Serial Terminal.spin".
If you go though one of the tutorials mentioned you'll see how to use objects and loops.
The touchpads on the QuickStart don't behave the same as a normal button. You'll probably want to use a real button when building the curcuits shown in the PEK.
The propeller is a bit different when it comes to ports. There is one 32 bit I/O port, but in spin you can set individual pins or groups of pins as inputs or outputs. For instance a serial port object could set one pin to receive and a second pin send data. A second group of 8 pins could be used as a parallel port. See dira (P 104), ina (P 118), outa (P 175) of the propeller manual (v1.2).
This is just something quick to get you started, you should read through the Propeller manual for full documentation before you start a project. Hope this helps.
Under "Help" in the Propeller Tool. Also Mike Green posted a link to some additional tutorials in post #3 of this thread.
"PEK" stands for Propeller Education Kit, by the way. You can download the manual being referenced from this page (For some reason, you can't find this on the Propeller download page): http://www.parallax.com/go/pekit
Since we are not using any variables or objects, we can start the PUB routine. Just name it anything (I'll call it "Start") and space down
Now we add the dira command to make the first port (pin 0) an output
Before you add the outa command, put it inside (or followed by) a repeat loop so that the program doesn't end. If this is omitted, the program will not work and the output will not be high. Denote the repeat loop and put the outa command inside, be careful to indent or the loop will repeat infinatly without ever reaching the outa command.
This will do what you want. The final code is:
If you want, you can also separate the pin into a constant so that you don't have to change each individual pin declaration in order to change the pin you are setting as high. You could do that like this:
Keep in mind that both of the above code examples compile into exactly the same code, so they are exactly the same and interchangeable. The later is just better coding habit.
Hope this helps.
Let me know if it works.
OR you can get one of these next time your order from Parallax: http://www.parallax.com/Store/Components/Other/tabid/157/ProductID/865/List/0/Default.aspx?SortField=ProductName,ProductName
The LEDs are buffered, so you can use the p16-p23 without restriction as Input or Output. It is just so that the LEDs will lit up according to the state of the pins.
You also can use the pins with the touch-buttons for other purposes, just avoid touching the buttons then ...
Enjoy!
Mike
You can still use all the pins any way you want. As Microcontrolled said, the LEDs are buffered so they don't interfere with the I/O pins. The touchpads also don't interfere with the I/O pins.
I used all 32 I/O pins of a QuickStart to drive 32 servos. No cut traces. The LEDs and touchpads are there to use if you want but you're free to use the pins in other ways.
(a. You will be holding the bare board of the device while operating, as you may touch one of the touchpads and send an unwanted signal. This could be especially disruptive if the line is being used for serial communication.
(b. The circuit is sensitive to current draw. Those LED's, though buffered, will draw a few milliamps of current from the IO pin, though it shouldn't be enough to throw off your circuit.
I don't think that the touchpads/LED's will interfere with your circuits unless they are extremely sensitive (in which case they would probably fail anyway) though I would avoid doing anything time sensitive (serial communication, SD card reading, or keyboard/mouse) over P16-P23 as the touchpad may be unintentionally touched and effect the incoming signal.
As I said before, the quickstart was intended as a sample device, which is why it is sold at (or at least near) production cost. It was not intended as a fully versatile prototyping board, but just an affordable device to demonstrate the capabilities of the Propeller. If you want something for a project that requires more versatility, I suggest buying a protoboard.
GG usb not bad, gave away a QS. Found this:
to be much easier to setup and use. more stable, cheapest, lowest noise due to shorter runs etc. Just duplicate the ckt from the PEK book. No frills, no conflicts.
FF
The big board floating above the prop is a 12 bit r2r parallel DAC (till I get round to using a chip again)
If you are using a standalone Propeller chip, you would connect a regulated power supply to pins 9, 29, 12, and 32. Positive to 12 and 32, and ground to 9 and 29. If you are just using the quickstart, though, don't worry about this.
You know, you could answer a lot of these questions quicker if you would look at the Quickstart schematic that I linked to in a previous post.