Problem with FullDuplexSerial - two functionally equivalent bits of code... are
Rich M
Posts: 33
Hi All:
·· I just started using the Propeller on a Rev C. Demo board.· I have a small application talking to a TTL level serial device, which works successfully with one version of Spin code.· My problem is that it doesn't work with some "better" code, which I believe should be functionally equivalent.· This is using the FullDuplexSerial object, and a copy of the Propellor tool that was downloaded yesterday.
·· The snippet of code that does work:
---
··· repeat Index from 0 to 21··································· ' Eat the echo of the last 21 characters····
······· serial.rx
---
Now, the snipped of code I think *should* work, but doesn't:
---
· repeat while serial.rxcheck > -1······ ' Eat the echos of the characters until nothing is left *** DOESN'T WORK
---
·························
·· As you can see, I just want to eliminate the hard-coding of the number of characters to read.· These two versions are in the exact same spot, with just the "alternate" version commented out.· As far as I can see, the "bad" version just looks forever, while the "good" version completes.· I have also tried using "serial.rxflush", with the same problem.
·· Any suggestions as to why this isn't working?
·· The full archive is attached. and the code I'm having problem with is in the temperature function.
Thanks!
- Rich
·· I just started using the Propeller on a Rev C. Demo board.· I have a small application talking to a TTL level serial device, which works successfully with one version of Spin code.· My problem is that it doesn't work with some "better" code, which I believe should be functionally equivalent.· This is using the FullDuplexSerial object, and a copy of the Propellor tool that was downloaded yesterday.
·· The snippet of code that does work:
---
··· repeat Index from 0 to 21··································· ' Eat the echo of the last 21 characters····
······· serial.rx
---
Now, the snipped of code I think *should* work, but doesn't:
---
· repeat while serial.rxcheck > -1······ ' Eat the echos of the characters until nothing is left *** DOESN'T WORK
---
·························
·· As you can see, I just want to eliminate the hard-coding of the number of characters to read.· These two versions are in the exact same spot, with just the "alternate" version commented out.· As far as I can see, the "bad" version just looks forever, while the "good" version completes.· I have also tried using "serial.rxflush", with the same problem.
·· Any suggestions as to why this isn't working?
·· The full archive is attached. and the code I'm having problem with is in the temperature function.
Thanks!
- Rich
Comments
I'm at work at the moment, so can't test this, but have you tried:
repeat while serial.rxcheck >= -1
I agree that it shouldn't be any different, but I seem to recall something like this in the Propeller Trick & Traps thread.
HTH.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheers,
Simon
Post Edited (simonl) : 8/7/2006 1:11:10 PM GMT
The problem, of course, is that the serial device I'm interfacing to doesn't necessarily have data ready when I'm doing the rxcheck. So, it just falls immediately through the repeat loop, instead of hanging around, waiting for characters to become available... so.... my bad.
- Rich