Deb's PICLIST Page |
USEFUL LINKS Xenu the link checker. Praise Xenu! |
;Aaarrgh .. indexed addressing in MCUs gives me a LOT of mental worry. ;This routine should work, however .... ;Grab 4 bytes of data and place'em in successive mem locations. ;Use INDEXING ! ;Decrement the array offset so we don't have to use a counter as well. ;More compact code? ;Debbie H. clrf FSR clrf INDF clrf keydata ;Keypad byte goes here clrf data04 clrf data03 clrf data02 clrf data01 movlw 0x04 ;Initial value = 4 movwf offset ;so 1st array element goes in data01 ;Important! ;Arrange keydata &data01 .. data04 in consecutive memory addresses. loop call kpdgrab ;Subroutine returns a byte from a 4x4 keypad movlw keydata ;Get the data address and addwf offset,w ;find its destination movwf FSR ;Tell the MCU where to shove it movf keydata,w ;Get the data byte and movwf INDF ;move the new keydata contents decfsz offset,f ;Get ready for the next address goto loop ;do it again. fin goto $