Shop OBEX P1 Docs P2 Docs Learn Events
Starting Parallax - Page 2 — Parallax Forums

Starting Parallax

2

Comments

  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-12-24 16:30
    brandan wrote: »
    i got Multicore development Board instead of the boe. where's a good tutorial.

    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?
  • brandanbrandan Posts: 52
    edited 2012-12-24 18:53
    It is Quickstart. Is there diagram someplace that said where all the ports are? like where port 1,2,3,4 etc is. Also How do you break a loop?
  • frank freedmanfrank freedman Posts: 1,983
    edited 2012-12-24 19:41
    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.

    FF
    brandan wrote: »
    It is Quickstart. Is there diagram someplace that said where all the ports are? like where port 1,2,3,4 etc is. Also How do you break a loop?
  • brandanbrandan Posts: 52
    edited 2012-12-24 20:44
    How to break a loop? can you do debug(heard that stamps can)?
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-12-24 21:06
    brandan wrote: »
    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.
  • brandanbrandan Posts: 52
    edited 2012-12-25 16:15
    how do turn on the ports (not lights) for quickstart
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-12-25 18:30
    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.
  • kwinnkwinn Posts: 8,697
    edited 2012-12-25 18:31
    brandan wrote: »
    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).
  • MicrocontrolledMicrocontrolled Posts: 2,461
    edited 2012-12-26 06:20
    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.
  • brandanbrandan Posts: 52
    edited 2012-12-26 07:36
    I know how to use dica, outa. The ports wouldn't turn on (but the lights and touch buttuns work). where would I find this "PEK"
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-12-26 07:49
    brandan wrote: »
    I know how to use dica, outa. The ports wouldn't turn on (but the lights and touch buttuns work). where would I find this "PEK"

    Under "Help" in the Propeller Tool. Also Mike Green posted a link to some additional tutorials in post #3 of this thread.
  • P!-RoP!-Ro Posts: 1,189
    edited 2012-12-26 07:50
    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.
  • MicrocontrolledMicrocontrolled Posts: 2,461
    edited 2012-12-26 08:39
    You can also find all the Propeller manuals and resources open for download on this page: http://www.parallax.com/ProductInfo/Microcontrollers/PropellerGeneralInformation/PropellerMediaPage/tabid/832/Default.aspx
    "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
  • brandanbrandan Posts: 52
    edited 2012-12-26 09:49
    can I just have some source code that can turn on one of the ports. First one please
  • MicrocontrolledMicrocontrolled Posts: 2,461
    edited 2012-12-26 10:08
    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.
    PUB Start
    
      dira[0]~~
      repeat
         outa[0]~~
    

    This will do what you want. The final code is:
    CON
    
      _clkmode = xtal1 + pll16x
      _xinfreq = 5_000_000
      
    PUB Start
    
      dira[0]~~
      repeat
        outa[0]~~
    

    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:
    CON
    
      _clkmode = xtal1 + pll16x
      _xinfreq = 5_000_000
      
      highPin = 0  
    
    PUB Start
    
      dira[highPin]~~
      repeat
        outa[highPin]~~
    

    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.
  • brandanbrandan Posts: 52
    edited 2012-12-27 06:48
    I can't get pins on that black thing(on the quickstart board) to turn on. I got lights on and that's it
  • MicrocontrolledMicrocontrolled Posts: 2,461
    edited 2012-12-27 07:12
    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?
  • brandanbrandan Posts: 52
    edited 2012-12-27 07:45
    A led and a resister. I don't the circuit is problem
  • MicrocontrolledMicrocontrolled Posts: 2,461
    edited 2012-12-27 07:52
    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.
    CON
    
      _clkmode = xtal1 + pll16x
      _xinfreq = 5_000_000
      
      firstPin = 0
      lastPin = 31
    
    PUB Start
    
      dira[firstPin..lastPin]~~
      repeat
        outa[firstPin..lastPin]~~
        waitcnt(clkfreq + cnt)
        outa[firstPin..lastPin]~
        waitcnt(clkfreq + cnt)
        
    

    Let me know if it works.
  • brandanbrandan Posts: 52
    edited 2012-12-27 08:35
    It works!!!!!!!!!!!!!!!! It was how I connected it to the board. That's why it didn't work. I need a daigram on which pin is which
  • brandanbrandan Posts: 52
    edited 2012-12-27 10:23
    Is there i/o pins and light/touch-pad that have the same number
  • MicrocontrolledMicrocontrolled Posts: 2,461
    edited 2012-12-27 12:41
    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.
  • msrobotsmsrobots Posts: 3,709
    edited 2012-12-27 12:51
    Cutting traces is a quite hard advice.

    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
  • brandanbrandan Posts: 52
    edited 2012-12-27 17:34
    That's really stupid!!! Who's bugger that put that thing together
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-12-27 17:46
    brandan wrote: »
    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.
  • MicrocontrolledMicrocontrolled Posts: 2,461
    edited 2012-12-27 20:22
    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.
  • frank freedmanfrank freedman Posts: 1,983
    edited 2012-12-27 22:03
    Protoboards? Meh...

    GG usb not bad, gave away a QS. Found this:

    protoprop.jpg



    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)
    1024 x 575 - 87K
  • brandanbrandan Posts: 52
    edited 2012-12-28 10:39
    Witch pins would connect the battery to
  • MicrocontrolledMicrocontrolled Posts: 2,461
    edited 2012-12-28 10:52
    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.
Sign In or Register to comment.