Quote Originally Posted by Acetronics View Post
Hi, Sayzer

Why not use Peekcode and Pokecode ... or simply LOOKUP ( if no change in values ) ??? ... 255 values is the limit for Pic 16F.

With Peekcode/Pokecode, you also can load your data at once including a txt file ...


( No thought to the project section, of course ... !!! )

Alain
Hi Alain,
Yes, as you mentioned, the values change. I get data from PC into a Mem array.


Quote Originally Posted by mister_e View Post
Sayzer, are you saying that Using EXT with Labels in post #1 doesn't work? I don't think so

Hi Steve, I need an array not a table. In post#1, the table is for constants, isn't it?

BTW, Apart from this subject, I have spent so much time working on that table but could not read the correct values back from that table. It was not stable.


Quote Originally Posted by Darrel Taylor View Post
Hi Sayzer,

No, EXT won't work that way.
The arrays would not be contiguous, and located in different banks.

I've never tried using big arrays on a 16F before, I'd just use an 18F when I need more than 96 bytes.
However, confronted with a challenge ... I have to try.
Here's what I've come up with ...
Code:
Array1Size  CON 64
Array2Size  CON 96               ; 96 is the largest for 16F877
Array3Size  CON 96               ; 96 + 96 + 64 = 256 bytes
MyArray1    VAR BYTE[Array1Size]  
MyArray2    VAR BYTE[Array2Size] 
MyArray3    VAR BYTE[Array3Size] 

Idx         VAR BYTE
Abyte       VAR BYTE
;---------------------------------------------------------------------------
GetArray:      ; Set Idx before calling, result is in Abyte
  SELECT CASE Idx
    CASE IS < Array1Size
              Abyte = MyArray1(Idx)
    CASE IS < (Array1Size + Array2Size)
              Abyte = MyArray2(Idx - Array1Size)
    CASE ELSE
              Abyte = MyArray3(Idx - (Array1Size + Array2Size))
  END SELECT
RETURN

PutArray:      ; set Idx and Abyte before calling
  SELECT CASE Idx
    CASE IS < Array1Size
              MyArray1(Idx) = Abyte
    CASE IS < (Array1Size + Array2Size)
              MyArray2(Idx - Array1Size) = Abyte
    CASE ELSE
              MyArray3(Idx - (Array1Size + Array2Size)) = Abyte
  END SELECT
RETURN
Then to use it ...
Code:
    Idx = 180
    Abyte = 123
    GOSUB PutArray

    Idx = 180
    GOSUB GetArray
    LCDOUT DEC Idx,"=",DEC Abyte
Or something like this, which sets each element to it's own Idx value, then reads them back and displays the saved value.
Code:
Main:
  FOR Idx = 0 to 255
    Abyte = Idx
    GOSUB PutArray
  NEXT Idx

  FOR Idx = 0 to 255
    GOSUB GetArray
    HSEROUT ["G-",IDEC3 Idx,"  ",IDEC Abyte,13,10]
  NEXT Idx

STOP
Not as easy as MyArray(180), but it's an option.

Then if you want, you can add a couple macros to make it look more like what you wanted ...
Code:
ASM
#GetArray  macro Idx, Bout
    MOVE?BB  Idx, _Idx
    L?CALL   _GetArray
    MOVE?BB  _Abyte, Bout
  endm
  #define GetArray(Idx, Bout)  #GetArray  Idx, Bout
    
#PutArray  macro Idx, Bin
    MOVE?BB  Idx, _Idx
    MOVE?BB  Bin, _Abyte
    L?CALL   _PutArray
  endm  
  #define PutArray(Idx, Bin)  #PutArray  Idx, Bin
ENDASM
Which then lets you do this...
Code:
MyByte   VAR BYTE

@ PutArray(_Idx, _MyByte)   ; similar to MyArray(Idx) = MyByte

@ GetArray(_Idx, _MyByte)   ; similar to MyByte = MyArray(Idx)
HTH,

Hi DT,

I had made something similar to your first example, but as you mentioned, it is not as easy as using something like Arg0[180].

I must learn this ASM thingie in much upper level to comeup with my own routines.

Thanks very much to all.
----------------------------