Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

using copy with serial ports under Win2000

 [1/2] from: caw::cs::mu::oz::au at: 4-Jun-2001 13:51


I'm using a serial port under win2000 ser: serial://9600/1/odd/7 ser/timeout: 1 data: "<07D7F>" insert ser data and now I want to get back the response. If I repeatedly type first ser then I get the data back char by char. (There is no \n or other EOL delimiter that I can use for open/lines/with). I want to get the whole lot back. But if, instead of repeated "first ser" I try: print copy ser I timeout. I don't understand why. What's the right idiom for this?? Thanks very much chris

 [2/2] from: holger:rebol at: 12-Jun-2001 8:54


On Mon, Jun 04, 2001 at 01:51:40PM +1000, Chris Wright wrote:
> I'm using a serial port under win2000 > > ser: serial://9600/1/odd/7
Use ser: open/direct/no-wait serial://9600/1/odd/7
> But if, instead of repeated "first ser" I try: > > print copy ser > > I timeout. > > I don't understand why.
This is because by default 'copy waits until end-of-file before returning. Your serial port never creates an end-of-file condition, so 'copy waits indefinitely. If you add the /no-wait refinement to 'open 'copy does not block and instead returns whatever data is available. You may still have to loop and wait though, depending on how your protocol works. -- Holger Kruse [holger--rebol--com]