Ian
Possibly an alternative can be something like this:
Say you have a bunch of registers for your RF Module called [b:f3832ac8ad]reg_1,2,3,4,5,6,7[/b:f3832ac8ad]
and you want to use [b:f3832ac8ad]Setting 2[/b:f3832ac8ad] from the DATA statements which is the second row
[code:1:f3832ac8ad]Index = 1 ' Second Row (zero based)
Status = SetConfig (1)
End
Function SetConfig ( Byval index As Byte) As Byte
' add some code to do some checking it index is out of range
Local Idx As Integer
Idx = Index * 10
reg_1 = Lookup (Idx, MODEM_CONFIG_TABLE): Incr Idx
reg_2 = Lookup (Idx, MODEM_CONFIG_TABLE): Incr Idx
reg_3 = Lookup (Idx, MODEM_CONFIG_TABLE): Incr Idx
reg_4 = Lookup (Idx, MODEM_CONFIG_TABLE): Incr Idx
reg_5 = Lookup (Idx, MODEM_CONFIG_TABLE): Incr Idx
reg_6 = Lookup (Idx, MODEM_CONFIG_TABLE): Incr Idx
reg_7 = Lookup (Idx, MODEM_CONFIG_TABLE): Incr Idx
End Function
ConfigData:
Data &H40, &H0a, &H1d, &H40, &H0a, &H1d, &H62, &H2c, &H33, &H08 ' Setting 1
Data &H40, &H0a, &H1d, &H80, &H60, &H10, &H62, &H2c, &H22, &H08 ' Setting 2
Data &H40, &H0a, &H1e, &H80, &H60, &H13, &Ha9, &H2c, &H22, &H3a ' Setting 3
Data &H40, &H0a, &H1e, &H80, &H60, &H27, &H52, &H2c, &H22, &H48 ' Setting 4[/code:1:f3832ac8ad]
↧