Solved :) Data Block limits in Spin (More of an access issue I think)
Pliers
Posts: 280
I seem to have hit a limit as to how to access bytes in the Data block.
I'm using the FullDuplexSerial to communicate with an XBee.
The Xbee on the receiving end sends the bytes to a text to speech module.
The original program is much more complex, but when I started having problems I simplified it for this conversation.
Hello1 thru Hello10 is all the same data as you can see. The speech module says "Hello".
I can play Hello1 thru Hello6 without a problem. When I try Hello7 or above, the communications fail. I'm certain has to do with the addressing because I was getting misplaced bytes on the receiving end.
I'm using the FullDuplexSerial to communicate with an XBee.
The Xbee on the receiving end sends the bytes to a text to speech module.
The original program is much more complex, but when I started having problems I simplified it for this conversation.
Hello1 thru Hello10 is all the same data as you can see. The speech module says "Hello".
I can play Hello1 thru Hello6 without a problem. When I try Hello7 or above, the communications fail. I'm certain has to do with the addressing because I was getting misplaced bytes on the receiving end.
CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 VAR byte temp byte x ' Loop counter byte c ' Bytes to send byte k ' Data address OBJ Serial : "FullDuplexSerial" PUB main serial.Start(24, 25, %0000, 9_600) 'for the XBee communications waitcnt(cnt + 100000) k := @Hello2 'Anything above Hello6 does not work. C:=byte[k][0] x:=1 repeat C Temp := byte[k][x] serial.tx(Temp) x := x+1 repeat DAT Hello1 Byte 40, $7E, $00, $24, $00, $01, $00, $00, $00, $00, $00, $00, $00, $00, $00, $6E, $34, $0D, $0A, $77, $32, $30, $30, $0D, $0A, $76, $31, $30, $0D, $0A, $53, $20, $48, $65, $6C, $6C, $6F, $2E, $0D, $0A, $8B Hello2 Byte 40, $7E, $00, $24, $00, $01, $00, $00, $00, $00, $00, $00, $00, $00, $00, $6E, $34, $0D, $0A, $77, $32, $30, $30, $0D, $0A, $76, $31, $30, $0D, $0A, $53, $20, $48, $65, $6C, $6C, $6F, $2E, $0D, $0A, $8B Hello3 Byte 40, $7E, $00, $24, $00, $01, $00, $00, $00, $00, $00, $00, $00, $00, $00, $6E, $34, $0D, $0A, $77, $32, $30, $30, $0D, $0A, $76, $31, $30, $0D, $0A, $53, $20, $48, $65, $6C, $6C, $6F, $2E, $0D, $0A, $8B Hello4 Byte 40, $7E, $00, $24, $00, $01, $00, $00, $00, $00, $00, $00, $00, $00, $00, $6E, $34, $0D, $0A, $77, $32, $30, $30, $0D, $0A, $76, $31, $30, $0D, $0A, $53, $20, $48, $65, $6C, $6C, $6F, $2E, $0D, $0A, $8B Hello5 Byte 40, $7E, $00, $24, $00, $01, $00, $00, $00, $00, $00, $00, $00, $00, $00, $6E, $34, $0D, $0A, $77, $32, $30, $30, $0D, $0A, $76, $31, $30, $0D, $0A, $53, $20, $48, $65, $6C, $6C, $6F, $2E, $0D, $0A, $8B Hello6 Byte 40, $7E, $00, $24, $00, $01, $00, $00, $00, $00, $00, $00, $00, $00, $00, $6E, $34, $0D, $0A, $77, $32, $30, $30, $0D, $0A, $76, $31, $30, $0D, $0A, $53, $20, $48, $65, $6C, $6C, $6F, $2E, $0D, $0A, $8B Hello7 Byte 40, $7E, $00, $24, $00, $01, $00, $00, $00, $00, $00, $00, $00, $00, $00, $6E, $34, $0D, $0A, $77, $32, $30, $30, $0D, $0A, $76, $31, $30, $0D, $0A, $53, $20, $48, $65, $6C, $6C, $6F, $2E, $0D, $0A, $8B Hello8 Byte 40, $7E, $00, $24, $00, $01, $00, $00, $00, $00, $00, $00, $00, $00, $00, $6E, $34, $0D, $0A, $77, $32, $30, $30, $0D, $0A, $76, $31, $30, $0D, $0A, $53, $20, $48, $65, $6C, $6C, $6F, $2E, $0D, $0A, $8B Hello9 Byte 40, $7E, $00, $24, $00, $01, $00, $00, $00, $00, $00, $00, $00, $00, $00, $6E, $34, $0D, $0A, $77, $32, $30, $30, $0D, $0A, $76, $31, $30, $0D, $0A, $53, $20, $48, $65, $6C, $6C, $6F, $2E, $0D, $0A, $8B Hello10 Byte 40, $7E, $00, $24, $00, $01, $00, $00, $00, $00, $00, $00, $00, $00, $00, $6E, $34, $0D, $0A, $77, $32, $30, $30, $0D, $0A, $76, $31, $30, $0D, $0A, $53, $20, $48, $65, $6C, $6C, $6F, $2E, $0D, $0A, $8B
Comments
btw - There are lots of optimizations you can make in Spin for example:
serial.tx(byte[k][x++])
or
x += 1
etc
Andy
I don't write much code, so those optimizations get forgotten. All I want is my robot to talk.
Back to the problem. What did I do wrong with the Data addressing?
For sure for arrays this is different. There you can save a lot of memory with byte or word arrays.
Andy