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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/06/04 11:20
Read: times


 
#67997 - Asm 2 C
Hi all

Can anyone help me to wright my assembler program into C. The keypad(4x3) is connected up as a peripheral. I'm using a MM74C922 encoder, to detect which key of the keypad has been pressed.

ORG 0000H

wait:
jb P1.2, press ;detects whether DA has been
;set
sjmp wait ;if not, wait for key press

press:
mov DTPR,#0c000h ;read 8 bits from keypad via
movx a, @DTPR ;data bus
anl a,#0fh ;isolate lower bits
mov dptr, #table ;define start of lookup table
movc a, @a+dptr ;use a as an offset, and read
;ascii value from table

send:
mov p3,a ;send ascii character to port3
sjmp wait ;back for next key press

;returns with ASCII value of key pressed.
;
table: DB 31h,32h,33h,43h,34h,35h,36h,44h
DB 37h,38h,39h,45h,41h,30h,42h,46h
;
end

List of 14 messages in thread
TopicAuthorDate
Asm 2 C            01/01/70 00:00      
   RE: Asm 2 C            01/01/70 00:00      
      RE: Asm 2 C            01/01/70 00:00      
         RE: Asm 2 C            01/01/70 00:00      
         RE: Asm 2 C            01/01/70 00:00      
         RE: Asm 2 C            01/01/70 00:00      
            RE: Asm 2 C            01/01/70 00:00      
               RE: Asm 2 C            01/01/70 00:00      
                  RE: Getting Started            01/01/70 00:00      
                     RE: Getting Started            01/01/70 00:00      
                        Let battle commence...            01/01/70 00:00      
                           RE: Let battle commence...            01/01/70 00:00      
                           RE: Let battle commence...            01/01/70 00:00      
                              RE: Let peace reign...            01/01/70 00:00      

Back to Subject List