wrword error question
David B
Posts: 592
What's illegal about using a word variable for wrword when writing to a word hub address?
If the commented line is uncommented, the propeller tool says "Error: Address is not long." Otherwise the code works as expected.
If the commented line is uncommented, the propeller tool says "Error: Address is not long." Otherwise the code works as expected.
DAT org 0 test_cog mov data_pointer, par wrword a_long_1, data_pointer add data_pointer, #2 wrword a_long_2, data_pointer add data_pointer, #2 wrword a_word_1, data_pointer add data_pointer, #2 ' wrword a_word_2, data_pointer ' <- compiler says "Error: Address is not long." idle jmp #idle a_long_1 long 1 a_long_2 long 2 a_word_1 word 3 a_word_2 word 4 data_pointer res 1
Comments
... or, if you don't want to use a temporary variable:
-Phil
-Phil
Unless you have a large table in bytes or words, it's probably not worth the trouble...
-Phil
hubram:
cogram:
But I wanted to convert it to have the adc write to a several K sized hub array as a circular buffer where since it only uses 16 bits, writing longs would be really wasteful of ram.
It looks like it's working now; it was just that word declaration thing that caught me by surprise.
Every time you want to send the lower 16bit of those longs, you do this below and you will not waste any HUB ram
Though I see that hub access will stall as 2 (regular) cog instructions in between is fastest, so optional put 2 more instruction in the loop that does something useful.