New to this!!
I am trying to write a part of a program that accepts keypresses from
a 3x4 keypad and when it does it puts out what was pressed on a Scott
Edwards LCD. The way I am doing the keys is by connecting all of the
buttons to 5 volts and the other side of the button(whether it be in
a certain row or column) is connected to an input on a BS2 and a pull
down resistor. My problem is this: In my software, I labeled each
button as a variable and then declared the buttons as the and of two
pins. Like this: BTN1 VAR BIT BTN1 = IN0 & IN4. I do this
according to the matrix. I put all of the declarations in a main
loop and then I do an if statement that will branch if a certain
button is pressed. It seems that when I go to another part of the
program and check the same key, it doesn't recongnize the definition
BTN1 = IN0 & IN4. I verified this using debug where I got in0 and
in4 as being 1 when the button was pressed but btn1 itself stayed 0.
Do I need to keep declaring what btn1 is in each place that I use it
or is there another way around this. It also doesn't see that
declaration if I put it outside the main loop in the beginning. Any
help will be much appreciated! Thanks a lot!!
Jeremy
a 3x4 keypad and when it does it puts out what was pressed on a Scott
Edwards LCD. The way I am doing the keys is by connecting all of the
buttons to 5 volts and the other side of the button(whether it be in
a certain row or column) is connected to an input on a BS2 and a pull
down resistor. My problem is this: In my software, I labeled each
button as a variable and then declared the buttons as the and of two
pins. Like this: BTN1 VAR BIT BTN1 = IN0 & IN4. I do this
according to the matrix. I put all of the declarations in a main
loop and then I do an if statement that will branch if a certain
button is pressed. It seems that when I go to another part of the
program and check the same key, it doesn't recongnize the definition
BTN1 = IN0 & IN4. I verified this using debug where I got in0 and
in4 as being 1 when the button was pressed but btn1 itself stayed 0.
Do I need to keep declaring what btn1 is in each place that I use it
or is there another way around this. It also doesn't see that
declaration if I put it outside the main loop in the beginning. Any
help will be much appreciated! Thanks a lot!!
Jeremy
Comments
system you may be interesetd in.
Original Message
From: Jeremy Gassmann <gassmajd@e...>
To: <basicstamps@egroups.com>
Sent: Friday, June 30, 2000 1:40 AM
Subject: [noparse][[/noparse]basicstamps] New to this!!
> I am trying to write a part of a program that accepts keypresses from
> a 3x4 keypad and when it does it puts out what was pressed on a Scott
> Edwards LCD. The way I am doing the keys is by connecting all of the
> buttons to 5 volts and the other side of the button(whether it be in
> a certain row or column) is connected to an input on a BS2 and a pull
> down resistor. My problem is this: In my software, I labeled each
> button as a variable and then declared the buttons as the and of two
> pins. Like this: BTN1 VAR BIT BTN1 = IN0 & IN4. I do this
> according to the matrix. I put all of the declarations in a main
> loop and then I do an if statement that will branch if a certain
> button is pressed. It seems that when I go to another part of the
> program and check the same key, it doesn't recongnize the definition
> BTN1 = IN0 & IN4. I verified this using debug where I got in0 and
> in4 as being 1 when the button was pressed but btn1 itself stayed 0.
> Do I need to keep declaring what btn1 is in each place that I use it
> or is there another way around this. It also doesn't see that
> declaration if I put it outside the main loop in the beginning. Any
> help will be much appreciated! Thanks a lot!!
>
> Jeremy
>
>
>
>
Thanks a lot for the advice. I hooked up the circuit and it
works pretty good. The only problem is that glitches occur when the
button is first pressed. Do you have this same problem? Sometimes I
will hit one key and it makes it out as some other key. When I debug
the RCTime result, and press a button, you can see that the first
number is always a random number that isn't the expected value.
Please let me know! Thanks again!!
Jeremy
--- In basicstamps@egroups.com, "Chris Anderson" <fes@g...> wrote:
> See the list of stamp applications via parallax website. No 157 has
a keypad
> system you may be interesetd in.
>
>
Original Message
> From: Jeremy Gassmann <gassmajd@e...>
> To: <basicstamps@egroups.com>
> Sent: Friday, June 30, 2000 1:40 AM
> Subject: [noparse][[/noparse]basicstamps] New to this!!
>
>
> > I am trying to write a part of a program that accepts keypresses
from
> > a 3x4 keypad and when it does it puts out what was pressed on a
Scott
> > Edwards LCD. The way I am doing the keys is by connecting all of
the
> > buttons to 5 volts and the other side of the button(whether it be
in
> > a certain row or column) is connected to an input on a BS2 and a
pull
> > down resistor. My problem is this: In my software, I labeled
each
> > button as a variable and then declared the buttons as the and of
two
> > pins. Like this: BTN1 VAR BIT BTN1 = IN0 & IN4. I do
this
> > according to the matrix. I put all of the declarations in a main
> > loop and then I do an if statement that will branch if a certain
> > button is pressed. It seems that when I go to another part of the
> > program and check the same key, it doesn't recongnize the
definition
> > BTN1 = IN0 & IN4. I verified this using debug where I got in0 and
> > in4 as being 1 when the button was pressed but btn1 itself stayed
0.
> > Do I need to keep declaring what btn1 is in each place that I use
it
> > or is there another way around this. It also doesn't see that
> > declaration if I put it outside the main loop in the beginning.
Any
> > help will be much appreciated! Thanks a lot!!
> >
> > Jeremy
> >
> >
> >
> >