- 'blink a led'?

From: Hof, Philipp <"Hof,>
Date: Tue, 22 Feb 2005 11:40:49 +1300

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

The code below will blink a led in 1sec intervals on DTR or RTS:
To use the parallel port go here:
http://www.elec.canterbury.ac.nz/PublicArea/Staff/hof/p50-win/

MODULE ExampleV24Toggle;

        IMPORT Services, Print := StdLog, V24 := CommV24;

        TYPE
                Action = POINTER TO RECORD (Services.Action) END;

        VAR
                a: Action; (* Action (Task) variable *)
                conn: V24.Connection; (* Connection variable *)
                toggle: BOOLEAN;

        (* Receive *)
        PROCEDURE (a: Action) Do;
        BEGIN
                V24.SetDTR(conn, toggle);
                V24.SetRTS(conn, toggle);
                toggle := ~toggle;
                Services.DoLater(a, Services.Ticks() + 1000) (* Run DO task
in 1000ms again *)
        END Do;

        PROCEDURE Start*;
        BEGIN
                (* empty procedure to load module *)
        END Start;

BEGIN
        V24.Open("COM1:", 19200, {}, conn);
        Print.Clear(); Print.Open();
        IF conn # NIL THEN
                Print.String("Port opened!"); Print.Ln();
                IF a = NIL THEN
                        NEW(a);
                        Services.DoLater(a, Services.now); (* Callback task
to the DO action *)
                        Print.String("Do (toggle) task activated!");
                END;
        ELSE
                Print.String("Could not open port!");
        END;
        Print.Ln()
CLOSE
        (* CLOSE runs when the module gets unloaded *)
        (* via Dev -> Compile and Unload or by closing the app *)
        IF conn # NIL THEN V24.Close(conn) END;
        Print.Open(); Print.String("COM1 closed"); Print.Ln();
        Services.RemoveAction(a);
END ExampleV24Toggle.

ExampleV24Toggle.Start


-----Original Message-----
From: Frans-PieterVonck [mailto:Frans-PieterVonck{([at]})nowhere.xy
Sent: Tuesday, 22 February 2005 10:49 a.m.
To: blackbox{([at]})nowhere.xy
Subject: [BlackBox] - 'blink a led'?

Hello Blackboxers,
 
I would to like blink a led on a serial port, using Blackbox.
Is there someone who can give me some advice?
 
Thanks,
Frans-Pieter Vonck
 
 
 
 

--- BlackBox

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



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

e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1xmM1xmbW9kZXJuXGZjaGFyc2V0MCBDb3VyaWVyIE5ldzt9fQ0Ke1xj
b2xvcnRibFxyZWQwXGdyZWVuMFxibHVlMDtccmVkMFxncmVlbjBcYmx1ZTI1NTt9DQpcdWMxXHBh
cmRccGxhaW5cZGVmdGFiMzYwIFxmMFxmczIwIFRoZSBjb2RlIGJlbG93IHdpbGwgYmxpbmsgYSBs
ZWQgaW4gMXNlYyBpbnRlcnZhbHMgb24gRFRSIG9yIFJUUzpccGFyDQpUbyB1c2UgdGhlIHBhcmFs
bGVsIHBvcnQgZ28gaGVyZTpccGFyDQpodHRwOi8vd3d3LmVsZWMuY2FudGVyYnVyeS5hYy5uei9Q
dWJsaWNBcmVhL1N0YWZmL2hvZi9wNTAtd2luL1xwYXINClxwYXINCk1PRFVMRSBFeGFtcGxlVjI0
VG9nZ2xlO1xwYXINClxwYXINClx0YWIgSU1QT1JUIFNlcnZpY2VzLCBQcmludCA6PSBTdGRMb2cs
IFYyNCA6PSBDb21tVjI0O1xwYXINClxwYXINClx0YWIgVFlQRVxwYXINClx0YWIgXHRhYiBBY3Rp
b24gPSBQT0lOVEVSIFRPIFJFQ09SRCAoU2VydmljZXMuQWN0aW9uKSBFTkQ7XHBhcg0KXHBhcg0K
XHRhYiBWQVJccGFyDQpcdGFiIFx0YWIgYTogQWN0aW9uOyAoKiBBY3Rpb24gKFRhc2spIHZhcmlh
YmxlICopXHBhcg0KXHRhYiBcdGFiIGNvbm46IFYyN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plY3Q6IFtCbGFja0JveF0gLSAnYmxpbmsgYSBsZWQnP1xw
YXINClxwYXINCkhlbGxvIEJsYWNrYm94ZXJzLFxwYXINCiBccGFyDQpJIHdvdWxkIHRvIGxpa2Ug
YmxpbmsgYSBsZWQgb24gYSBzZXJpYWwgcG9ydCwgdXNpbmcgQmxhY2tib3guXHBhcg0KSXMgdGhl
cmUgc29tZW9uZSB3aG8gY2FuIGdpdmUgbWUgc29tZSBhZHZpY2U/XHBhcg0KIFxwYXINClRoYW5r
cyxccGFyDQpGcmFucy1QaWV0ZXIgVm9uY2tccGFyDQogXHBhcg0KIFxwYXINCiBccGFyDQogXHBh
cg0KXHBhcg0KLS0tIEJsYWNrQm94XHBhcg0KLS0tIHNlbmQgc3ViamVjdCBIRUxQIG9yIFVOU1VC
U0NSSUJFIHRvIGJsYWNrYm94QG9iZXJvbi5jaFxwYXINCn19AAAvTz0=


----boundary-LibPST-iamunique-1388646894_-_---
Received on Mon Feb 21 2005 - 23:40:49 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:28:23 UTC