Shop OBEX P1 Docs P2 Docs Learn Events
Basic Stamp 2 selectable menus from user input? — Parallax Forums

Basic Stamp 2 selectable menus from user input?

ShootPaintShootPaint Posts: 9
edited 2004-10-25 01:49 in BASIC Stamp
I have developed the basic code that I need for my stamp to operate the way I desire. I however want to have a selectable menu that allows me to make changes to the code on the fly.

Here is what I am looking to do.

I want to control some air solenoids on a boxing machine but I need to be able to increase or decrease the dwell times on these solenoids with the push of a momentary button. Presently our operators are simply increasing the pressure to the solenoids which leads to our solenoids failing or our air cylinders breaking due to the increased pressure. By lengthing the time the solenoids are open we can achieve the same thing but reduce the failure of our equipment.

I would like to hard code all of the selectable options that could then be selected by the operator to increase of decrease the dwell time of the solenoids.

The operator would be prompted with a blinking light to indicate that are in the programming mode followed with a light blink in a stepped valve for each selectable option.

For example

User pushes the program button.

The indicator light would flash once to let them know they are in the program mode.
User would then press the button again until they reached their desired setting for the dwell time on the solenoids.

1 Flash= 1 second
2·Flash= 2 seconds
3 Flash= 3 seconds

etc....
When the operator see the desired amount of flashed for the dwell he wants to select he will release the input button.


When the button is released the varible in the software should reflect the current users setting.

There are other features I would like to include as well but if I can get some help with the initial problem I am sure I can continue on from there.

Thanks for any help in advance.


Post Edited (ShootPaint) : 10/22/2004 3:50:02 AM GMT

Comments

  • allanlane5allanlane5 Posts: 3,815
    edited 2004-10-22 15:08
    It should be possible to store the 'air-solenoid' value in the EEPROM on the BS2.

    Note the EEPROM is erased whenever you re-program the BS2, so if you want to get or set the data you'll need a way to retrieve it.

    Your program should READ the value from the EEPROM when it first comes up. If it is zero, this means it has not been programmed -- put in the default value, and 'write' it to EEPROM.

    When updated, update the BS2 value, then write the updated value to EEPROM.

    Jon might be able to tell you how to decide what area in the EEPROM is free, that you can use for this purpose.
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-10-22 15:20
    Programs build from the bottom (address 2047) up; user data is generally stored at 0 moving downward. Since almost no program fills the EEPROM, starting at zero is usually safe. You can store a default value like this:

    SolTiming DATA 0

    This will get downloaded to the EEPROM when you program your BASIC Stamp. In use you would do this:

    · READ SolTiming, timing
    · IF (timing = 0) THEN
    ··· ' input new timing
    ··· WRITE SolTiming, timing
    · ENDIF

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
  • ShootPaintShootPaint Posts: 9
    edited 2004-10-25 01:49
    I understand the read write commands. I am having issues of getting the input interrupted by the right now.

    Here are the basics of how I need the program to function.

    The User will push a button. This will put PIN 5 high (currently I look for pin five to go high)

    Once the button is pushed· It flashes the program light. ( I turn pin 6 on for the light. There are·5 sets of pulse that·represent the various options we are controling.)

    When the desired function is displayed we release the button. This then makes takes us to the selections for this function.

    At this point the user pushes the button again. We flash the led adding one flash for each selectable option. For example



    1 flash = 1sec

    2Flash = 2 sec

    3 flash = 3 sec

    etc...

    At this point the user should release the button after seeing the desired flashes. When the button is released we want to store this value to the eeprom in the form of a varible that can be called from the main program for the operation of our machine.



    Here is the basics of what I have tried at this point but it doesnt appear to work.

    Do

    If High 5

    High 6

    Low 6

    Count +1

    If Low 5

    read count

    Compare count to stored varibles

    Write Varible to Dwell time

    Goto Run

    end if

    Else

    Loop

    Else goto Run

    End if

    Like I said before I have the basic program working with the varible hard coded. I am simply having problems getting the selectable times put in for the dwell of my solenoids.
Sign In or Register to comment.