There is an example for ReadTable in the GCBasic online help at http://gcbasic.sourceforge.net/help/. Here is an example of reading multiple Dallas DS18s20 one-wire temp sensors, that have a table of an eight byte serial number:
....
....
;Note- count is the number of sensors in the one-wire network
Sub OWoutRom
For EightBytes = 1 to 8
If count = 1 Then ReadTable SensorOne,EightBytes, SerialNum
If count = 2 Then ReadTable SensorTwo,EightBytes, SerialNum
....
....
For Clocks = 1 to 8
Dir DQ Out
Set DQ Off
wait 3 us 'Need to release bus within 15 us
If SerialNum.0 On then
Dir DQ In
End if
wait 60 us '60 us per AN2420
Dir DQ In 'HiZ the bus if still pulled low
wait 3 us
ROTATE SerialNum Right 'The DS18s20 wants data LSB first
Next
Next
Can someone give me sample code that will show how to use tables?
There is an example for ReadTable in the GCBasic online help at http://gcbasic.sourceforge.net/help/. Here is an example of reading multiple Dallas DS18s20 one-wire temp sensors, that have a table of an eight byte serial number:
....
....
;Note- count is the number of sensors in the one-wire network
Sub OWoutRom
For EightBytes = 1 to 8
If count = 1 Then ReadTable SensorOne,EightBytes, SerialNum
If count = 2 Then ReadTable SensorTwo,EightBytes, SerialNum
....
....
For Clocks = 1 to 8
Dir DQ Out
Set DQ Off
wait 3 us 'Need to release bus within 15 us
If SerialNum.0 On then
Dir DQ In
End if
wait 60 us '60 us per AN2420
Dir DQ In 'HiZ the bus if still pulled low
wait 3 us
ROTATE SerialNum Right 'The DS18s20 wants data LSB first
Next
Next
Table SensorOne
16
236
65
212
0
8
0
242
End Table
Table SensorTwo
16
37
128
228
0
8
0
92
End Table
....
....