Didn't mean to do represent any particular problem in that example,
but thanks for the solution!![]()
Hi there,
I use large array for led display display matrix, and until now, for small matrix, all work great
but as I increased dimension, I cant break limit for bit access method matrix.0(x), actually
if i use x variable work only as byte, x<256, if i use constant number works for greater than byte
my question is, is there way to fix pic 18 lib array part in some way to get matrix.0(word-variable) to work.
( i already have split to more array, so splitting into more than current 8 arrays is not an option for me)
;************************************************* ***************
;* Array routines *
;************************************************* ***************
;************************************************* ***************
;* ARRAYBIT : Translate array to FSR and bit *
;* *
;* Input : FSR0 = register *
;* : Carry, W = bit index (0 - 262) *
;* Output : FSR0 = register *
;* : R4 = bit mask *
;* : Z = bit state *
;* *
;* Notes : *
;************************************************* ***************
ifdef ARRAYBIT_USED
LIST
ARRAYBIT movwf R4 ; Save bit index
andlw 0f8h ; Clear bottom 3 bits
rrcf WREG, W ; / 8 (roll C into top)
rrcf WREG, W
rrcf WREG, W
addwf FSR0L, F ; Add /8 to register
btfsc STATUS, C
incf FSR0H, F
call CONVBIT ; Change bit number in R4 to mask
movwf R4 ; Save it
andwf INDF0, W ; Bit to Z while we're here
goto DUNN
NOLIST
CONVBIT_USED = 1
DUNN_USED = 1
endif
i mean fixing this, and part below which is needed for handling arrays
Regards
Just an idea...
Code:ArrayA VAR BYTE[1000] BitNo VAR WORD ByteInArray VAR WORD BitInByte VAR BYTE TmpByte VAR BYTE BitValue VAR BIT GetBit: 'Input Array,BitNo; Output BitValue ByteInArray=BitNo/8 TmpByte=ArrayA[ByteInArray] BitInByte=BitNo//8 BitValue=TmpByte.0[BitInByte] RETURN SetBit :'Input Array, BitNo,BitValue; Output: Array ByteInArray=BitNo/8 TmpByte=ArrayA[ByteInArray] BitInByte=BitNo//8 TmpByte.0[BitInByte]=BitValue ArrayA[ByteInArray]=TmpByte RETURN
Bookmarks