Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/14/00 19:23
Read: times


 
#1494 - RE: keypad
hi

Steve is right, I just built one keyboard interface with 3xRows and 3xcolums, total six lines for 9 keys. I used one port's (port1) lower 6bits. And remaining two bits of port, I am using for other purposes. For example I am using port pins P1.0, p1.1 and p1.2 as row, p1.3, p1.4 and p1.5 are columns. P1.6 and p1.7 are used for other signals. So While reading I code as below:

MOV A,P1 ; read port into A
ANL A,#38h ; mask upper two bits in order to get correct row-col data.
......other codes as per your requirements

for Writing the code I coded as

Get code in the Accumulator first
Then
ANL A,#038 ; make upper two bits as zero, or mask upper 2 bits.
ANL P1,#0C0 ; make lower 6bits of port1 as all zeroes
ORL P1,A ; OR contents of Acc to port1 .

This way, you will not touch the value of upper 2 bits at port1. I have developed this code and its working without fail.

Goodluck

Rauf


List of 7 messages in thread
TopicAuthorDate
keypad            01/01/70 00:00      
RE: keypad            01/01/70 00:00      
RE: keypad            01/01/70 00:00      
RE: keypad            01/01/70 00:00      
RE: keypad            01/01/70 00:00      
RE: keypad            01/01/70 00:00      
RE: keypad            01/01/70 00:00      

Back to Subject List