Shop OBEX P1 Docs P2 Docs Learn Events
Interface Help — Parallax Forums

Interface Help

LautarocondorLautarocondor Posts: 15
edited 2007-07-06 14:11 in BASIC Stamp
I have built projects in the past that run automatic such as a transport system to solder pins to coax cables without having to rely on an operator to figure out time etc.
But now I wish to integrate an interface with an LCD screen·so I can change other parameters (such as distance of travel and depth of travel)all controlled with steppers that could be pre-selected and when the "run" button is pressed it follows a preprogrammed order with only the stepper motor instructions changed. I am using the BS2 and have the knowledge to build the electronics; it’s just the interface that confuses me. Thanks.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-07-03 13:24
    When you say "interface", what do you mean? Can you describe in detail how you want it to behave? You need to describe the hardware as well. Do you want to use pushbuttons or dials or a touch screen or what to control and enter information? Do you have a particular LCD screen in mind?
  • LautarocondorLautarocondor Posts: 15
    edited 2007-07-03 13:56
    Thanks for the quick response. I am using a standard 4X20 lcd display such as parallax part#27979. No touch screen, I really want to keep it simple. I would like to use up and down push buttons to change every parameter. Would a keypad be too complicated to interface? The unit will have a control box with an lcd screen and four buttons to select the four parameters. Next to that will be up and down buttons and a “RUN” button.·

    If you press parameter button “A” it becomes it becomes highlighted and allows you to change stepper motor #1 distance. If you press parameter button “B” you can change·stepper·motor #1·speed of travel. If you press parameter button "C" you can change stepper motor #2·distance and if you press parameter button "D"· it allows you to change stepper motor #2 speed of travel. When you press "RUN" all parameters are stored in memory and played back at the appropriate moment. For example: a transport system to bring a product precisely in line with a press. Stepper #1 would provide the X position. Stepper#2 would provide the Y position. It would start by finding home position and then follow the commands selected on the control box. It needs to be able to change because different products have different measurements.··

    This is an example of one system, there are others that will require more steppers and more parameter changes. I just need to know how to change parameters with a simple·interface. Again I appreciate any help.
  • Mike GreenMike Green Posts: 23,101
    edited 2007-07-03 14:22
    You could use a keypad. There are articles in Nuts and Volts that you can download from the Parallax website on using keypads.
    You could use pushbuttons. With just an up and down button, you might have to do a lot of pushing to change parameters by a lot.

    Several manufacturers have "smart" LCD displays that include keypad support, anywhere from 4x4 to 5x5 sizes. One such display is www.matrixorbital.ca/manuals/LK_series/LK202-25/LK202-25.pdf, but there are others like www.seetron.com/trm425_1.htm.

    With the larger display and a 4x4 keypad, you could devote a line on the display to command entry. Typically a keypad might have characters 0-9, #, *, A-D. When you press a digit key, the current display might be multiplied by 10 and the new digit added in. The * key would clear the display to zero. Each letter key would copy the currently displayed value into the corresponding parameter and zero the entry display and the # key would be the RUN button. One or two lines of the display could be used to display the current values of the parameters and a 4th line would be used for status/error messages.
  • LautarocondorLautarocondor Posts: 15
    edited 2007-07-03 14:50
    Thank you. Now how would I actually make changes to the software with this display? I now have to attach my laptop and actually make the changes and download it. This was ok for a while, but now I will have to make several changes in a day.
  • pwillardpwillard Posts: 321
    edited 2007-07-03 15:26
    What would drive the design is:

    How many parameters need changing?· Just a few?
    Can all possible options be "preloaded" and then selected?

    If yes, you would be able to get by with Up, ·Down, Cancel, Enter.

    Where menu's get tricky is if you have very customised paramaters to enter... like· "run X cycles" or "cycle time = X Milliseconds"·and you need to enter the value for X.


    In that case,·you might be better off with a keypad of some sort.· Keypad encoding just takes a few more valuable pins... made simpler if you use a chip like 74c922.

    ·If it's a lot·more complicated than that, it's actually not that hard to·use a separate STAMP and create a pseudo-serial-terminal interface and not have an LCD on the programmable unit...·· just a small handheld device you can attach with RS232 and a keyboard/display.· If you have a lot of units, this would be cheaper than an LCD on each and simpler than carrying your laptop around.

    Pete
  • Mike GreenMike Green Posts: 23,101
    edited 2007-07-03 15:32
    What do you mean by changes?

    Do you mean that you have steps (positions) that need to occur in some order?

    One way to do this would be to use a table in the EEPROM (using the READ / WRITE / DATA statements). There would be some initial values, but you could modify this table using the keypad. You might need additional keys, perhaps to enter a step number, increment the step, or decrement the step. You might want a key that would delete the step entirely and move any subsequent steps downwards. You might want a key that would insert a step with some default values. Each step would contain a set of parameters (A-D) that would appear on the display when you're "positioned" at that step. You'd also have the step number displayed and the total number of steps stored.

    This would be a step editor and would allow you to make changes without reprogramming. If each step contained 4 parameters, each a word, that would be 8 bytes per step. The BS2's EEPROM has 2K bytes. Assuming most of that would be the program, you might have room left for 32 steps. If that's not enough, you should consider using something like a BS2p which has much more room to store data and can handle multiple programs. Your main program in 2K would be the controller, but your step editor could be moved to one of the other 2K "slots". You could use another 2K "slot" to store the parameters for all the steps.
  • LautarocondorLautarocondor Posts: 15
    edited 2007-07-06 13:13
    Thanks for the reply, but what I want to do is a little bit more complex than having presets that can be selected. Let’s take an automatic wire stripper for example. The machine prompts the user to enter wire length, left side strip length and right side strip length as well as blade depth. After the user enters his data the machine goes into a preprogrammed routine with only the user variables changed. This is the type of interface I’m looking to build. I’ve built machines in the past that the user only presses start and it follows my routine, but now I want to take it a step a step further. Thanks Again.
  • Mike GreenMike Green Posts: 23,101
    edited 2007-07-06 14:11
    I would use either a display with a built-in keypad interface or a separate keypad interface like the MEMKEY (sold by Parallax ... see their webstore) and a 4 x 4 keypad. Since your machine will prompt the user, you only need to be able to enter numeric values. You would have one "enter the number" routine that would be used for the response to each prompt (on the display). This routine would use the digits, perhaps use the "#" for a backspace or delete key to correct errors, and the "*" key to enter a decimal point. Maybe the "D" key would be the enter key and the "C" key might be to clear the display to start over. "A" and "B" could be for other similar functions ... maybe to start the whole entry process over or to back up to the previous value entered. You could always make new labels for the keypad ... some of them provide for that.

    Before you write any code, you want to make a flowchart/ state diagram showing how you want your program to behave given some particular key input (including whether to ignore it). You don't need a lot of detail for the actions at this point, just account for all the keys in each state.
Sign In or Register to comment.