How do you print from 2 objects?
Dave Hein
Posts: 6,347
I have two objects -- test1.spin and test2.spin.· I want to call the FullDuplexSerial str method from each object.· The two files are shown below.· The print from the top object is displayed, but the print from the second object does not come out.· How do I get this to work?
Dave
'=======================================
' test1.spin
CON
· _clkmode = xtal1 + pll16x
· _xinfreq = 5_000_000
OBJ
· fds : "FullDuplexSerial"
· test2 : "test2"
PUB main
· fds.start(31, 30, 0, 57600)
· fds.rx
· fds.str(string("Test1", 13))
· test2.test2
'=======================================
' test2.spin
OBJ
· fds : "FullDuplexSerial"
PUB test2
· fds.str(string("Test 2", 13))
·
Dave
'=======================================
' test1.spin
CON
· _clkmode = xtal1 + pll16x
· _xinfreq = 5_000_000
OBJ
· fds : "FullDuplexSerial"
· test2 : "test2"
PUB main
· fds.start(31, 30, 0, 57600)
· fds.rx
· fds.str(string("Test1", 13))
· test2.test2
'=======================================
' test2.spin
OBJ
· fds : "FullDuplexSerial"
PUB test2
· fds.str(string("Test 2", 13))
·
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't click on this.....
Use the Propeller icon!!
Edit: I'm guessing that the problem is that FDS declares it's variable in a VAR section, and the two objects don't share the same variable space. I'll try a modified version of FDS with the variables in a DAT section to see if that fixes the problem.
Post Edited (Dave Hein) : 3/20/2010 3:42:05 AM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Short answers?
Not available since you deserve more information than you requested.
May the road rise to meet you; may the sun shine on your back.
May you create something useful, instead of just another hack.
The Serial Mirror looks good.· I'll probably extend it so that the buffer sizes can be defined at run time and maybe add additional instances, which can be accessed by a handle.
Dave
if you call methods of FDS from two different cogs you have to take care that the calls do not cross each other
this would mix up the buffercontent and you just send a mixery of bytes
best regards
Stefan
Dave