Discussion:
ER5: OPL32 Serial Communications - How do you set RTS, CTS?
(too old to reply)
bonzo
2004-10-21 18:59:33 UTC
Permalink
Hello there,


I've got a Psion 5mx and I'm relatively new to OPL32 but I've scanned
the net (OPL32 manual, OPL sites, EMCC PPC.PDF, Keith Walker's Home
Page (http://www.starship.freeserve.co.uk/), taxi_mania.net
(http://www.btinternet.com/~taxi_mania/serial.html)) for details about
whether setting RTS or CTS can be done from OPL. I was thinking that
it would be variation on the IOW command (from Series 3) but I can't
find any documentation to support this idea.

For this level of control of the serial port, does one need to resort
to the C++ SDK instead or a serial OPX?

Hope someone can point me in the right direction!

-bonzo3671
Martin Dehler
2004-10-23 09:48:47 UTC
Permalink
Post by bonzo
I've got a Psion 5mx and I'm relatively new to OPL32 but I've scanned
the net (OPL32 manual, OPL sites, EMCC PPC.PDF, Keith Walker's Home
Page (http://www.starship.freeserve.co.uk/), taxi_mania.net
(http://www.btinternet.com/~taxi_mania/serial.html)) for details about
whether setting RTS or CTS can be done from OPL. I was thinking that
it would be variation on the IOW command (from Series 3) but I can't
find any documentation to support this idea.
On http://www.davros.org/psion/psionics/devices the commands for the
serial device TTY: are explained. According to this document you can set
RTS and CTS. The Psionics file were original written for the Series 3, but
I would excpect that at least the serial port device functionality should
be compatible with the Series 5.

HTH Martin
--
Martin Dehler - Ludwigshafen - Pfalz - Germany
mailto:***@gmx.de
http://www.martin-dehler.de
Phil Aypee
2004-10-23 20:31:23 UTC
Permalink
Hi,

I don't particularly know about the OPL32 comms facilities but I
do know that several of the lower level functions of OPL16 were
not implemented in OPL32. This includes most of the Input/Output
(IO*) commands.

I believe that such functions can only be implemented using an
OPX if OPL is the language used. However such OPXs are probably
available.

I hope that helps.

Take care,
Phil.

"Sleep quicker,
we need the beds."

http://www.aypee2.net
Roger Muggleton
2004-10-24 00:08:42 UTC
Permalink
Post by Phil Aypee
I don't particularly know about the OPL32 comms facilities but I
do know that several of the lower level functions of OPL16 were
not implemented in OPL32. This includes most of the Input/Output
(IO*) commands.
The main IO commands still work, you can read and write to files and the
serial port using IOA, IOC, IOW etc., e.g:

IOC(-1,1,ser%,#ADDR(SerRxBuf$)+1,c%) reads c% bytes from the serial port,

Some seemingly unpublished commands still work, e.g.

IOW(-1,10,c%,#0) puts the number of bytes available into c%

Commands for opening and reading directories do not work:

REM Check dir status
IF IOOPEN(fh%, d$+"\*.*", $30)
REM It is a file
ELSE
d$(n%) = " " + d$(n%)
IOCLOSE(fh%)
ENDIF

This was useful and much quicker than any other way.

I'm sure that there is an OPX to fill in some of the gaps, but I can't find
it anywhere.

Roger.
Phil Aypee
2004-10-25 13:02:49 UTC
Permalink
Hi,

Well, Roger certainly knows better than I!

But I wasn't far out about the Serial Communications thing - it
apparently does need an OPX for us dunderheads.

Take care,
Phil.

"Sleep quicker,
we need the beds."
bonzo
2004-10-25 16:54:28 UTC
Permalink
Post by Roger Muggleton
Post by Phil Aypee
I don't particularly know about the OPL32 comms facilities but I
do know that several of the lower level functions of OPL16 were
not implemented in OPL32. This includes most of the Input/Output
(IO*) commands.
The main IO commands still work, you can read and write to files and the
IOC(-1,1,ser%,#ADDR(SerRxBuf$)+1,c%) reads c% bytes from the serial port,
Some seemingly unpublished commands still work, e.g.
IOW(-1,10,c%,#0) puts the number of bytes available into c%
REM Check dir status
IF IOOPEN(fh%, d$+"\*.*", $30)
REM It is a file
ELSE
d$(n%) = " " + d$(n%)
IOCLOSE(fh%)
ENDIF
This was useful and much quicker than any other way.
I'm sure that there is an OPX to fill in some of the gaps, but I can't find
it anywhere.
Roger.
Thanks Guys for all the help so far - greatly appreciated! Roger was
right and there is an OPX, CComms by Keith Walker. I'd mentioned this
previously but hadn't waded through the documentation!

His site is at:

Keith Walker's Home Page
http://www.starship.freeserve.co.uk/)

CComms OPX Programming Interfaces Description:
http://www.starship.freeserve.co.uk/opx/CComms/Documentation/programm.htm

CComms OPX: CommSignals Method - read serial port control lines
http://www.starship.freeserve.co.uk/opx/CComms/Documentation/comm.htm#Signals

CComms OPX: CommSetSignals Method - set serial port control line
http://www.starship.freeserve.co.uk/opx/CComms/Documentation/comm.htm#SetSignals

Signal line constants
http://www.starship.freeserve.co.uk/opx/CComms/Documentation/signal.htm

If you plan to use this OPX, you'll also need some supporting OPXs:

CDescriptor OPX
CE32Base OPX

All source and compiled code is available at:

http://www.starship.freeserve.co.uk/downloads.html

Get the MARM SIS versions for your Psion 5mx or the WINS SIS version
for the EPOC OPL SDK emulator. The CComms-test.zip (also in the Full
Release, ccomms.zip) includes a sample OPL32 test program to make sure
everything is working correctly.

A nice little demo for robot control of using this OPX and at Barry
Featherstone's page:

taxi_mania.net
(http://www.btinternet.com/~taxi_mania/serial.html))

This just happens to the type of control I was looking for!

Regards,
bonzo3671
Roger Muggleton
2004-10-25 22:55:24 UTC
Permalink
Post by bonzo
there is an OPX, CComms by Keith Walker.
It seems pretty comprehensive. I've not messed with any of this stuff for a
couple of years or so, and I fancy it was not so well developed the last
time I looked.

My Series 5 screen ribbon has totally failed, and my 5mx has a nice crack
across the digitiser from when I dropped it face down in Florence (Italy).
But I still use it mainly for writing text. Maybe a Nokia 9300 might be the
nearest to a modern equivalent, provided the open-source OPL will run on it.

PC OPL would be nice. I play with Delphi and javascript, but an OPL
implementation would be just right for quick and easy apps with a simple
graphic interface. Ah well.

Roger.
Reg
2004-10-25 23:23:22 UTC
Permalink
[in EPOC]
REM Check dir status
IF IOOPEN(fh%, d$+"\*.*", $30)
REM It is a file
ELSE
d$(n%) = " " + d$(n%)
IOCLOSE(fh%)
ENDIF
This was useful and much quicker than any other way.
I'm sure that there is an OPX to fill in some of the gaps, but I can't find
it anywhere.
Roger have a look at AldurFile.OPX as used in the latest FastBackup.
It's a lot faster.

http://www.freepoc.org/download/FastBackup_041009.zip

Source code is also included in the .zip file.

Reg
Graham Holden
2004-10-27 09:53:11 UTC
Permalink
Post by Roger Muggleton
[in EPOC]
REM Check dir status
IF IOOPEN(fh%, d$+"\*.*", $30)
REM It is a file
ELSE
d$(n%) = " " + d$(n%)
IOCLOSE(fh%)
ENDIF
This was useful and much quicker than any other way.
I'm sure that there is an OPX to fill in some of the gaps, but I
can't find
it anywhere.
Roger have a look at AldurFile.OPX as used in the latest FastBackup.
It's a lot faster.
Thanks.
Post by Roger Muggleton
http://www.freepoc.org/download/FastBackup_041009.zip
Source code is also included in the .zip file.
Reg
Or direct from www.g-holden.dircon.co.uk/epoc

</self-plug>

Regards,
Graham Holden (g-holden AT dircon DOT co DOT uk)
--
There are 10 types of people in the world;
those that understand binary and those that don't.
Roger Muggleton
2004-10-27 17:45:00 UTC
Permalink
Post by Reg
Roger have a look at AldurFile.OPX as used in the latest FastBackup.
It's a lot faster.
http://www.freepoc.org/download/FastBackup_041009.zip
Source code is also included in the .zip file.
Ah, but OPX files don't work with SIBO/EPOC16 or whatever it's called these
days. The IOOPEN(.....$30) call works only on the Series 3 type machines. I
had been using it to test for files/directories, and this IO call had not
been implemented in EPOC32. Instead I have used SIIsDirectory&:() from
SystInfo.opx.

If you want to scan all the files on a EPOC device you don't have to use
recursion, you can use a local stack instead. This works by saving directory
paths onto the stack while it scans the files. When all the files are read,
it then changes to the directory at the top of the stack and scans that.
This is much faster than recursion, but you need to specify the stack size,
which is not easy to predict. I've included the code below. I'm not the
author, it appeared here a few years ago and I don't know who to credit it
to. It will probably get a bit mangled by my news client!

Roger

INCLUDE "systinfo.oxh"

PROC recursestack:
LOCAL stack$(50,255) REM local stack size is 50 elements
LOCAL n% REM stack position counter
LOCAL h% REM max stack index
LOCAL name$(255) REM name of file/folder
stack$(1)="C:" REM set start disk:\folder
AT 1,2
REM the work starts here!

n%=1
WHILE n%>0
name$=DIR$(stack$(n%)+"\*")
n%=n%-1
WHILE name$<>""
IF SIIsDirectory&:(name$)
n%=n%+1
stack$(n%)=name$
IF h%<n% :h%=n% :ENDIF REM stack statistic
REM do directory operation here
ELSE
fi%=fi%+1 REM file statistic
REM do file operation here
ENDIF
name$=DIR$("")
ENDWH
ENDWH
PRINT "Max stack elements used:",h%
GET
ENDP

Loading...