??? 09/15/06 09:14 Read: times |
#124345 - Subroutine Details Responding to: ???'s previous message |
SCAN_MATRIX_KEYBOARD:
subroutine is used to find whether any coulmn ie. lower nibble of PORT 1 is high or low. If any column or a single bit in the lower nibble of PORT 1 is found to be low that means there is some key pressed and so jumped to the next subroutine named AHEAD. Otherwise continuos loop will be there to check is there any column is low or not. AHEAD: subroutine is used to find whether any ROW ie. higher nibble of the PORT 1 is high or low. If any row or a single bit in the higher nibble is low implioes that any key has been pressed and so jumped to the next subroutine named PROCESS_SCAN. Otherwise jump to SCAN_MATRIX_KEYBOARD for continious loop will be there to check is there any column is low or not. PROCESS_SCAN : subroutine is to check again whether any key is pressed or not in the form of checking the column status. If in this subroutine it is found that the onbe of the bit in the lower nibble of PORT 1 is low ie. column is low then it will jump to next subroutine named ROW_SCAN_1 to check which row is correspondingly low to this column. ROW_SCAN_1: Subroutine is to check whether the first ROW ie bit 4 is low or not by the statement ; before the below statement acc will be having the ; value of PORT 1 anl a, #0f0h ; here columns are made low and only ; rows are scanned cjne a, #0e0h, ROW_SCAN_2 sjmp ROW_1 Similarly ROW is scanned and if any value is matched then the control jump to corresponding ROW_number so that the DPTR pointer will have the address of the corresponding staring row address in the look up table. FINAL : it is used for getting the value of PORT 1 as the coulmn is to be evaluated after the row has been scaned. MATCH : this subroutine is used to calculate the value of column by seeing the CARRY flag and when CARRY flag is found to be clear then the corresponding value address from DPTR is moved to Accumulator and in this way the keypressed can be scanned. regards AS |