Trying to READ a data table
skynugget
Posts: 172
hey all, im trying to populate a 4 bytes of a 12 byte array from a data table as follows. my current method doenst seem to be indexing proper. it seems straight forward, am i doing this write?
thanks in advance.
Post Edited (skynugget) : 5/13/2010 3:50:48 PM GMT
thanks in advance.
' ------------------------------------------------------------------------- ' Use: DTMF_OUT number (10 = *, 11 = #) ' SUB DTMF_OUT tmpB1 = __PARAM1 tmpb1 = tmpb1 * 4 '0 = 0 ,1 = 4, 2 = 8 etc... FOR idx = 1 to 4 READ DTMF_Table + tmpB1, ToneGen(idx) ' populatte byets 1 thru 4 INC tmpb1 NEXT DTMFen = yes ' go tone DELAY_MS ToneDelay ' hold for tones timing DTMF_OFF ' stop the tones ENDSUB
DTMF_Table: ' LO '' HI ' DATA $1E, $92, $2B, $67 '0 DATA $16, $A4, $27, $46 '1 DATA $16, $A4, $2B, $67 '2 DATA $16, $A4, $2F, $FB '3 DATA $19, $03, $27, $46 '4 DATA $19, $03, $2B, $67 '5 DATA $19, $03, $2F, $FB '6 DATA $1B, $AD, $27, $46 '7 DATA $1B, $AD, $2B, $67 '8 DATA $1B, $AD, $2F, $FB '9 DATA $1E, $92, $27, $46 '* DATA $1E, $92, $2F, $FB '#
Post Edited (skynugget) : 5/13/2010 3:50:48 PM GMT
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php
im trying to skip byte zero and populate bytes 1 - 4.
sort of like this statement.
put tonegen(1), $1E, $92, $2B, $67
it seems like my offset value is getting locked up in the for next loop somehow? example: for number 3
Post Edited (skynugget) : 5/14/2010 12:13:05 PM GMT
To read 4 bytes at once,·you can do this, but without the loop.
READ·DTMF_Table·+·offset,·ToneGen(1), ToneGen(2),ToneGen(3),ToneGen(4)
Or do a byte at a time
··offset·=·offset·*·1························'0·=·0·,1·=·4,·2·=·8·etc...
··FOR·idx·=·1·to·4
······READ·DTMF_Table·+·offset,·ToneGen(idx)
····INC·offset
····NEXT
·
skynugget -- what values are you passing to offset? > 15 ?
You could try this:
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php
Another thought, he can do is:
offset = offset * 4 '0 = 0 ,1 = 4, 2 = 8 etc...
FOR idx = 1 to 4
READ DTMF_Table + offset, ToneGen1(idx), ToneGen2(idx),ToneGen3(idx),ToneGen4(idx)
INC offset
next
skynugget, when you say array, do you mean in Ram or Rom? It really does't make sense to do it that way, as the data is in ROM, and can just address it from there, instead of reading all into an array. Then there's the >15 issue that zoot brought up.
Remember SXSim is your friend (with the updated revision!), and there's a nice memory map when you do a 'view list' at the bottom .
Anyhoo, not sure if this helps or not, but always a pleasure to chat! [noparse]:o[/noparse])
the tonegen array is a memory bank for a dtmf generator running in the isr.
it turns out it has something to do with my variables, i cleared some out and now all the ideas get the job done... im not sure why that fixes it. im only using 17 bytes of ram total so far. im not sure what problem ill have as i add features.
heres what im working with so far...
toneGen VAR Byte (14) BANK ' keep in single bank
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php
thank bank definition hasn't fixed the problem. if i define anything before my offset (tmpb1) variable, its a non go. if i define that var within. so far though any variable i define after that work for everything ive tried so far... odd.