Shop OBEX P1 Docs P2 Docs Learn Events
Question about updating variables thru 2x16 LCD and 4 button keypad — Parallax Forums

Question about updating variables thru 2x16 LCD and 4 button keypad

AndrewCAndrewC Posts: 3
edited 2004-12-29 05:07 in BASIC Stamp
I'm completely new to BASIC Stamp and I'm about to start a project with a BS2 (or BS2P). The project is going to be a very flexible phototrap. User interface will be a 2x16 LCD and four button keypad. Part of it will let the user select one of a set of up to 4 variables (delay_before_firing, rearm_time, etc. Each variable will be three decimal digits. It must be a fairly common task to select a variable, display it on line 1 and then use RIGHT, UP and DOWN arrow buttons to pick a digit on line 2 ( or end of line 1) and increase or decrease it ? Is there any super elegant code out there already to do that ?

While I'm about it, which is best to get started with - BS2 or BS2P ? BS2P is obviously (?) faster and has more code space and is easier to interface to lcds. On the other hand, my time critical code will only be about 4 or 5 lines looking for two HIGH inputs and then branching to a subroutine to actually control the delay, fire and recharge, the BS2 uses less power, most of my code will probably be the user interface hence the original question [noparse]:)[/noparse]

Thanks in advance for any suggestions, examples, etc.

Comments

  • BeanBean Posts: 8,129
    edited 2004-12-29 04:39
    How quickly must the stamp act on the two HIGH inputs ?
  • AndrewCAndrewC Posts: 3
    edited 2004-12-29 04:51
    The quicker the better [noparse]:)[/noparse] Realistically I'm hoping for millisec delay or better. The photogate will be two laser beams to give x,y position, "normal" electronics with a phototransistor should give me a response in microseconds to set my inputs both HIGH. The BS code will just be looping looking for three things - a button input to "escape" or both gates to be HIGH and branch to a firing subroutine. I may be pursuing the wrong technology for this if a BS module can't react fast enough, in which case I'll probably go back to a bunch of cascaded 555 timers - quicker, easier and cheaper but not as flexible or as much fun [noparse]:)[/noparse]
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-12-29 05:01
    Others have done this sore of thing. What you could do is use a bit of a hardware assist: trigger a 555 one-shot with the first gate, reset it with the second gate, then use PULSIN to measure the width of the output. The BASIC Stamp module you select will determine the resolution you're able to read.

    The LCD stuff is easy -- just takes a bit a patience.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
  • AndrewCAndrewC Posts: 3
    edited 2004-12-29 05:07
    Hi Jon, not quite sure what you mean about the gates - I'm not timing a speeding bullet or anything. the two "gates" are a cross pattern to make sure my subject is centred and positioned in x and y.

    LCD stuff - yup, I figured it wasn't really that hard, haven't written any code for about 15 years but I figure it's just a question of selecting a particular bit from the word and working on it. I was just being lazy really, or perhaps trying not to invent a wheel [noparse]:)[/noparse]

    Andrew
Sign In or Register to comment.