This is a multi-part message in MIME format. --------------94264DE4C79988F8B8DE565B Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit --------------94264DE4C79988F8B8DE565B Content-Type: message/rfc822 Content-Transfer-Encoding: 7bit Content-Disposition: inline Return-Path: Received: from smtp017.mail.yahoo.com ([216.136.174.114]) by priv-edtnes10-hme0.telusplanet.net (InterMail vM.5.01.04.01 201-253-122-122-101-20011014) with SMTP id <20020209203720.DRJF20752.priv-edtnes10-hme0.telusplanet.net@smtp017.mail.yahoo.com> for ; Sat, 9 Feb 2002 13:37:20 -0700 Received: from host225008.arnet.net.ar (HELO light-nbk.yahoo.com) (200.45.225.8) by smtp.mail.vip.sc5.yahoo.com with SMTP; 9 Feb 2002 20:37:13 -0000 Message-Id: <5.0.0.25.2.20020209165139.01f432a8@pop.mail.yahoo.com> X-Sender: lu2aoq@pop.mail.yahoo.com X-Mailer: QUALCOMM Windows Eudora Version 5.0 Date: Sat, 09 Feb 2002 17:04:09 -0300 To: dpharris@telus.net From: leandro Subject: Re: [PIC]: CHALLENGE: 4x4 keyboard and LCD with 1 port = 8 bits In-Reply-To: <3C656008.C876EBE7@telus.net> References: <3C64A274.2070403@ubasics.com> <005d01c1b17b$5bb707a0$0101a8c0@brusque> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Mozilla-Status2: 00000000 Hi! I was thinking. Can you add another IC??, or It must be with the PIC only?. I think that if you ad an 74LS138, you can scan 4 rows of the keyboard with only 2 pins on the IC and the extra cost is still very low (if this is the case :-) so we can imagine this: PIC - DISPLAY - 4x4 Keyb. -------------------------------------------------------- RB0 E none RB1 R/S none RB2 none D0 (74LS138) RB3 none D1 (74LS138) RB4 B4 RB5 B5 RB6 B6 RB7 B7 R/W is not really needed (I am counting that you are trying to use an intelligent LCD) because R/W is only necessary to read the internal Ram or the status but if you calculate the time it will work perfect, I have several proyects working without using the R/W, just tied it to the Write level and that's all. The Rows controlled by 74LS138 must be feeded via resistor, at least 1K, to the push buttons, so when you set the RB4-7 to Outputs to control the display and someone push a button, nothing wrong will happens. now without the extra 138, I don't see how can you do that, the main problem is the E (Display enable), I can't imagine how to solve it in 8 bits without the 138, sorry. I hope that this can help you with your proyect, it's just an idea. see you Leandro At 09:44 09/02/2002 -0800, you wrote: >Hi- > >I was hoping that I could do both a 4x4 kb and an LCD with only one register. >However, I do not think it is possible - although I wouldn't put it past >some of >the people on this list comig up with a solution. You need 4 outputs to scan >the kb, and 4 inputs to read the kb. The LCD needs 4 bits data, a register >select bit, and a control bit. As I see it, you start messing up the >display if >you try to multiple use the pins. Best I can do is one port and one extra >line, so... > >CHALLENGE: can you scna a keyboard, and run an LCD display with only 8 >pins/bits >= 1 port -- without extra active hardware? > >David H > >Edson Brusque wrote: > > > Hello Adam, > > > > > The routine can be found in this C file: > > > http://www.ubasics.com/adam/electronics/ha/ver000101/node.c > > > search for "char scankp(void)" > > > > what I'm doing seens to be simpler. The routine on the bottom of this > > email uses a 4x4 keypad in PORTB. ROWS are on RB3:RB0 and columns on > > RB7:RB4. RB3:RB0 (outputs) is also the DB7:DB4 lines to the LCD. The > code is > > below and although it's a bit BIG in C, it could be made smaller in > > Assembly. > > > > Best regards, > > > > Brusque > > > > ----------------------------------- > > Edson Brusque > > Research and Development > > C.I.Tronics Lighting Designers Ltda > > Blumenau - SC - Brazil > > www.citronics.com.br > > Say NO to HTML mail > > ----------------------------------- > > > > /* **************************************** */ > > /* Sorry, no coments :) */ > > uns8 get_key_pressed(void) > > { > > uns8 key_buffer; > > > > key_buffer = 0; > > > > PORTB = 0b1110; > > delay_cycles(5); > > if (!PORTB.B4) key_buffer = '1'; > > if (!PORTB.B5) key_buffer = '2'; > > if (!PORTB.B6) key_buffer = '3'; > > if (!PORTB.B7) key_buffer = '4'; > > > > PORTB = 0b1101; > > delay_cycles(5); > > if (!PORTB.B4) key_buffer = '5'; > > if (!PORTB.B5) key_buffer = '6'; > > if (!PORTB.B6) key_buffer = '7'; > > if (!PORTB.B7) key_buffer = '8'; > > > > PORTB = 0b1011; > > delay_cycles(5); > > if (!PORTB.B4) key_buffer = '9'; > > if (!PORTB.B5) key_buffer = '0'; > > if (!PORTB.B6) key_buffer = 'A'; > > if (!PORTB.B7) key_buffer = 'B'; > > > > PORTB = 0b0111; > > delay_cycles(5); > > if (!PORTB.B4) key_buffer = 'C'; > > if (!PORTB.B5) key_buffer = 'D'; > > if (!PORTB.B6) key_buffer = 'U'; > > if (!PORTB.B7) key_buffer = 'E'; > > > > return key_buffer; > > } > > > > /* **************************************** */ > > /* This is a debounce sugestion, never used */ > > uns8 get_key_pressed_debounce(void) > > { > > if (get_key_pressed()) { > > delay_ms(50); > > return get_key_pressed(); > > } > > } > > > > -- > > http://www.piclist.com#nomail Going offline? Don't AutoReply us! > > email listserv@mitvma.mit.edu with SET PICList DIGEST in the body > >-- >http://www.piclist.com#nomail Going offline? Don't AutoReply us! >email listserv@mitvma.mit.edu with SET PICList DIGEST in the body _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com --------------94264DE4C79988F8B8DE565B-- -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body