- blinking a led: Delphi PCHAR->CP array?
----boundary-LibPST-iamunique-1209526756_-_-
Content-type: text/plain
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
----boundary-LibPST-iamunique-1209526756_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7f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ydDtccGFyDQpccGFyDQogICAgSU1QT1JU
IFBvcnRETEwsIFN0ZExvZztccGFyDQogICAgVkFSIG9wZW46IElOVEVHRVI7XHBhcg0KICAgXHBh
cg0KICAgIFBST0NFRFVSRSBEbyo7XHBhcg0KICAgIEJFR0lOXHBhcg0KICAgICAgICBvcGVuIDo9
IDM7XHBhcg0KICAgICAgICBvcGVuIDo9IFBvcnRETEwub3BlbmNvbSgiQ09NMTo5NjAwLE4sOCwx
Iik7XHBhcg0KICAgICAgICBJRiBvcGVuID0gMSBUSEVOXHBhcg0KICAgICAgICAgICAgU3RkTG9n
LlN0cmluZygiT3BlbmluZyBDT00xIHN1Y2Nlc3NmdWwuICIpOyBTdGRMb2cuTG5ccGFyDQogICAg
ICAgIEVORDtccGFyDQogICAgICAgIElGIG9wZW4gPSAwIFRIRU5ccGFyDQogICAgICAgICAgICBT
dGRMb2cuU3RyaW5nKCJPcGVuaW5nIENPTTEgZmFpbGVkLiIpOyBTdGRMb2cuTG5ccGFyDQogICAg
ICAgIEVORDtccGFyDQogICAgRU5EIERvO1xwYXINClxwYXINCkVORCBUZXN0UG9ydC5ccGFyDQot
LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLVxwYXINClxwYXINCi0tLSBCbGFja0Jv
eFxwYXINCi0tLSBzZW5kIHN1YmplY3QgSEVMUCBvciBVTlNVQlNDUklCRSB0byBibGFja2JveEBv
YmVyb24uY2h9fQB0ef8u4B4UC4Af
----boundary-LibPST-iamunique-1209526756_-_---
Received on Sat May 27 2006 - 00:21:06 UTC
This archive was generated by hypermail 2.3.0
: Thu Sep 26 2013 - 06:27:57 UTC