EXTENDED_FDSERIAL.SPIN, help with Strings and serial
DavidM
Posts: 630
HI,
I have got the Serial ( FULLDUPLESSERIAL.SPIN) working on my propellor dev board and successfully? sending characters from a terminal app to the prop.
Q1) Do I need to use the new EXTENDED_FDSERIAL.SPIN code ( as well as the current one) to be able to easily send strings back and forth?
Q2) I tried to load in the code via the OBJ function, but when I compile I get an error , that the spin code cannot be found!, I have the code in my library and opened in the editor.What am I doing wrong?
Q2) Do I need to use the variable type WORD for the string(s) that I send and receive, instead of BYTE ?
Q3) How do you concatenate strings? Including adding a string with a integer e.g. "COMMAND" + 999 to get "COMMAND999"
Q5) Can I make the RX & TX buffers larger that 16 characters?
thanks
Dave M
I have got the Serial ( FULLDUPLESSERIAL.SPIN) working on my propellor dev board and successfully? sending characters from a terminal app to the prop.
Q1) Do I need to use the new EXTENDED_FDSERIAL.SPIN code ( as well as the current one) to be able to easily send strings back and forth?
Q2) I tried to load in the code via the OBJ function, but when I compile I get an error , that the spin code cannot be found!, I have the code in my library and opened in the editor.What am I doing wrong?
Q2) Do I need to use the variable type WORD for the string(s) that I send and receive, instead of BYTE ?
Q3) How do you concatenate strings? Including adding a string with a integer e.g. "COMMAND" + 999 to get "COMMAND999"
Q5) Can I make the RX & TX buffers larger that 16 characters?
thanks
Dave M
Comments
If I follow you, you should only need the newest one, which includes all the old plus a few new things.
Q2) I tried to load in the code via the OBJ function, but when I compile I get an error , that the spin code cannot be found!, I have the code in my library and opened in the editor.What am I doing wrong?
Not sure, can you post that section of your code?
Q2) Do I need to use the variable type WORD for the string(s) that I send and receive, instead of BYTE ?
Strings are an array of bytes.
Byte myString[noparse][[/noparse]16]
Q3) How do you concatenate strings? Including adding a string with a integer e.g. "COMMAND" + 999 to get "COMMAND999"
Do you need it together in memory or simply transmitted that way?· To Transmit:
· serial.str(string("COMMAND"))
· serial.dec(999)
· Serial.tx(13)·· ' carriage return if needed.
If you need to concatenate in memory, you'll need to do something fancier,such as creating another string area and moving each other into it using Bytemove and indexing properly. I've thought about extendeding Extended_FD (or a new object)·to help with some common string functions, but not sure when - not soon I know.···
Q5) Can I make the RX & TX buffers larger that 16 characters?
Not without some work, but generally it's not a big issue.· If you transmit more than 16, FullDuplexSerial will take care of getting it all out.· If you have a single incoming string greater that 15 that you can't parse into smaller strings by a delimiter, it could be an issue.· Thinking about it, since Spin is so much faster than serial data, if you time it right you may be able to collect more than 15 characters in·a single request after defeating the check in the code.· I'll have to try it out.·
-Martin
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
StampPlot - GUI and Plotting, and XBee Wireless Adapters
Southern Illinois University Carbondale, Electronic Systems Technologies
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
StampPlot - GUI and Plotting, and XBee Wireless Adapters
Southern Illinois University Carbondale, Electronic Systems Technologies
I will post my code shortly . ( I am using a mac for email ( and everything else) , my PC is not networked to my network, its just for the propellor work)
Also, I am planning on getting some of those XBEE PRO wireless modules, this serial stuff I am learning is for the wireless modules, I noticed the you have a website that sells adaptor modules for these. Can the XBEE PRO modules be connected directly to the PROPELLOR? If so , what circuit, Pins , power requirements etc is required?
regards
Dave M
The XBee can be directly connected. My low voltage boards just simplify the task, including a board pinned out for the new ProtoBoard header. You can pick and 2 pins for TX and RX and go for it. It's how I debug since I can have a terminal program connected to a USB-XBee, and the prop on the other and transparantly send data back and forth.
With connecting the XBee:
Vdd
Vss
any pin to TX (XBee Din), such as 2
any pin to Rx (Xbee Dout), such as 3
Simply modify the start:
Serial.Start(3,2,0,9600)
And you have fully error checked wireless transparent comms. With the Pro's, current draw is around 50mA rx and idle, and 200mA tx.
I plan on releasing an XBee object this qtr I hope with both AT and API interfacing for the XBee (it's how you set addresses, channels, etc). AT is ready to go, API will take a little longer.
One reason I wrote Extended_FD was to help with all the serial data I send around, XBee, StampDAQ, StampPlot, etc.
Glad you got me thinking about the buffer issues, we can make it larger in Extended_FD with certain limitations.
-Martin
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
StampPlot - GUI and Plotting, and XBee Wireless Adapters
Southern Illinois University Carbondale, Electronic Systems Technologies
I have been watching a bit from the side lines, and have a question. How do I capture the incoming Ascii data (assuming numeric and one character at a time followed by a CR) and allow it to be displayed on a 1 of 10 bank of LEDs, say pins 1 to 10?
In other words, I want to capture and convert the string variable "mystring" from the line Serial.RxStr(@mystring) from line 10 your code posted 02-10-2007, and present it to a local display.
CODE
CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 OBJ Serial : "Extended_FDSerial" Var byte mystring[30]Pub Start Serial.start(31,30,0,9600) ' Rx,Tx, Mode, Baud Serial.RxStr(@mystring) serial.tx(13) serial.str(@mystring)
Dave Schalliol