Searching \ for 'A stupid question but...' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/index.htm?key=stupid+question
Search entire site for: 'A stupid question but...'.

Truncated match.
PICList Thread
'A stupid question but...'
1997\10\29@120432 by Mark Birks

flavicon
face
Is it possible to multiplex the scanning of 4 push-button switches on
the same 4 'data' lines as an LCD module is using ?

I've sort of thought along the lines of having all of the switches
commoned at one side and then having an OPen -collector arrangement to
short the switches to ground at read time.

The drawback with this arrangement is that when the switches are NOT
being read and one or more switches are closed, data lines will be
shorted together. Adding diodes seemed like an obvious step forward but
the 0.7V drop takes them to the top end of the TTL logic '0' level.

Anyone got any suggestions please ?

Also I am looking at using a standard 16x2 LCD with these switches to
allow menu selection and configuration settings - has anyone done
anything that allows the PIC to communicate with a host processor (in
this case it is ACORN podule bus) to download menu choices, selections
etc. I am trying to reduce the amount of processing done by the host so
that the PIC can deal with most of the menu control if poss........

      \\\|///
    \\  - -  // "Yes it IS safe
     (  @ @  )   to switch on"
+---oOOo-(_)-oOOo------------------+
| Mark Birks                       |
| Hardware Section Leader          |
| OmniBus Systems, Stanford House, |
| Stanford-on-Soar,                |
| Loughborough, Leicestershire. UK.|
|                                  |
| Tel/Fax: +44 (0)990 004300/333   |
| E-Mail: spam_OUTmarkbTakeThisOuTspamomnibus.co.uk      |
|   ooo0                           |
|  (    )   0ooo                   |
+---\  (----(   )------------------+
    \_)     ) /
           (_/

1997\10\29@121231 by wwl

picon face
O>
>The drawback with this arrangement is that when the switches are NOT
>being read and one or more switches are closed, data lines will be
>shorted together. Adding diodes seemed like an obvious step forward but
>the 0.7V drop takes them to the top end of the TTL logic '0' level.
Yeah, but the PIC uses CMOS levels, so no problem!
Vil max for 16c5x is 0.2vdd = 1.0v at 5v

1997\10\29@121832 by wwl

picon face
>
>Also I am looking at using a standard 16x2 LCD with these switches to
>allow menu selection and configuration settings - has anyone done
>anything that allows the PIC to communicate with a host processor (in
>this case it is ACORN podule bus) to download menu choices, selections
>etc. I am trying to reduce the amount of processing done by the host so
>that the PIC can deal with most of the menu control if poss........
>
I did this a while ago - for this type of app, throughput isn't
usually an issue, so I used a 4 bit port (part of a GAL) on the podule
bus to do synchronous serial to the PIC, bnit-bashed by the ARM with
req/ack handshaking.
higher-end 40 pin PICs have a bus interface, which makes life easier,
but read the errata sheets - there were some serious bugs in early
versions!

1997\10\29@121838 by Jarek Pawlega

flavicon
face
... and the Ge diodes will drop you only ~0.4V compared of Si = ~0.7!




Please respond to .....wwlKILLspamspam@spam@netcomuk.co.uk

To:   PICLISTspamKILLspamMITVMA.MIT.EDU
cc:    (bcc: Jaroslaw Pawlega/Perle)
Subject:  Re: A stupid question but...




O>
>The drawback with this arrangement is that when the switches are NOT
>being read and one or more switches are closed, data lines will be
>shorted together. Adding diodes seemed like an obvious step forward but
>the 0.7V drop takes them to the top end of the TTL logic '0' level.
Yeah, but the PIC uses CMOS levels, so no problem!
Vil max for 16c5x is 0.2vdd = 1.0v at 5v

1997\10\29@135059 by Jason Wolfson
flavicon
face
Mark,
I did this with a 20x4 LCD and it worked great,
check out my code at   http://www.ultranet.com/~jason

I put the 4 buttons at each corner of the display and you
put up a message to their function depending on what you want when...
Kinda like an ATM machine....

Jason



{Original Message removed}

1997\10\30@043316 by STEENKAMP [M.ING E&E]

flavicon
picon face
Hi,

> Is it possible to multiplex the scanning of 4 push-button switches on
> the same 4 'data' lines as an LCD module is using ?
>
> I've sort of thought along the lines of having all of the switches
> commoned at one side and then having an OPen -collector arrangement to
> short the switches to ground at read time.
>
> The drawback with this arrangement is that when the switches are NOT
> being read and one or more switches are closed, data lines will be
> shorted together. Adding diodes seemed like an obvious step forward but
> the 0.7V drop takes them to the top end of the TTL logic '0' level.
>
> Anyone got any suggestions please ?
>

I have previously done it in the following way (Repeat for each data
line):
               VCC
                |
                o|
                o|
                |
                /
                \ 4K7
                /
                \
                |
PIC--------------O----------------------------LCD Dx
                |
                /
                \
                / 47K
                \
                |
               Gnd

When the PIC pin is an output and in the worst case, the output either
has to drive against the 47K or the 4K7 resistor.  This will be no
problem.  So the PIC would be able to drive the line to a valid logic
value, irrespective of whether the button is pressed.
To read the button, change the pin to an input.  If the button is not
pressed, the 47K will pul the line low.  If it is pressed, the line will
be at 5V*(47/(47+4.7))=4.5V which is a valid high level (I assume that
the LCD draws negligible current on its data inputs).

Hope this helps
Niki

1997\10\30@043525 by Mark Birks

flavicon
face
Nice one thanks.

I'm still a little confused as to how to deal with the situation where
the switches are NOT enabled (ie common portion floating) and you are
accessing the LCD when TWO or more switches are pressed. Surely this
will short two data lines together and invalidate the data to/from the
LCD ?

Please excuse my ignorance on this - it is my first (very ambitious) PIC
project.

      \\\|///
    \\  - -  // "Yes it IS safe
     (  @ @  )   to switch on"
+---oOOo-(_)-oOOo------------------+
| Mark Birks                       |
| Hardware Section Leader          |
| OmniBus Systems, Stanford House, |
| Stanford-on-Soar,                |
| Loughborough, Leicestershire. UK.|
|                                  |
| Tel/Fax: +44 (0)990 004300/333   |
| E-Mail: .....markbKILLspamspam.....omnibus.co.uk      |
|   ooo0                           |
|  (    )   0ooo                   |
+---\  (----(   )------------------+
    \_)     ) /
           (_/


{Quote hidden}

> {Original Message removed}

1997\10\30@060845 by Gordon Zerf

flavicon
face
I have a similar  problem, using a 4x20 and had a look at  the site, but
found no code to look at

Gordon


At 09:30 30/10/97 -0000, you wrote:
{Quote hidden}

>> {Original Message removed}

1997\10\30@082848 by Mark Birks

flavicon
face
At the main screen click on the shareware option (under the Microchip
logo on the RHS).

      \\\|///
    \\  - -  // "Yes it IS safe
     (  @ @  )   to switch on"
+---oOOo-(_)-oOOo------------------+
| Mark Birks                       |
| Hardware Section Leader          |
| OmniBus Systems, Stanford House, |
| Stanford-on-Soar,                |
| Loughborough, Leicestershire. UK.|
|                                  |
| Tel/Fax: +44 (0)990 004300/333   |
| E-Mail: spamBeGonemarkbspamBeGonespamomnibus.co.uk      |
|   ooo0                           |
|  (    )   0ooo                   |
+---\  (----(   )------------------+
    \_)     ) /
           (_/


{Quote hidden}

> >> {Original Message removed}

1997\10\30@083918 by Jason Wolfson

flavicon
face
Sorry about that, it seems my site suffers from sever link rot,,,
try http://www.ultranet.com/~jason/mchip.shtml

for my 20x4 LCD code with 4 push buttons.....

I'm registering a domain name now and I promise
to fix my page.............


{Original Message removed}

1997\10\30@123600 by Mike Keitz

picon face
On Thu, 30 Oct 1997 11:31:36 GMT+0200 "N STEENKAMP [M.ING E&E]"
<RemoveMESTEENKMPspam_OUTspamKILLspamFIRGA.SUN.AC.ZA> writes:
{Quote hidden}

This will work.  I usually use this circuit:

Vcc
  |
  R1
  |---R2--> PIC/LCD
  |
| o
| o
  |
GND

This way the PIC gets full 5V/0V drive regardless of the value of the
resistors.  When the PIC pins aren't in use for the LCD or the switches,
make them inputs or set them high to keep from wasting current through
the resistors.  If current flow through the switches while they are held
closed is a problem, connect the other end of the switches to a port so
they can be open or high when not being read.  The R2's prevent crosstalk
between the lines in any case.

This scheme can also be used with any input, not just a switch.  I
wouldn't recommend it for fast-changing signals though since the
resistors will limit the speed.  It is ideal for status lines from
voice-store chips, DTMF decoders, etc.

1997\10\31@075212 by Gordon Zerf

flavicon
face
Thank you for your help, much  appreciated.




At 13:24 30/10/97 -0000, you wrote:
{Quote hidden}

>> >> {Original Message removed}

1997\10\31@080915 by paulb

flavicon
face
Mike Keitz suggested placing the pull-up directly on the switch,
rather than at the PIC, which is sound advice ...

 except ...

that my first thought when I read the original request is that "this is
what the Port B weak pull-ups of various PICs are for".  Presuming that
parts count is a prime consideration, it makes sense to use these where
they are provided.  The voltage divider effect is of concern but the
maximum specified value for the weak pull-ups is 400µA corresponding to
the logic low maximum specification of 800mV if a 2K resistor is used in
series with the pushbutton.

 At worst, the 2K resistor will draw 2.5mA at 5V from a port output,
well within its drive capacity for as long as it needs to be asserted to
send data to the LCD.

 In this case of course, the I/O pins should idle as LOW outputs or
inputs.  The weak pull-ups are disabled on pins while they are outputs.
Current flow through the switches while they are held closed is unlikely
to be a problem for pushbuttons, particularly if these steps are taken.

 Well, that's my theory anyway!
       Paul B.


'A stupid question but...'
1997\11\01@032906 by Eric van Es
flavicon
face
Hi Gordon!

In future, spare a moment to make your message a _bit_ shorter? It wasn't
totally necessary to include the entire thread!

Thanks!
Cheers!


Gordon Zerf wrote:

{Quote hidden}

> >> >> {Original Message removed}

1997\11\01@145912 by Alessandro Zummo

flavicon
face
Il 31-Ott-97, Paul B. Webster VK2BZC scrisse:


>to be a problem for pushbuttons, particularly if these steps are taken.

>  Well, that's my theory anyway!

i'm a newbie, but i want to say my theory too...

 why don't we have a 4066 who activates the switches only when
the lcd isn't selected?

i.e.

                     1/4 4066
              |\
LCD E   ------| o------+
          ___ |/      _|_
Switch  --o o---------o o---------+------------- PIC (Port B)
                                  |
                                  +-- LCD D0

or something similar?


--

  - *Alex* -

     (.....azummospamRemoveMEita.flashnet.it)

1997\11\02@114638 by paulb

flavicon
face
Alessandro Zummo wrote:

>   why don't we have a 4066 who activates the switches only when
>  the lcd isn't selected?

(Nice diagram)

 Well, the long and short of it is keeping it simple.  You use a whole
4066 to connect/ disconnect four switches, and you use an extra PIC pin
function to perform the enable.  If you are going to devote these
resources, you could do it a lot better, such as using a shift register
chip to read up to eight switches (needing pull-up/ pull-down resistors)
with three connections to the PIC (latch data and shift may be commoned
to the LCD data pins and serial data, being an output may either go to a
separate PIC pin or be commoned to a third LCD data pin using a 33K
resistor).

 Or, continuing with the theme of the analog switches, a 4051 could be
connected to eight switches (no pull-ups here), a pull-up (4K7) on its
common and the ubiquitous 33K resistor to one data line while the other
three select the 1-of-8 on the 4051.

 The theory here is that an extra IC, be it 4066, 4051 or 74HC165
(shift register) COSTS - money, space and PCB holes (though if you are
using SMD, the latter are trivial).  However, the manufacturing cost for
those three ICs is almost identical, so IF you are going to use an extra
IC, you might as well get the maximum functionality.  Otherwise, the
discussion was about avoiding extra ICs.

 Here's a question to the professionals; am I correct here on costs?

 Board space: 1 16-pin IC = 14 resistors (through-hole)
 (& stuffing) 1 16-pin IC = 8 diodes (through-hole)
              1 16-pin IC = 4 resistors (SMD) = 4 diodes

 Money:       1 16-pin IC = 16 resistors = 8 diodes

 Cheers,
       Paul B.

More... (looser matching)
- Last day of these posts
- In 1997 , 1998 only
- Today
- New search...