View Full Version : FullDuplex String Question

Brian Carpenter
11-02-2010, 04:43 AM
I have a question concerning the printing of a string with FullDuplex to my PC.

I have been playing with the WiFly program that Rayman wrote. Instead of displaying that data to the 4.3 touch screen that he wrote it for, i would like to display the information to my PC via FullDuplex.
First, i will have to admit that i didnt understand the parsing of the data, but now i understand it.

pos1:=pos2+1'SeekString(pos2+2,pSearch,@WebPageBuf fer)


'Print Weather
repeat i from pos1+3 to pos2-1

The top part is how he determines where the data is in the string that he wants. The second part is how he is printing it to his screen.

So if i know how to find the start of my string and the end of the string, how do i output it to FullDuplex?
I have a

PUB str(stringptr)

'' Send string

repeat strsize(stringptr)

but that would print everything and not the range i want. So, what am i missing?

Brian Carpenter
11-02-2010, 04:56 AM
Looking at this some more....
Knowing that i have pos1 and pos2, can i subtract the two and get the Length of the String and then modify the code and pass the value StringLength to fullduplex?

PUB str(stringptr)

'' Send string

repeat strsize(StringLength)

Mike Green
11-02-2010, 05:07 AM
By convention, most string routines for the Propeller use the C convention of a zero byte as a string terminator so the starting address of the string can be passed around as the string itself. The str() routines used for most character I/O drivers assume this as you can see in the code for str() in FullDuplexSerial.

There is no particular reason why you can't have other conventions. You can supply your own str() variation that uses two parameters, one a starting address and the other a string length like:

PUB strTwo( addr, length )
repeat length

or this with a starting and ending address:

PUB strThree(startAddr, endAddr)
repeat endAddr - startAddr + 1

Brian Carpenter
11-02-2010, 05:12 AM
thank you Mike Green. I will give that a try and see if i can make it work for me. I will report back.

thanks again