Shop OBEX P1 Docs P2 Docs Learn Events
Using a custom GUI to control the Propeller in real-time — Parallax Forums

Using a custom GUI to control the Propeller in real-time

archerbrad700archerbrad700 Posts: 18
edited 2011-10-06 19:49 in Propeller 1
Hello,

I am considering using the Propeller in a new project but I need some info or general direction before I continue. I am wondering how I could use a custom GUI (such as a spin box value) as a real-time input to the Spin program?

First, is it possible?

Second, if it is does anyone have any good references as to how this could be done?

I have worked with the Stamp before but this is my first Propeller project and it is going to be rather involved. Any help is greatly appreciated.

Comments

  • JonnyMacJonnyMac Posts: 9,202
    edited 2011-10-04 07:20
    It's actually going to be far easier with the Propeller. On the GUI end you need to create a protocol that transmits the item that changed and the new value. On the Propeller end you'd have a serial object to take care of the basic comms and, perhaps, a monitor cog that parses messages and acts accordingly.
  • prof_brainoprof_braino Posts: 4,313
    edited 2011-10-04 08:43
    If you want real time, interactive input directly on the prop (without the need of a PC), you might want to consider propforth. Propforth is a spin program, and so can be interfaced with other spin programs, but most folks find it easy to just work in forth.

    Propforth is a forth command line that allows one to add source code definitions on the fly and execute functions interactively. It does everything you (appear) to want, and more; however it is necessarily less like spin.
  • RaymanRayman Posts: 14,865
    edited 2011-10-04 08:47
    You might want to check out my VisualSpin program to see how to make a GUI for VGA. I think there's also a new Parallax Appnote about a GUI for VGA.
  • SRLMSRLM Posts: 5,045
    edited 2011-10-04 14:36
    If you are talking about a GUI on the PC, then you have several options. The easiest way is to connect the Propeller via the USB cable and a Prop Plug (just like in programming). Then you can use a computer language such as Java or Python to build the GUI and interface with the serial. Both are straight forward in this regard, and both have good GUI builders (NetBeans for Java and WxGlade for Python's wx widgets).

    You could also use a server (such as the Propeller based Spinneret) attached to the Propeller and control it over ethernet and an internet web page.
  • Cluso99Cluso99 Posts: 18,069
    edited 2011-10-04 15:09
    archerbrad700: Firstly, welcome to this fabulous forum and the prop chip.

    As you can se by the response, we dont know precisely what you are wanting to do. However, it will be much easier with the prop once you understand spin (or forth, propbasic, c, etc). There is an app note for a gui on the prop (see http://www.parallaxsemiconductor.com/ ). There are a number of os for the prop, mostly using microSD cards (see my signature for some links).

    Dr_Acula had done some amazing things with guis too, so check out some of his threads.

    And of course, we have CPM running under ZiCog (a Z80 emulator) as well, but that is text based.
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2011-10-04 15:50
    I'll second Cluso's link above.

    Thinking of the 'history of computers' we have emulated 1970s computers and quite a number from the 1980s. These are text based or 'chunky graphics'. The app note Cluso mentions above looks very similar to QuickBasic which was from the early 1990s, which is text based but uses characters like box corners to build boxes.

    What we don't have quite yet are text boxes that can display any arbitrary font, including fonts where the letters are all different widths. It is coming and the prop is certainly capable of displaying such graphics but the code hasn't been written yet. (The attached photo shows the prop can display things, but those text boxes don't work as yet. The button does and the check boxes almost do).

    But in many cases the GUI described in that app note Cluso mentioned will be more than enough. You can click on things with a mouse, move things, type things.
    640 x 480 - 45K
  • archerbrad700archerbrad700 Posts: 18
    edited 2011-10-05 05:42
    Thanks everyone for the replys so far; they have given me a lot to think about.

    Here's what I'm trying to do:

    I am going to use the Prop to control a laser pointer in two axis. The motors are stepper motors with drivers that only require a pulse from the microcontroller to step once. Another pin will control direction with a high or low.

    That part is pretty straight forward but it gets more involved because I need the ability to save points in a Cartesian plane and go back to those points (this involves counting steps/pulses). A series of points will be saved into a Spin program that can be controlled by the user. There will multiple programs to choose from.

    Most importantly it needs to have a very user-friendly (read: user has next to no computer experience) interface. That is why I want a GUI with the same look and feel as XP preferably. I have already begun creating the GUI in QT by Nokia (C++ based), but my experience with it is limited. Actually, my computer science experience is pretty limited too.

    I think JonnyMac was the closest to answering my question how I envisioned it being answered. Can anyone elaborate or point me to a source that will clarify "create a protocol that transmits the item that changed and the new value" and "serial object to take care of the basic comms and, perhaps, a monitor cog that parses messages and acts accordingly?"

    Thanks you all for your time.
  • Mike GMike G Posts: 2,702
    edited 2011-10-05 07:09
    archerbrad700, I build an 2DOF plotter a few years ago. A Windows application crushes the IK algorithm for a line, formats a packets, and fires it off to the Propeller. The Propeller executes the command and waits for another. Feel free to grab whatever you like from the project.

    U-Tube
    http://www.youtube.com/watch?v=07AI2uXGZ-k&feature=player_embedded

    Source
    http://www.agaverobotics.com/services/dotnet/Kinematics/2DOFKinematics.zip
    Can anyone elaborate or point me to a source that will clarify "create a protocol that transmits the item that changed and the new value" and "serial object to take care of the basic comms and, perhaps, a monitor cog that parses messages and acts accordingly?

    This simply means sit down with pencil and paper and figure it out. A protocol is an established interface, commands that the Propeller and PC applications use to communicate to each other. The protocol might look something like !C X25 Y25 for X Y coordinate (25,25). The PC creates the command and fires it via over serial. The prop picks up the command and executes.

    How and what is up to you. If you get stuck, ask a question.
  • RaymanRayman Posts: 14,865
    edited 2011-10-05 07:47
    Ok, I see you want a GUI on a PC to talk to your Propeller over a serial link...

    (I thought you wanted your Prop to directly display a GUI on a VGA monitor...)

    In that case, I think the easiest way would be to use "Visual Basic".
    I think you can download a free version from Microsoft.
  • RaymanRayman Posts: 14,865
    edited 2011-10-05 09:27
    Actually, now that I think about it... Perhaps it'd be usefull to have a generic windows GUI app with some buttons, indicators and sliders, etc. for people to get started with...
    Personally, I'd do it VC++, but maybe somebody could make one up in Visual Basic...
  • prof_brainoprof_braino Posts: 4,313
    edited 2011-10-05 09:38
    Here's what I'm trying to do:
    use the Prop to control a laser pointer in two axis.
    The motors are stepper motors with drivers that only require a pulse from the microcontroller to step once.
    Another pin will control direction with a high or low.

    ability to save points in a Cartesian plane
    and go back to those points (this involves counting steps/pulses).
    A series of points will be saved into a Spin program that can be controlled by the user.
    There will multiple programs to choose from.

    Most importantly it needs to have a very user-friendly (read: user has next to no computer experience) interface.
    That is why I want a GUI with the same look and feel as XP preferably.
    I have already begun creating the GUI in QT by Nokia (C++ based), but my experience with it is limited.
    Actually, my computer science experience is pretty limited too.

    I'm big on requirements, as in "If you can clear state what you want, you have a better chance of getting it". If you want, we can help you sort out your requirements etc.
    In a nutshell: First clarify your highest level, general requirements; then break these into "systems that can provide these services; then beak these into functions each can provide; then decide how you can test that they are present and working THEN do the coding last. This makes life easier, is faster in the long (and short) run; and makes it harder to have bugs.

    Try not to limit your options at this point by making design decisions before you have defined what you really want to do, we often end up painting ourselves into a corner.
  • archerbrad700archerbrad700 Posts: 18
    edited 2011-10-06 06:14
    Thanks again for all the input.

    Mike G-Cool robot! A SCARA type robot is on my future list of things to make, but that's still a ways off. I need to do more learnin'. What program do I open your .cs files in?

    Prof-Braino: Thanks for the advice. I actually do have some pretty clear and thorough requirements for this project, unfortunately I am unable to share them all because this project is going to be proposed to my employer for use in our facility. I don't want to breech any confidentiality agreements.

    Rayman: Thanks for the recommendations. I've been using Qt for a while and am fairly comfortable with it for a beginner to GUI development. It seems to be pretty feature-full, capable, and well-documented and supported so I think I'll stick with it for now.

    I'm going to get as far as I can and if I get stuck I'll post again. Thanks.
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2011-10-06 19:49
    Rayman said.......maybe somebody could make one up in Visual Basic...

    I think ANO18 has a VB example for the Quickstart......although just now I had trouble locating the app notes.

    Jeff T.
Sign In or Register to comment.