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

[REBOL] Help with serial port

From: parki:whatevernot at: 30-Aug-2003 10:27

I am trying to control my X.10 devices on my Mac OS X box from Rebol (which would be cool to the max :-). I am also a relative Rebol newbie, but loving the experience - very fun. Anyways, I know the /dev/tty port that I am interested in (I have determined that this works fine with a Mac OS X app called HomeRun). This is USA19QI14P1.1. Note that I am using a USB->serial port adaptor, but I know this all works (as I can turn lights on and off with HomeRun). Now, when I look in /dev, there are actually two references to USA19QI14P1.1: /dev/tty.USA19QI14P1.1 /dev/cu.USA19QI14P1.1 My understanding is thatthe /dev/tty.* port is the one to use (and that the /dev/cu.* ports are outdated). So, I try:
>> system/ports/serial: [tty.USA19QI14P1.1]
== [tty.USA19QI14P1.1]
>> p: open serial://port1/4800/8/none/1
This hangs - it never returns from the open command. So, I try:
>> system/ports/serial: [cu.USA19QI14P1.1]
== [cu.USA19QI14P1.1]
>> p: open serial://port1/4800/8/none/1
This works - I get a return value for p. I know that I need to set the X.10 protocol to no handshaking, so: p/rts-cts: false Now, the protocol for X.10 is pretty simple - I want to send down two bytes 0x06 and 0x61, and the device should respond with a checksum. I am a little unsure how to send down exactly two bytes (with no line feed or other bytes). So I try (where 0x06 = #"^F" and 0x61 = #"a"): insert p [ #"^F" #"a" ] When I send these, I can see a flicker on the USD->serial adaptor LED, so something is definitely happening. Once these bytes are sent, I expect to get a checksum byte back from the device, so I try: d: copy p But this hangs. I am completely stumped - everything seems to be kinda working, but I cannot get any data back from the X.10 device. Any help would be appreciated. parki...