Hello everybody,
I have to fill more than one variable out of a flash data table. I wanted to use LOOKUP, but that doesn't really work for me. Unfortunately LOOKUP can't be combined with READ. Here some code for explanation:
[code:1:2c25b7f350]
Dim Var1 As Byte
Dim Var2 As Byte
Dim Var3 As Word
Dim Var4 As Word
Dim Var5 As Byte
Dim Var_ar(7) As Byte At Var1 Overlay
' Example, Index can go up to 250
Dim Index As Byte
Index = 1
Var_ar = Lookup(index , Datatable) ' <- Reads only Var_ar(1) = Var1
Var_ar(1) = Lookup(index , Datatable) ' <- Reads only Var_ar(1) = Var1
Var_ar = Lookup(index , Datatable)
Read Var2 ' <- Doesn't work, pointer for Read is not initialized by Lookup
Restore Datatable
Var_ar = Lookup(index , Datatable)
Read Var2 ' <- Doesn't work either, pointer for Read is not changed by Lookup (reads first byte)
$data
Datatable:
' Example, real Table is 250 * 7b = 1750b long
Data 1 , 2 , 3% , 4% , 5
Data 6 , 7 , 8% , 9% , 10
Data 11 , 12 , 13% , 14% , 15
'...
[/code:1:2c25b7f350]
So, what I need is an additional parameter for Lookup telling it, how many bytes to read, like
[code:1:2c25b7f350]
Var_ar = Lookup(index , Datatable, 7)
[/code:1:2c25b7f350]
I do, don't I?
[b:2c25b7f350][color=red:2c25b7f350](BASCOM-AVR version : 2.0.7.7 )[/b:2c25b7f350][/color:2c25b7f350]
↧