Transmit data between 2 propellers - please Help!
Hello, I have managed to setup 2 propellers running with the same configuration and from the same power output (Same Vss). The one collects data from various sensors and the other one must log them to a datalogger. I 've managed to make this two tasks work but i cannot connect the two propellers together so i can transmit the information between the propellers. I tried the fast inter-propeller object with no luck. Can i use a serial object to transmit decimal numbers and strings between the propellers? what is the simplest way to transmit data between 2 propellers? As far as i can understand i need to dedicate two pins in each propeller for rx tx communication and connect the first propeller tx pin to the second propeller rx and vice versa with 10k resistors for safety. Please help me i am a bit of desperate here because of university project that i have… I am a bit of newbie with propeller
Thanks in advance
Thanks in advance

Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Visit some of my articles at Propeller Wiki:
MATH on the propeller propeller.wikispaces.com/MATH
pPropQL: propeller.wikispaces.com/pPropQL
pPropQL020: propeller.wikispaces.com/pPropQL020
OMU for the pPropQL/020 propeller.wikispaces.com/OMU
pPropellerSim - A propeller simulator for ASM development sourceforge.net/projects/ppropellersim
then for the transmit propeller i use this code
CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 obj PST :"Parallax Serial Terminal" Sub Transmit repeat PST.StartRxTx(14, 15, 0, 57600) 'Connect to the other propeller pst.Str(String("just a string")) 'send a string pst.Dec(123) 'send a valueand on the receiver this code
Will this work or i am writing irrelevant things???
thank you
transmit propeller
CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 VAR BYTE Fx[noparse][[/noparse]60] obj comm :"FullDuplexSerialPlus" Pub Transmit |go, bpmstep comm.Start(14, 15, 0, 115200) 'Connect to the other propeller bpmstep:=123 Repeat go := 0 Comm.tx(213) 'transmit sync number waitcnt(500 + cnt) 'wait for other prop to catch up Comm.tx(BpmStep) ' transmit BpmStep position waitcnt(500 + cnt) If Comm.rxtime(1) == 214 Repeat go from 0 to 1000 ' get range of memory Fx[noparse][[/noparse]go] := Comm.rxand receiver propeller
CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 VAR BYTE Fx[noparse][[/noparse]60] obj comm :"FullDuplexSerialPlus" text : "tv_text" F : "FloatMath" FS : "FloatString" Pub Receive |go, bpmstep text.start(20) 'start tv object in pins 20,21,22,23 comm.Start(15, 14, 0, 115200) 'Connect to the other propeller repeat go := 0 If Comm.rxtime(1) == 213 'this looks for start number of 213 BpmStep := Comm.rx 'then receives data and puts it in variable BpmStep text.str(FS.FloatToString(F.FFloat(Bpmstep))) waitcnt(5_000_000 + cnt) ' text.out($00) Comm.tx(214) 'this transmits for start number of 214 Repeat go from 0 to 60 'this sets the range of memory locations I want to step through Comm.tx(Fx[noparse][[/noparse]go]) 'this transmits that same memory range one byte at a time waitcnt(500 + cnt) '1ms 'this waits 1ms to let receiver catch up. waitcnt(500_000 + cnt)·
CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 VAR byte command obj PST :"Parallax Serial Terminal" PUB Main PST.StartRxTx(31, 30, 0, 57600) waitcnt(cnt+clkfreq/8) repeat waitcnt(cnt + clkfreq/2) pst.Str(String("just a string")) pst.NewLine pst.Dec(123) pst.NewLineThe Propeller receiver will need to parse the incoming string and determine the beginning and end of the data. For example, the code above transmits the following byte stream.
The "0x0D" marks the end of each data element.
6A 75 73 74 20 61 20 73 74 72 69 6E 67 = just a string
31 32 33 = 123
This is basic serial communications and ASCII.
123.456 <cr>
This is the code for the transmitter propeller
CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 VAR obj comm :"FullDuplexSerialPlus" F : "FloatMath" FS : "FloatString" Pub Transmit |go, bpmstep comm.Start(14, 15, 0, 115200) 'Connect to the other propeller Repeat Comm.tx(214) Repeat go from 0 to 24 'this sets the range of memory locations I want to step through Comm.tx(Fx[noparse][[/noparse]go]) 'this transmits that same memory range one byte at a time waitcnt(500 + cnt) '1ms 'this waits 1ms to let receiver catch up. DAT FX byte "This is a line of text.",0And this for the receiver propeller with monitor
I do receive the screen but i can always display one character... Like this the code display the "T" character of the string.·If·instead of text.str(@fx) if i put text.str(@fx[noparse][[/noparse]1]) i will get the "h"
What i should do to display the whole string??????
text.str(@fx[noparse][[/noparse]go])
OBC
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Propeller Feature Projects: PropellerPowered.com
Visit the: PROPELLERPOWERED SIG forum kindly hosted by Savage Circuits.
everything is fine now for one string...When i try to send a second one only the second one shows up any ideas?
CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 VAR BYTE name1[noparse][[/noparse]25] BYTE name2[noparse][[/noparse]25] obj comm :"FullDuplexSerialPlus" Pub Transmit |go, bpmstep,sl, string1,string2 comm.Start(12, 13, 0, 115_200) 'Connect to the other propeller Repeat string1:=string("String1") string1:=string("String2") sl := STRSIZE(string1) Comm.tx(210) BYTEMOVE(@name1,string1,sl) Repeat go from 0 to 24 'this sets the range of memory locations I want to step through Comm.tx(name1[noparse][[/noparse]go]) 'this transmits that same memory range one byte at a time waitcnt(500 + cnt) '1ms 'this waits 1ms to let receiver catch up. sl := STRSIZE(string2) Comm.tx(211) BYTEMOVE(@name2,string2,sl) Repeat go from 0 to 5 'this sets the range of memory locations I want to step through Comm.tx(name2[noparse][[/noparse]go]) 'this transmits that same memory range one byte at a time waitcnt(500 + cnt) '1ms 'this waits 1ms to let receiver catch up.And this from the receiver
CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 VAR byte Fx[noparse][[/noparse]26] byte Fx1[noparse][[/noparse]26] obj comm :"FullDuplexSerialPlus" text : "tv_text" Pub Receive |go text.start(20) 'start tv object in pins 20,21,22,23 comm.Start(14, 15, 0, 115_200) 'Connect to the other propeller repeat If Comm.rxtime(1) == 210 'signal triger from the other propeller Repeat go from 0 to 22 'get range of memory 22 characters + terminating string Fx[noparse][[/noparse]go] := Comm.rx 'Set array of charactes in buffer Fx[noparse][[/noparse]25] :=$00 go:=0 If Comm.rxtime(1) == 211 'signal triger from the other propeller text.out($0D) Repeat go from 0 to 24 'get range of memory 22 characters + terminating string Fx1[noparse][[/noparse]go] := Comm.rx 'Set array of charactes in buffer Fx1[noparse][[/noparse]5] :=$00 'Terminate the string 'erase the screen 'Terminate the string text.str(@Fx) 'Print the string text.str(@Fx1) waitcnt(5_000_000 + cnt) 'pause for a bit text.out($00)Screen only shows String2.... any ideas???
·