Recieving a string of data with full duplex serial object
dodger
Posts: 37
I am trying to recieve a string of data that has 18 bytes using the full duplex serial object.· I can send a byte through hyper terminal and recieve it on the propeller, but when i try to send a string i am having trouble.· Any suggestions or can someone point me in the right direction.·
thanks
thanks
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Visit my site -> [url=Http://www.rawcircuits.com]www.rawcircuits.com[/url]
I can connect my serial device through Hyper terminal and i have good communications.
But when i connect my serial device to the propeller i dont recieve anything. I think the problem i am having is a delimiter problem. I have tried (10) for line feed and (13) for Carriage return and still no joy.
Heres a copy of the data stream and my app
RS232 Datastream Format
mmmbsdddddbuuuuucl, where:
m Memory Location
s Sign (space or -) c Carriage Return
d Data with Decimal Point l Line Feed
u Units b Blank
{{ Prop Serial}}
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
VAR
long MyStr [noparse][[/noparse]64]
long Torque
OBJ
SER : "FullDuplexSerial"
TV : "tv_text"
Num : "Numbers"
Ext : "Extended_FDSerial"
PUB Main
Num.init
TV. start(12)
TV.str(string("Start",13))
TV.out(13)
Ext.start (17,16,0,9600)
{Ext.SetDelimiter (13)}
repeat 30
Ext.rxflush
{Ext.str(string("-0.148 INLB,"))} ' I can transmit this string and recieve it. This is what is expected from my serial device.
Torque := Ext.RxStrTime (200,@MyStr)
TV.str(@MyStr)
TV.out (13)
waitcnt (clkfreq/10 + cnt)
TV.str(string("End",13))
Ext.stop
as indention is very important to SPIN-soucecode use the Post reply button
and the [noparse][[/noparse] code ] [noparse][[/noparse] / code ] -commands to insert sourcecode into postings
or use the Attachment Manager
I modified your sourcecode that I can easily dbug it just by using
the serial-connection for programming
once the program is downloaded to the propeller or EEPROM
on PINS 31,30 you can use EXACTLY the same pins for whatever you like
Mike Green made a modified version of FullDuplex which has a 64byte buffer
I increased it to 128 bytes
you want to receive a 18 byte long string
the standard FDS-object can only receive 16 bytes
and the ExtendedFDSerial-object can receive only strings with 15 bytes
edited: another bug was your stringvariable was defined as a long it has to be defined as byte
as all string-functions of FDS and Extened_FDS expect strings as a BYTE-sequence NOT as a long-sequence
I attached the democode with included files
Extended_FDSerial_128ByteBuffers.spin
FullDuplexSerial_128ByteBuffers.spin
here is the democode
this democode works together with a terminalsoftware called Bray's Terminal
see attached zipfile
this terminalsoftware has a scripting function
Download the program to the EEPROM. NOT to RAM ! Brays-terminal causes a Reset of the propeller when opening the comport
If you start the demoprogram on the propeller you should get a receiving like that in brays-Terminal
simply echoes of the sended "R"
if you start the script you should receive in Brays Terminal something like this
from the original FullDuplex you get only 15 bytes like this
two "u"s missing
While developing software you should change only ONE thing at a time
and test this change until everything is working properly
here this means
use something to send and receive bytes that is working properly
connecting the propeller to a terminalprogram
then connecting the sensor to a terminal program to test if the sensor receives and sends properly
and first AFTER that connect propeller with sensor
best regards
Stefan
Post Edited (StefanL38) : 3/21/2009 5:08:17 PM GMT
I personally prefer to use a serial connection to debug things
(as this requires no extra hardware)
I think I have found the bug. The size of the bytearray
was too small
do the following change to your code
there was also a bug in ExtendedFDSerial_128ByteBuffers.spin
at two places the buffersize was still on 16 bytes
I corrected that in the new version
I attached a new archive
As I have no TV-screen laying around I could not test it
please test it yourself
if this change does not help
post a new question in the forum
best regards
Stefan