Shop OBEX P1 Docs P2 Docs Learn Events
Propeller Ability Questions — Parallax Forums

Propeller Ability Questions

Keith KingKeith King Posts: 7
edited 2006-11-21 13:15 in Propeller 1
Hello everyone, I'm new to the electronics world of programming boards to do your bidding so forgive any ignorance or annoying "duh" questions.· I'm just trying to get some basic information on Parallax's products·and after speaking with Parallax's tech support, they referred me to the forums.· My only objective is to find out if any of the products Parallax sells will do what I need, and if so, which ones so I can make a purchase.

Here is some background information to help understand what I'm trying to do.· I work for a manufacturing plant and·they have me·on a project to come up with a solution for a·computer controlled (PC)·life cycle test of our pnemumatic valves.· Basically, run the valves until they die and then be able to give a·count of how many cycles the valve did before it died.· Pretty simple, right?

Knowing that, I'm looking into any/all computer controlled boards that will allow me to turn individual pins·off and on·(0 volts to·3.3+ volts)·independent of each other.· The example I have been using is I want to have one pin turn on for 500ms and off for 500ms.· Then a different pin on that same board to turn on for 50ms and off for 50 ms.· Preferably I'd like to have a·programming language like Java or C++, but I know Parallax uses Spin or assembly to control their boards.· If the hardware can do it, then I'll deal with the programming of it (I have a BS in Computer Science).· I would also like something that plugs into the USB port, but if it is scalable (I'll explain in a minute) then I don't care how it hooks up (serial, parallel, whatever).

Currently I'm using an IO Warrior board which almost does the job.· The only problem is, whenever you write to a port on·the board (4 ports each with 8 pins, so 32 I/O pins), it will turn all pins on that respective port·to their on state for a few milliseconds. and then set it to the requested state.· It's enough of a blip that it would activate valves that are suppose to be off.· The other problem (which I worked around) was it required me to do byte writes (8 pins) instead of single pins.

The main reasons we decided to go with IO Warrior were we needed something with·many outputs (ultimately we need 90) and that is scalable.· IO Warrior has 32 I/O pins which can be used for either input or output in any combination.· The programming libraries are available in C++ and Java (I couldn't get it to work in Java because of lack of documentation) and allows me to connect multiple devices and address them independent of each other.

So my question is, does anyone know of any Parallax products that I could program to do the above?· If you need more information from me, or I forgot to add something, please post a reply as I will be keeping a sharp eye on this post.

Thank you in advance.

Comments

  • Beau SchwabeBeau Schwabe Posts: 6,547
    edited 2006-11-20 16:55
    Keith King,

    The Propeller is fully capable of meeting your needs. ...You mention "...The only problem is, whenever you write to a port on the board...it will turn all pins on that respective port to their on state for a few milliseconds. and then set it to the requested state." This would be a characteristic during programming the chip, but for communicating to the chip this will not be an issue.

    The Propeller Demo board and PropStick USB have a USB2SER adapter built-in to the board, which can be programmed through any platform that supports serial communication.
    Alternatively a Prop Clip or Prop Plug would provide you with the same result.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.

    Post Edited (Beau Schwabe (Parallax)) : 11/20/2006 5:01:12 PM GMT
  • Keith KingKeith King Posts: 7
    edited 2006-11-20 17:00
    Thank you for your reply.

    Just so it's perfectly clear for me, you're saying when I would upload ("during programming the chip") a program to the board (if that's how this one works) it would blip all of the outputs. After that, just turning a pin on or off would not blip them. If that's the case, this board should work just peachy.

    Is that statement correct or am I misunderstanding how the propeller works?

    The reason I want to clarify that is because I have worked on two different types of boards. One board (TINI) required me to upload a java program to the flash memory on the board itself and then I used telnet to talk to the board and run the program. The other (IO Warrior) did not require me to upload a program to the board but instead it did all of its communication via USB. There was no onboard flash memory that stored the program.

    Thank you for any additional information.
  • Beau SchwabeBeau Schwabe Posts: 6,547
    edited 2006-11-20 17:11
    Keith King,
    You said...
    Just so it's perfectly clear for me, you're saying when I would upload ("during programming the chip") a program to the board (if that's how this one works) it would blip all of the outputs. After that, just turning a pin on or off would not blip them. If that's the case, this board should work just peachy.
    That's correct, the I/O pins will fall into an Input state during programming.·· During communication, as long as your program·does·not affect the DTR pin, the pins will not "Blip".
    Flipping the DTR line is what prepares the Propeller·for programming.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • cgraceycgracey Posts: 14,133
    edited 2006-11-20 17:36
    Keith,

    I think that for the sake of simplicity, this project might be more easily done with a BASIC Stamp II and a serial LCD module. The Propeller would allow you to add a video display and mouse/keyboard, and possibly expand your system more easily in the future, but for what you've described, a BASIC Stamp II would meet your needs with an easier learning curve.




    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Chip Gracey
    Parallax, Inc.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2006-11-20 17:46
    If the "blipping" is an issue (e.g. if the errant blip causes a solenoid to pulse), this can be cured with a pull-up or pull-down resistor on the controlling pin that holds it in a desired state during reset.

    -Phil
  • Keith KingKeith King Posts: 7
    edited 2006-11-20 18:36
    Thank you for that clarification Beau Schwabe.· So this is a board I upload my program to and it·runs the program on the board instead of from the PC.· That leads to another question, how do you run a program on the board then?· Is it similar to the TINI board and that you telnet to the board and run it in that fashion?· I know I'm getting into some nitty-gritty detail here but you guys seem pretty knowledgable and any information you can provide is greatly appreciated.
    Chip Gracey (Parallax) said...

    Keith,

    I think that for the sake of simplicity, this project might be more easily done with a BASIC Stamp II and a serial LCD module. The Propeller would allow you to add a video display and mouse/keyboard, and possibly expand your system more easily in the future, but for what you've described, a BASIC Stamp II would meet your needs with an easier learning curve.




    The only question I have for you is will the BASIC Stamp II and a serial LCD module allow me to scale?

    Specifically what I mean is, can I add more boards at a later date and address them in a similar fashion?· We are currently doing a lab expansion and they already have a need for 68 pins, which is why I'm planning for at least 90 (96)·pins.· I read that the propeller had 32 I/O pins.· If I bought 3 boards, can i access all three boards via the same program providing I write it in such a fashion?· This question applies to both the BASIC Stamp II w/ serial LCD module and the propeller board.· They dont need to be daisy chained or anything like that, I just need to be able to plug multiple boards (somehow) into a single PC.· Maybe I'm not fully understanding how the interface between the computer and the board is.

    At this point in time, they have not expressed a need for anything high end (relatively speaking)·like the video display, mouse, keyboard or anything like that.· Honestly, I don't think this·project will have·a need for anything like that.· The·valves (and boards) are in a·room·by themselves, nobody is sitting there monitoring them.·

    I'm totally open to any products Parallax has that will fit the bill.· I'll start doing more extensive research on parallax's website to get more info regarding the BASIC Stamp II and serial LCD module.

    Phil,·thank you for your reply.· If I'm understanding what you're saying, then I don't think that will solve the problem.· It's not just during the reset of the board, its everytime a change is written to the board.· For example:· Pin 1 is blinking at 500ms on, 500 ms off.··Every 500 ms the whole port (all 8 pins) will be set to their on state for a few milliseconds.· Again, I'm not an electronics guy but hopefully this helps clarify the issue.· Or maybe I'm misunderstanding what you're saying.

    Thank you all for your replies.· They are all greatly appreciated.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2006-11-20 18:47
    Keith,

    Sorry, I misread your original post. This sounds like an issue endemic to the I/O Warrior board.

    -Phil
  • Keith KingKeith King Posts: 7
    edited 2006-11-20 18:53
    Phil Pilgrim (PhiPi) said...
    Keith,

    Sorry, I misread your original post. This sounds like an issue endemic to the I/O Warrior board.

    -Phil
    Not a problem, I just wanted to make sure I wasn't misunderstanding you.· I agree, I think its either·a bad design in the board or maybe its a problem in their libraries in C++ on how they write to the board.· It was rather frustrating to finally get·the program working only to find out it blips the entire port when I write to it...
  • Kevin WoodKevin Wood Posts: 1,266
    edited 2006-11-20 19:08
    Keith, you might want to download & browse through the "What's a Microcontroller" text. It's a good intro to working with the Basic Stamp, and the concepts will carry over to other microcontrollers.

    As for the PC connection, you need some way to interface with a serial or USB port. Depending on your PC needs, you may need to create a GUI, but it's basically just 2-way serial comms.

    All of the Parallax microcontrollers have some pros and cons, but in a nutshell, the Basic Stamps have the most support material available, the Sx chips next, and the Propeller last. This is a reflection of time in market & market penetration. With regards to overall processor ability, the Basic Stamp is at the low end, the SX is next, then the Propeller is the high end.
  • HobbybotistHobbybotist Posts: 4
    edited 2006-11-20 19:14
    If you are already familiar with Java, the Javelin Stamp with an I/O expander sounds like it may also work.



    Ed
  • Keith KingKeith King Posts: 7
    edited 2006-11-20 19:17
    I was just reading through the BASIC Stamp FAQ which answered alot of my questions and unfortunately is leading me away from this product as a solution. The reason is because those pins that will be turned on and off are not static. They will be user defined and we will need at the least a terminal into it via telnet or something similar so our guys can activate pin x, run some program on that pin, and then fill in the parameters that program requries, and when they're finished it'll take them back to the main menu so they can choose another operation.

    For example, during our life tests we will be removing valves that have died and replacing them on the fly. During which time, other valves will still be going. So we will need to have a user interface, via the computer, to turn pins on and off and change the rates at which they were running.

    I probably should of mentioned that in my original post. I figured I forgot something.

    To further clarify:

    Pin 1 is running a valve at 500ms on, 500ms off
    Pin 2 is running a valve at 100ms on, 100ms off
    Pin 3 is running a valve at 50 ms on, 50 ms off

    If the valve connected to pin 2 dies, they want to be able to retrieve a count of how many cycles the valve executed before it died, then replace that valve with a new one which may be at a different rate of say 250 ms on, 250 ms off. And the programs may be more complex then that, I have been using the simple on / off as an example. The more complicated ones were maybe several steps. Such as, on for 50 ms, off for 100 ms, on for 125 ms, off for 150 ms, on for 150 ms, off for 200 ms and then cycle back to 50 ms on, 100 ms off... etc.

    Maybe the BASIC Stamp isn't what we need? Or am I missing something?

    I'll take a look at the Javelin Hobbybotist suggested.
  • GadgetmanGadgetman Posts: 2,436
    edited 2006-11-20 19:53
    All the 'programs' you want to run are sequences of on and off periods, right?
    Does all 'programs' start at the same time, or will they be started whenever a unit is replaced, with all the others still running?
    (In the first case, a BSII is probably OK, but in the latter one, a Propeller may be necessary)

    What you need to build is an interactive 'interpreter' system.
    Part of it is the 'user shell' which loops, (ask for input, parse and store commands)
    The other part is the 'executive' which scans through all the waiting 'programs' and based on the clock, runs the commands for them.

    With a Propeller, one COG can do the II part, leaving the rest of the COGs to scan the programs for events waiting to happen. You can even dedicate one or more for 'external events' (Measuring pressure or some other signs of a failed component)

    The Propeller has 32 I/O pins, which isn't enough for your needs, and even fewer if you subtract the Serial Port and the EEPROM.

    If you add a 74xx138 (3-to-8 decoder) and connect the outputs to the Chip-Enable pins of 8 x 74xx373 Latches, you'll turn 11 pins into 64 outputs...
    (How many you can actually run depends on how fast your code is, of course)

    Need more?

    Save one COG for future, and use it to transfer commands to another Propeller connected to the first using a two-pin serial connection.
    All the data goes through the first Propeller, transparently to the users.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Don't visit my new website...
  • Keith KingKeith King Posts: 7
    edited 2006-11-20 20:13
    Thank you for your reply Gadgetman. That sounds like what I want to build. The 96 pins do not necessarily need to all be on a single board or even connected to each other. They just need to be controllable from a single PC. If I can hook up 2 or more to my usb ports then I can expand well beyond the scope of this project (254 theoretical devices on USB, right?)

    I'd be happy with 3 boards, each with at least 24 (thats bare minimum but the more the better) hooked up via USB that i can upload a program to and run it via a terminal screen. The program running on each board would have to be multi-threaded (Java can do this, I don't know about Spin) to handle each pin being independent of each other. The way I'm doing it now is I have each pin running in its own thread.

    The Javelin board looks so far like its going to do the job. So far it seems like it'll do everything I need.


    The program I'm using on the IO Warrior Board is a multi-threaded C++ program. It's broken up into three main pieces.

    When the program starts it first creates what I call the "Master Loop" thread. This thread just loops until you tell the program to quit. It is the only thread that actually writes to the board while the program is in execution mode. It waits for a global variable called "change" to be set to 1. When it does, it grabs all of the values in a multi-dimensional array (4x8, 4 ports each with 8 pins) which is pretty much the equivilent of binary. Each slot under each port is set to 0 or 1. I run it through a function to return an integer value of its hexadecimal equivilent. After each conversion it is written to its respective port.

    The main menu is the second portion of this program. Again it loops until the end of the program, but this is what handles all user input and output. The user can choose a port and pin to start running. You enter the port number and pin number, it then prompts you for how long to keep the pin on and again for how long to stay off. After which it creates a new thread using the values you entered then returns you to the main menu.

    The third part is the threads for each pin. This is the thread that writes to the global data array and sets the change variable.

    (sorry i forgot about bbcode, i had a bracket 6 bracket in there which made my font bigger)

    Post Edited (Keith King) : 11/20/2006 8:25:56 PM GMT

  • GadgetmanGadgetman Posts: 2,436
    edited 2006-11-20 21:29
    Spin isn't Multi-threaded, it's Symmetrical multiprocessing.

    And it's much faster than anything you can do with the Javelin.
    (Not having to do context switching really saves microseconds here and there... )

    If you want multi-threading, you may want to look at Assembly-language, and some of the topics about that,
    http://forums.parallax.com/forums/default.aspx?f=25&m=154613
    http://forums.parallax.com/forums/default.aspx?f=25&m=154421

    or Forth, which is also demonstrated multi-threaded.
    http://forums.parallax.com/forums/default.aspx?f=25&m=154899

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Don't visit my new website...
  • Kevin WoodKevin Wood Posts: 1,266
    edited 2006-11-21 02:38
    Just to let you know, the Javelin uses a specific subset of Java. You can download the manual to see the features implemented.
  • Keith KingKeith King Posts: 7
    edited 2006-11-21 13:15
    Thank you for posting that.· I was looking through that manual yesterday.··After you said that I did·a search for thread and it turns out you can only have one thread.· The Javelin isn't going to work (at least not for my purposes).
    Kevin Wood said...
    Just to let you know, the Javelin uses a specific subset of Java. You can download the manual to see the features implemented.
Sign In or Register to comment.