Accessing serial port under Windows
[1/6] from: geza67:freestart:hu at: 21-Mar-2001 15:43
Hello to All REBOLers !
I am stuck with a problem accessing the serial port COM1 under Windows with REBOL/View
(I would like to send modem AT commands and receive the resulting strings) . Although
system/ports/serial lists com1 and com2 as valid, if I query with port? several possible
variations of port reference syntax (e.g. port://serial1, serial://port1, serial://com1)
I get a 'false answer.
My question is, how to reference the serial ports. ... With Unix or derivatives it would
be SOOO easy, like %dev/serX ... but unfortunately Windows lacks such virtual device
driver files.
Thank you for your kind help!
Geza Lakner MD
[2/6] from: ryanc::iesco-dms::com at: 21-Mar-2001 10:19
I am not sure what you mean? Could you how me an example of your problem?
Here is program I wrote a few months ago after getting bombarded by spam. It might help.
--Ryan
rebol [
Title: "Dial Away"
Date: 18-Dec-2000
File: %dialaway.r
Purpose: {
I strictly discourage you to use this program all weekend long
to continously dial those toll free numbers left by spammers.
The tolls are much higher during weekdays.
}
]
dial-away: does [
phone-nums: parse/all phone-numbers-text/text "^/"
quit-time: now + to-time time-to-run/text
sp: open/mode/with serial://port1/9600/none [write read string no-wait] "^M"
until [
to-call-position: random length? phone-nums
to-call: rejoin ["atdt " pick phone-nums to-call-position "^/"]
insert sp to-call
wait [30]
print copy sp
now > quit-time
]
close sp
]
view layout [
title "Dial-Away"
guide
label "Numbers:"
phone-numbers-text: area
return
label "Time to run (hh:mm): "
time-to-run: field
tab
button "Dial Away" [dial-away]
button "Cancel" [quit]
]
[3/6] from: dlhawley:home at: 21-Mar-2001 9:42
Previously, you ([geza67--freestart--hu]) wrote:
> Hello to All REBOLers !
>
> I am stuck with a problem accessing the serial port COM1 under Windows with REBOL/View
(I would like to send modem AT commands and receive the resulting strings) . Although
system/ports/serial lists com1 and com2 as valid, if I query with port? several possible
variations of port reference syntax (e.g. port://serial1, serial://port1, serial://com1)
I get a 'false answer.
>
> My question is, how to reference the serial ports. ... With Unix or derivatives it
would be SOOO easy, like %dev/serX ... but unfortunately Windows lacks such virtual device
driver files.
I haven't tried this under Windows, but you should be able to do:
open serial://port1
optionally append settings in the form: /9600/none/8/1 to portX.
You'll need the latest exp version. Also look at
system/ports/serial
and make sure that it looks something like: [ COM1 COM2 ] or
[ serX ... ] for Unix (the /dev/ prefix is striped). If you have
ports that are not in the list, just append them.
--
David L. Hawley D.L. Hawley and Associates 1.503.274.2242
Software Engineer [David--L--Hawley--computer--org]
[4/6] from: jeff:rebol at: 21-Mar-2001 10:57
Howdy, Ryan:
HAHAHAHAHA!!!
Beautiful!! A+ ! :-)
-jeff
> Here is program I wrote a few months ago after getting
> bombarded by spam. It might help.
<<quoted lines omitted: 7>>
> higher during weekdays.
> }
[ . . . ]
[5/6] from: geza67:freestart:hu at: 23-Mar-2001 17:14
Hello !
Thank you for the tip, I am getting closer and closer :-
)
Now I can open the port, issue the modem command but I can get no
reasonable result. The code is:
rebol[]
sp: open/mode/with serial://port1/9600/none [write read
string no-wait] "^M"
insert sp "ATI"
wait/all sp
print copy sp
close sp
... and the output is "ATI", not the modem answer
string ! Why echoes and returns the port ONLY the same
command I issued ?
Thankx !
> I am not sure what you mean? Could you how me an example of your
> problem? Here is program I wrote a few months ago after getting
<<quoted lines omitted: 20>>
> ]
> ......
=========================================================
Geza Lakner M.D., B.C.
internist, clinical pharmacologist
[Geza--Lakner--helka--iif--hu]
[h13164lak--ella--hu]
[6/6] from: arolls:bigpond:au at: 24-Mar-2001 13:35
I have little port experience but I thought
maybe you need to open in direct mode, or
update after inserting.
Just suggestions.
Anton.
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted