Question about Dolphin Smalltalk accessing Serial Port

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Question about Dolphin Smalltalk accessing Serial Port

Scott D
I have the following Qbasic program statement that I am trying to move
the behavior to Dolphin Smalltalk and have downloaded Ian's SerialIO
goodie and have been trying to setup my serial port to be similar to
the following statement in Qbasic:

        OPEN "COM1,9600,N,8,1,BIN,CD0,CS0,DS0,OP0,RS FOR RANDOM AS #1 LEN =
4096

I have found the following in a Google Search (not sure of reliability
of source) related to the parameters from above.

        ASC Opens the device in ASCII mode.
        BIN Opens the device in binary mode.
        CD[m] Sets the timeout period (in milliseconds) on the Data Carrier
Detect (DCD) line.
        CS[m] Sets the timeout period (in milliseconds) on the Clear to Send
(CTS) line.
        DS[m] Sets the timeout period (in milliseconds) on the Data Set Ready
(DS) line.
        LF Sends a line-feed character after a carriage return.
        OP[m] Specifies how long (in milliseconds) OPEN COM waits for all
communications lines to become open.
        RB[n] Sets the size (in bytes) of the receive buffer.
        RS Suppresses detection of Request to Send (RTS).
        TB[n] Sets the size (in bytes) of the transmit buffer.

I believe that
        BIN = DCB new fBinary.
        RS=DCB new fRtsControl: 0.

My problem is where do I make the settings for CD0, CS0, DS0 and OP0.
I was wondering if you could provide any insight for me.  Is Ian's
SerialIO class going to work for me or should I try another approach
(example: use some type of KernelLibrary calls that map to the same
Qbasic calls).

Thanks for any help you can provide,
Scott D.


Reply | Threaded
Open this post in threaded view
|

Re: Question about Dolphin Smalltalk accessing Serial Port

Ian Bartholomew-18
Scott,

Some disclaimers first :-)
a) It's a long time since I used any of the Serial stuff
b) Even when I was dabbling a bit more it was still a black art (which
I'm sure Bill will agree with)

> I was wondering if you could provide any insight for me.  Is Ian's
> SerialIO class going to work for me or should I try another approach
> (example: use some type of KernelLibrary calls that map to the same
> Qbasic calls).

My SerialIO package is just intended for _simple_ serial comms, talking
to a Modem for example.  I have got another package called
SerialCommunications which gets a lot more involved in the inner
workings of the Windows serial interface but is more difficult to use.
It's also a bit out of date (Dolphin2 IIRC) but I've just loaded it in
to Dolphin5 and, with one little tweak, it appears to work.

I don't think you will find api calls to correspond to all of the Qbasic
calls.  I would guess, not having ever used Qbasic, that it just
provides a wrapper around the Windows interface in the same way that my
Dolphin packages do.

> ASC Opens the device in ASCII mode.
> BIN Opens the device in binary mode.
[]
> BIN = DCB new fBinary.

That just does something to the Qbasic interface but means nothing to
the serial port (everything is binary).  The Win32 DCB documentation
tells you to set fBinary to true as false will not do anything.

> CD[m] Sets the timeout period (in milliseconds) on the Data Carrier
> Detect (DCD) line.
> CS[m] Sets the timeout period (in milliseconds) on the Clear to Send
> (CTS) line.
> DS[m] Sets the timeout period (in milliseconds) on the Data Set Ready
> (DS) line.

I can't find any api documentation on these so I would think these are a
Qbasic additions.  It looks like they just provides timeouts for some
operations i.e. you set DTR low and the DSR line should respond in DS[m]
milliseconds or else an error will be raised.  0, your required
settings, probably turns it off?.

> LF Sends a line-feed character after a carriage return.

That's definitely a Qbasic setting.  The serial port doesn't care.

> OP[m] Specifies how long (in milliseconds) OPEN COM waits for all
> communications lines to become open.

Again Qbasic.  Probably sets the timeout for detecting whether the
serial port is actually connected to anything and that the other end is
awake.

> RB[n] Sets the size (in bytes) of the receive buffer.
> TB[n] Sets the size (in bytes) of the transmit buffer.

That one I can do :-)  There's an api call called SetupComm that sets
both the internal tx and rx buffer sizes.

> RS Suppresses detection of Request to Send (RTS).
[]
> RS=DCB new fRtsControl: 0.

Yes.

> Thanks for any help you can provide,

If you could explain what you want to achieve with the serial comms (by
mail if you prefer) then it will be easier to tell you how easy or
difficult it should be to do it in Dolphin.  NB: If you are happy
creating a package to solve a specific problem then that will be a lot
easier that trying to provide a "General Purpose" package that wraps
around the Windows serial interface.

--
Ian

Use the Reply-To address to contact me.
Mail sent to the From address is ignored.