PDA

View Full Version : Terminal interface



pacman
03-21-2009, 03:51 PM
I'm a noob and perhaps this has already been explained (but I searched and couldn't find an answer).

Does someone have any sample code (or object) they would like to share or can point me to an example of a "interactive termainl cog"

I have an application that I can see the need for a hyperterminal friendly configuration screen, you know they display a 'menu' and you type in B 9600 or P N and it sets the respective flags in the code (my example could be for baud and parity for example).

Doesn't have to be flash, just text output and simple text input.

I've also searched on the object exchange and can't see one.

Any help / guidance / pointers to acticles I should read / etc, would be very much appreciated.

thanks in advance

Paul

StefanL38
03-21-2009, 07:50 PM
Hello Paul,

to it is not clear what you are searching.

something similar to hyperterminal would require a TV or an VGA-Monitor and keyboard connected to the propeller to be able
to type in something like "B 9600 or P N" to setup serial communication parameters

or do you mean you want to receive that parameter-string with the propeller via a serial connection

then you would need two connections
connection A to send / receive configuration-commands
connection B which will be configured

If you would like to do this on THE SAME connection
you would have to start with standard-parameters that you are able to receive something at all
and then stop the serial connection and reopening it with the new parameters

So please describe IN DETAIL what you want to do. Not only with the serial connection but also the whole project


best regards

Stefan

pacman
03-22-2009, 05:57 AM
thanks for the reply,

I'm after more the two connections (usb menu A, configures RS232 connection B)

I'm trying to mimic a simple (currently controld by an expensive PLC) process. Part of this process involves serial communications (in there own wierd Ascii format) to some specialised devices. The end goal is a cheaper 'box' (the plc is expensive) that is more tollerent to the temperatures we are working with and draws a bucket less power.

These devices have a standard {mostly} setup, but occasionally one of these units has been reconfigured to a slightly different format (like 4800 baud rather than 9600). Or one of the remote sensing boards is at non-standard adress

One thing that is consistant is that serial comms is always RS232. There is also several I2C boards that hang off the main board, the addresses of these I2C board is needs to be software configurable

I was hoping to have a USB 'menu' system, so that we could use a terminal session to tell the 'box' that {say} the remote display is at I2C address 7, but the pressure input board is at I2C address 3.

Thus we terminal session (via the USB 'configuration' port) and 'viewing' the menu that is on my terminal session (it's basically a prompt to assit with remembering what key letters do what), it prompts me that "Y" is for "remote DisplaY address" and thus I would type in Y 7 {cr}.

One of the menu options is "saVe configuration" and that would then allow the propeller to store (to eprom) the new settings for port B. Next 'reboot' the propeller uses the saved settings during it's power-up/initialisation to 'know' what is expected at what external adress and what RS232 settings (baud/parity/stop bits) to use to talk.

So, during comissioning, use laptop to USB to propeller, configure propeller, unplug laptop, re-power propeller, check operation, leave....


Hope that explains what I'm trying to do

Thanks
Paul

Mike Green
03-22-2009, 06:24 AM
Your description is still as "clear as mud".

Are you asking whether it's possible to configure a Propeller to do something with a laptop over USB, then disconnect the laptop and have the Propeller function using the configuration information. Sure. All of the RS232 drivers for the Propeller are configured for a particular Baud when they're first initialized. That information can come from some location in EEPROM set by a configuration program. You mention I2C devices. Again, the I2C drivers for the Propeller can be set up to take their device addresses from an EEPROM location set by a configuration program.

There's no "canned" version of a menu system mostly because it's different from one project to another. Have a look at the Extended FullDuplexSerial object in the Propeller Object exchange in that it has input routines for text strings and decimal numbers. The existing FullDuplexSerial object that comes with the Propeller Tool has various output routines for strings, decimal numbers, hexadecimal numbers as well as routines for one character at a time input and output.

Timothy D. Swieter
03-22-2009, 06:52 AM
Paul -

I think I understand what you are looking for - you would like a template/examples/description of a design that has a menu system for setting parameters in a system via a terminal window, does that sound correct?

Off the top of my head, I don't recall one out there and if you searched the exchange and found nothing then maybe we should create one. Of course you need a FullDuplexSerial object like Mike said, then you will probably also use a series of case statements for the menu system. Then you also need a way to store the data in the EEPROM (either in program space of data space if your EEPROM is bigger than 32Kbytes).

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Timothy D. Swieter, E.I.
www.brilldea.com (http://www.brilldea.com) - Prop Blade, LED Painter, RGB LEDs, 3.0" LCD Composite video display, eProto for SunSPOT
www.tdswieter.com (http://www.tdswieter.com)

rjo_
03-22-2009, 08:10 AM
I think I see what you are talking about...

You can use a menu system... driven by a prop... to control serial communications to your devices. I personally would use a Prop with a TV screen... but you could use a matrix style LCD, which is more robust.

There isn't one object that will do everything. You have to add objects to your base program to get the functionality that you want.

You have to be sure that the voltages coming from your system to the Prop are compatible with the Prop.

You don't need usb to do what I am describing... and if what you have on your system is a USB connector... acting as an RS232emulator... that would complicate the picture a little:)

pacman
03-22-2009, 09:41 AM
Timothy nailed it. Sorry if my description and clarification wasn't..

The TV object might do what I need, but I'm not keen on carring another 'device' to site when a simple terminal interface (that i can USB to on site, cause I'll have my laptop with me) seemed to be an elegant solution.

I understand I'd have to do the intrepretation of the input from the menu system and I the FullSerial duplex object looks kinda (remember i'm a noob) like what I'm after.

Combining objects would be fine (but then the question is which objects)

Even a template to show how to 'format the text' for my serial interface would be excellent. Can the TV object 'redirect' its output to a serial port?

Long term the finised board would have a {mini?} usb port for configuration AND a 9 pin RS232 port for normal communications on it

Mike Green
03-22-2009, 10:19 AM
One of the nice things about the various output objects like the TV and VGA drivers and the FullDuplexSerial driver is that there's a mostly common set of methods available. All of them have a string output method and a decimal output method that have the same call. You just change the name of the object and change the initialization routine and everything else goes with it. The main exception is FullDuplexSerial's single character output method which is called TX while all the others use OUT for the same functionality. The TV object doesn't "redirect" its output. You substitute one object for the other and change the initialization (because there's different sorts of data needed).

I suggest that you download the Propeller Education Kit's tutorials and work through them at least on paper. It doesn't make sense to have templates to show how to 'format the text' because there's so much variability. Lay out what you want on a piece of paper. It's probably easiest to just use Hyperterm as a "dumb terminal" where messages always appear on the bottom of the screen and roll up as you display more messages ended with a carriage return and line feed. Your program will receive characters as typed on the keyboard and you'll have to echo them back to Hyperterm by displaying them one at a time.

StefanL38
03-22-2009, 08:32 PM
Hello Paul,

I rembered that I made some kind of a menu-system for one project
It uses the tool PropTerminal which can act as a substitute for a TV-screen and a PC-keyboard over a serial connection

So for developing a Propeller-Device that will use a TV-Screen and PC-Keyboard you can use PropTool for developing this application
WITHOUT the screen and keyboard

As you are carrying a laptop with you if you want to do parameter-changes you can use the PropTool as not as a substitute but as
the main configuration tool.

I have attached all the files needed therefore
You can use this as a template to create menues
I think with this you can create a cool and professional looking interface between Prop and the laptop

best regards

Stefan