Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Serial communication in windows (Borland pascal ) (Frede Schmidt)

0 views
Skip to first unread message

Frede Schmidt

unread,
Oct 9, 1996, 3:00:00 AM10/9/96
to

Do anybody have experince with serial communication from a DLL in
borland pascal. I've tried to use the buildcommdcb(),setcommstate()
and opencomm() form the winprocs unit but it setcommstate just returns
errorcode -3. What does that mean? Anybody have some documentation on
the winprocs unit in borland pascal (delphi) except from the online
help. Anybody seen some exsamples?


Thank you for helping

F_Sc...@po.ia.dk
Frede Schmidt
Sønderborg
Denmark

Moebius

unread,
Oct 11, 1996, 3:00:00 AM10/11/96
to

In article <53fl24$n...@news1.tele.dk>, Frede Schmidt <F...@donfoss.dk>
writes

> Anybody seen some exsamples?
>
>
>Thank you for helping
>
>F_Sc...@po.ia.dk
>Frede Schmidt
>Sønderborg
>Denmark
>
>

Hello Frede,

If your using OpenComm then I assume that you are writing this in Delphi
1.0.

There are a number of steps to open and configure the comms ports, here
is an example 'Open' rtn for a comms module object. It should give you
an idea of what to do..


Defined in object:

- id:integer { Port Id handle }
- PortOpen:Boolean; { Indicates if port open }
- PortStatus :TCOMSTAT; { Status info structure }
- PortError :Word; { Error type code }
- DCB :TDCB; { Comms Data Control Block structure }

Rtn:

function TComms.Open(Name :String):Boolean;
{ This rtn will assign a port to the comms object, returns False if
fail. }
var
NullStr :String;
PortSettings :String;
begin { Open }
NullStr :=Name+#0;
Id:=OpenComm(@NullStr[1],255,255); { Attempt to Open port }

if (id<0) then
begin { fail }
PortOpen :=False;
PortError :=GetCommError(Id,PortStatus);
end { fail }
else
begin { ok }
FlushComm(Id,0); { Flush transmit queue }
FlushComm(Id,1); { Flush receive queue }

{ Port open so attempt to assign DCB settings }
PortSettings :=PortName+','+'9600,n,8,1';

if (BuildCommDCB(@PortSettings[1],DCB) < 0) then
begin { fail }
PortError :=GetCommError(Id,PortStatus);
end { fail }
else
begin { Set Comm State }
{ Set new comms state }
if (SetCommState(DCB)<0) then
begin { fail }
PortError :=GetCommError(Id,PortStatus);
end { fail }
else
begin { Other settings }
PortOpen :=True; { Indicate port is open }
EscapeCommFunction(Id,CLRDTR); { Clear DTR Line }
EscapeCommFunction(Id,CLRRTS); { Clear RTS Line }
SetCommEventMask(id,EV_TXEMPTY) { Enable all events }
end { Other settings }
end { Set Comm State }

end; { ok }

Open :=PortOpen; { Return Status }

end; { Open }

Hope this helps.
--
Moebius

sil...@onramp.net

unread,
Oct 14, 1996, 3:00:00 AM10/14/96
to

> F...@donfoss.dk (Frede Schmidt) writes:
> Do anybody have experince with serial communication from a DLL in
> borland pascal. I've tried to use the buildcommdcb(),setcommstate()
> and opencomm() form the winprocs unit but it setcommstate just returns
> errorcode -3. What does that mean? Anybody have some documentation on
> the winprocs unit in borland pascal (delphi) except from the online
> help. Anybody seen some exsamples?

>
>
> Thank you for helping
>
> F_Sc...@po.ia.dk
> Frede Schmidt
> Sønderborg
> Denmark
>
>
>
>>>>

You should take a look at the SilverWare Windows Communications Tool Kit.

It will enable you to do what you need.

You can contact SilverWare Inc. via:

Tele: (972) 247-0131
Fax: (972) 406-9999

For on-line info:
Internet WWW is http://rampages.onramp.net/~silver


Good Luck...

Take care,

John Halovanic
SilverWare Inc.

e-mail: sil...@onramp.net
WWW: http://rampages.onramp.net/~silver

0 new messages