Interface Help
Lautarocondor
Posts: 15
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.
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
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.
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.
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
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.
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.