Is there software available to write variables to the propeller through a GUI f
turbosupra
Posts: 1,088
Has anyone written a software GUI to write variable values to either the prop or an external memory chip, that the props firmware can read?
Comments
I actually own a copy of viewport, but haven't had time to experiment with using it enough I guess. I was looking for something a little more open source that I could customize. Maybe Hanno will chime in? I'd like to know how he got around the prop chip hanging when the serial to usb converter is connected? Maybe because the serialout object is not loaded?
On the Propeller end you could generally devote a cog to running fullduplexserial and some Spin code to receive commands and stuff the received values into variables. Or you if you need more serial ports you could use one of the four channels of the four-port object. At the computer end you have to build the GUI in some language and execute commands to send the data; in Visual Basic you could use the mscomm1 control to do this.
Another approach is to use a terminal program like HyperTerminal as your PC-end user interface and have the Prop put up user prompts, such as press X key for Y function or enter a command:. This is a bit clunkier but eliminates the need to write code at the PC.
Or you could use an ENC28J60 ethernet chip and Harrison's TCP code to put up a little webpage and use a browser at the PC end; this is much more complicated at the Prop end but still gives you no programming at the PC and a snazzier more graphical interface than Terminal.
Or you could use something like ViewPort and just paste the suggested code into the Propeller app to let you manipulate variables from the PC, but this means you have to use the ViewPort program at the PC and it might be overkill for what you're trying to do.
The Prop chip hangs with the serial-USB converter because one of the handshake lines, generally RTS, is connected to the Prop's reset pin so it can be used to initiate a program download, and some PC applications and serial-USB drivers leave this pin in the resetted state which locks up the chip. Some Prop products have a jumper to disconnect the reset pin for this reason. If you're using a PropPlug you could make an extender that doesn't pass the RST pin through to the prop, and it will eliminate the problem.
I guess I'm approaching it generically at first, so that I can figure out which approach I'd like to take specifically. At least I know I've come to the right person [noparse]:)[/noparse]
Realistically I'd like to be able to write an end user GUI that can communicate to the prop and alter variables in the firmware. That seems to be easier then building hardware to do this. The part I am least familiar with is how to send the data to the prop once I have had the end user enter it into the gui.
Regarding the prop chip hanging, I have the protoboard breadboard version ... would putting a jumper in between the reset pin and the prop serve the same purpose? Something similar to what is pictured below? Or maybe an push button no [noparse][[/noparse]nc] switch in between the RST pin and the prop? Is it the RES pin in the bottom picture?
By far the easiest and most natural way to communicate between a PC and Prop is serial. The PropPlug and other USB versions generally use FTDI USB to serial converters, so to your Windows application they look and act like serial ports. This does require you to be writing the GUI in an environment that has a way to control a serial port.
A very easy way to do this is to pick a start and stop character (you can even use different start or stop characters to indicate different destination variables) and follow this pseudocode at the Prop end:
Wait for a character
If it's start -- set output value to zero
elseif it's end -- put output value in variable
else multiply output value by 10, convert ASCII byte to numeric (& $F) and add to output value
At the PC end of course whenever you want to set a value you just send the start char, numeric value, and stop char.
Thanks for the reply, I like the toggle switch idea, I will probably do that shortly.
I will have to read up on the controlling of a serial port, I've never done anything like that and I'm a novice programmer. I'm not even sure what serial communication architecture that the prop uses ... I didn't see that in the prop plug documentation at least.
As for the code on the prop, I guess I should use a non standard character like | or \ or / and have the PC gui send that before and after the variable updates? I guess at this point I need to figure out how to actually get the bits out using the proper protocol and to pin 31 on the prop, within the proper protocol.
Would C# be decent for this?
I found this, is there timing involved with this? Is the hysteresis on the propeller from 0.1 to 3v as well?
Also, Delphi seems to be popular here, although it is expensive. You can, however, use Lazarus, which is basically an open source clone. It has the benefit of creating small native executables that don't rely on having the .Net framework installed. I believe that Brad's Spin Tool is created with Lazarus, and it weighs in at 906Kb.
Lastly, you can find all kinds of sample apps here, especially in the Basic Stamp forum.
If you want to interactively customize to view and alter variables, and set and monitor i/o pins interactively, using just a prop and a terminal program on your PC, you might consider propforth. Forth is all about that and Propforth is free.
I'm going to read about this as much as possible, it may be over my head though. I've never seen forth before today so interpretation will take some learning.
Does it have a GUI, if so do you have screen captures of it? Or does it only use the serial terminal?
The simple kernel is command line only, use tera term. The vga version does not need a pc, only a monitor, but than has not been released yet. PC side GUI etc can be written in forth (pygmy forth is my fav) or any other means; usually they are not needed (in the developer's opinion) I am working on a private package of PC-side support but this is not yet released.
The only thing that might be a challenge is thinking in terms of the stack which takes 5 seconds to understand and twenty minutes to master.
"Starting forth" and "Thinking forth" are available free on line.
The propforth thread and the google code site are active for support.
It's pretty straightforward from any language to slowly send/receive serial data. FullDuplex or other objects let you decode that data so you can do something with it.
For non-trivial projects, Conduit simplifies this by letting you "share" Propeller variables with the PC at high speed. There is a development kit and an api for ViewPort that let you build on top of this. (Samples in python, vb, c#, matlab and more...)
12Blocks also uses the "Conduit". With 12Blocks you create a Propeller program from "code blocks". Then, you can use "interface blocks" (there's a separate development kit for that) to create a user interface. For example, create a program to measure something into a variable, then drag the "thermometer" to display the variable. You can "run" this inside 12Blocks and "debug" it. Finally, you can "save as exe"- this will package up your "firmware", your "user interface", and the runtime parts of 12blocks that program the propeller, establish and maintain the connection, and keep the interface updated.
The all-in-one "exe" file is typically 1MB.
Hanno
Also, I think there's a Microsoft Robotics SDK that has Parallax drivers...