- blinking a led: Delphi PCHAR->CP array?

From: [at]} <Wojtek>
Date: Mon, 29 May 2006 17:36:08 -0400 (EDT)

----boundary-LibPST-iamunique-1600558245_-_-
Content-type: text/plain

Frans:

if you want to use the PORT.DLL for serial communication,
the you may find some examples of DLL interfacing at the end
of my PowerPoint prezentation. Be patient with the introductory info,
scroll till almost the very end where the DLL examples are.

http://web1.pas.rochester.edu/~skulski/Presentations/BB_Class.ppt

However, a simpler way to achieve your goal will be to use CommV24
which is a standard built-in interface to the COM ports. It works
very well.

Read documentation Comm/Docu/V24 to get started. You can find it
if you type the word "serial" into the Search field of Help->Content.

Hope this helps,

W.

On Mon, 29 May 2006, Douglas G. Danforth wrote:

> Frans,
> I find that in Delphi
>
> type : Char = #0..#255;
>
> which is 8 bits. A CHAR in Component Pascal is 16 bits.
> A SHORTCHAR is 8 bits. Try using SHORTCHAR.
>
> -Doug Danforth
>
>
> frans-pietervonck{([at]})nowhere.xy
> > Hello Blackboxers,
> >
> > I want to blink a led using using Kainka's "PC Interfaces under Windows".
> > The book comes with a dll - PORT.DLL - which enables communication
> > with the serial ports under XP.
> > With Delphi the led blinks. In BlackBox, I can't get it light. I
> > suspect that my way of translating the delphi PCHAR-type
> > into an array is not correct. Can I use an array as an null terminated
> > string? Anyone some advice?
> >
> > In delphi, opening the com-port is done as follows.
> >
> > Function OPENCOM(S:PCHAR):Integer;stdcall; external PORT.DLL;
> >
> > for example: OpenCom (Pchar('COM1:9600,N,8,1'));
> > OpemCom returns a 1 when connected, 0 when failed.
> >
> > Following my the translation of the function to component pascal
> >
> > INTERFACE:
> > constr* = ARRAY 18 OF CHAR;
> > PROCEDURE opencom* ["OPENCOM"]
> > (Constr:constr) : INTEGER;
> >
> > TESTFUNCTION:
> > open := PortDLL.opencom("COM1:9600,N,8,1");
> >
> >
> >
> > The two modules I've used.
> > -----------------------
> > INTERFACE
> > ----------------------
> > MODULE PortDLL ["PORT.DLL"];
> > IMPORT SYSTEM;
> > TYPE
> >
> > constr* = ARRAY 18 OF CHAR;
> >
> > PROCEDURE opencom* ["OPENCOM"]
> > (Constr:constr) : INTEGER;
> >
> > END PortDLL.
> >
> > ----------------------------------
> > TESTMODULE
> > ----------------------------------
> > MODULE TestPort;
> >
> > IMPORT PortDLL, StdLog;
> > VAR open: INTEGER;
> > PROCEDURE Do*;
> > BEGIN
> > open := 3;
> > open := PortDLL.opencom("COM1:9600,N,8,1");
> > IF open = 1 THEN
> > StdLog.String("Opening COM1 successful. "); StdLog.Ln
> > END;
> > IF open = 0 THEN
> > StdLog.String("Opening COM1 failed."); StdLog.Ln
> > END;
> > END Do;
> >
> > END TestPort.
> > -----------------------------------
> >
> > --- BlackBox
> > --- send subject HELP or UNSUBSCRIBE to blackbox{([at]})nowhere.xy
> >
> >
>
> --- BlackBox
> --- send subject HELP or UNSUBSCRIBE to blackbox{([at]})nowhere.xy
>
>

--- BlackBox
--- send subject HELP or UNSUBSCRIBE to blackbox{([at]})nowhere.xy



----boundary-LibPST-iamunique-1600558245_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"

e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1xmM1xmbW9kZXJuXGZjaGFyc2V0MCBDb3VyaWVyIE5ldzt9fQ0Ke1xj
b2xvcnRibFxyZWQwXGdyZWVuMFxibHVlMDtccmVkMFxncmVlbjBcYmx1ZTI1NTt9DQpcdWMxXHBh
cmRccGxhaW5cZGVmdGFiMzYwIFxmMFxmczIwIEZyYW5zOlxwYXINClxwYXINCmlmIHlvdSB3YW50
IHRvIHVzZSB0aGUgUE9SVC5ETEwgZm9yIHNlcmlhbCBjb21tdW5pY2F0aW9uLFxwYXINCnRoZSB5
b3Ug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5ccGFyDQo+ID4gLS0tIEJsYWNrQm94XHBh
cg0KPiA+IC0tLSBzZW5kIHN1YmplY3QgSEVMUCBvciBVTlNVQlNDUklCRSB0byBibGFja2JveEBv
YmVyb24uY2hccGFyDQo+ID5ccGFyDQo+ID5ccGFyDQo+XHBhcg0KPiAtLS0gQmxhY2tCb3hccGFy
DQo+IC0tLSBzZW5kIHN1YmplY3QgSEVMUCBvciBVTlNVQlNDUklCRSB0byBibGFja2JveEBvYmVy
b24uY2hccGFyDQo+XHBhcg0KPlxwYXINClxwYXINCi0tLSBCbGFja0JveFxwYXINCi0tLSBzZW5k
IHN1YmplY3QgSEVMUCBvciBVTlNVQlNDUklCRSB0byBibGFja2JveEBvYmVyb24uY2hccGFyDQp9
fQByaWFs


----boundary-LibPST-iamunique-1600558245_-_---
Received on Mon May 29 2006 - 23:36:08 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:27:57 UTC