SPSTR and Serout
dcofer
Posts: 2
I am trying to implement fast data transfer between my PC and a BS2p40 chip. I am working with something that will need to send/recieve data with the computer constantly as fast as possible. I have done a number of speed tests and it turns out that I can recieve data much faster than I can send it. The reason for this is that I am using the SPSTR modifier with the serin command to directly write X number of bytes into scratchpad ram. But this modifier does not appear to work for serout. So the best I can do there is create a 20 byte array in my main memory, copy data from scratch pad into the array,·send that data·out, and repeat this for all the data. From the numbers I have run it looks like the thing that is slowing stuff down the most is the execution of the instructions in the loops that are needed to prep the temporary arrays for transmission. Serin with SPSTR appears to be optimized in some way so that it is much faster. So I·have a couple of questions regarding this problem.
1. Am I correct that there is no way to use SPSTR with serout? I tried it and it·would not compile. So·unless there is a trick I am missing·this·probably just does not work with serout.
2. Is there any way to set·an offset for where the SPSTR will begin looking for the data in scratchpad ram instead of at location 0?
3.·Does anyone know of a faster method of transfering data between the stamp and the PC. Right now the slowest part is literally the speed of code execution on the stamp itself rather than the transfer rate for serial communication.
Thanks,
David
1. Am I correct that there is no way to use SPSTR with serout? I tried it and it·would not compile. So·unless there is a trick I am missing·this·probably just does not work with serout.
2. Is there any way to set·an offset for where the SPSTR will begin looking for the data in scratchpad ram instead of at location 0?
3.·Does anyone know of a faster method of transfering data between the stamp and the PC. Right now the slowest part is literally the speed of code execution on the stamp itself rather than the transfer rate for serial communication.
Thanks,
David
Comments
·· No you cannot use SPSTR in the SEROUT.· I wonder, you said you are copying the data into an array and sending it from there.· Is this faster than reading a byte of SPRAM and sending it right out to the serial port in a loop?· I haven't tested it but thought I would throw that out there.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Bytes Temp Array One Byte at a Time Receiving Data
20 1482 1582 530
40 2804 2824 881
60 4105 4055 1231
80 5377 5377 1572
David
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com