| program ACA_Stop;
|
|
| uses
|
| Forms,
|
| SDIMain in 'SDIMain.pas' ,
|
| ABOUT in 'ABOUT.PAS' ,
|
| V24 in 'V24.pas',
|
| RSCOMdec in 'RSCOMdec.pas',
|
| Comwahl in 'Comwahl.pas' ,
|
| Daten in 'Daten.pas' ;
|
|
| {$R *.RES}
|
|
| begin
|
| Application.Initialize;
|
| Application.Title := 'ACA_Stop';
|
| Application.CreateForm(TSDIAppForm, SDIAppForm);
|
| Application.CreateForm(TAboutBox, AboutBox);
|
| Application.CreateForm(TForm1, Form1);
|
| Application.CreateForm(TForm2, Form2);
|
| Application.Run;
|
| end.
|
|
| unit Comwahl;
|
|
| interface
|
|
| uses
|
| Windows, Messages, SysUtils, Variants, Classes, Graphics,
|
| Controls, Forms, Dialogs, StdCtrls, ExtCtrls, V24, DateUtils;
|
|
| type
|
| TForm1 = class(TForm)
|
| RadioGroup1: TRadioGroup;
|
| RadioButton2: TRadioButton;
|
| RadioButton1: TRadioButton;
|
| Button1: TButton;
|
| procedure Button1Click(Sender: TObject);
|
| procedure RadioButton2Click(Sender: TObject);
|
| procedure RadioButton1Click(Sender: TObject);
|
| private
|
|
|
| public
|
|
|
| end;
|
|
| const
|
| baudrate = '9600';
|
| paritaet = 'E';
|
| datenbit = '8';
|
| stopbit = '1';
|
|
| var
|
| Form1: TForm1;
|
| comparameter: string;
|
| abbruch: integer;
|
| ACATime: TDateTime;
|
| acatag: integer;
|
| acamonat: integer;
|
| acajahr: integer;
|
| acastunde: integer;
|
| acaminute: integer;
|
| acasekunde: integer;
|
| timediff: TDateTime;
|
|
| implementation
|
|
| {$R *.dfm}
|
|
| procedure TForm1.RadioButton2Click(Sender: TObject);
|
| begin
|
| abbruch:=0;
|
| comparameter:='COM2: baud='+baudrate+' data='+datenbit+
|
| ' parity='+paritaet+' stop='+stopbit;
|
| abbruch:= v24open(comparameter);
|
| if abbruch = 0 then
|
| Button1.Caption := 'Beenden'
|
| else
|
| Button1.Caption := 'Weiter';
|
| end;
|
|
| procedure TForm1.RadioButton1Click(Sender: TObject);
|
| begin
|
| abbruch:=0;
|
| comparameter:='COM1: baud='+baudrate+' data='+datenbit+
|
| ' parity='+paritaet+' stop='+stopbit;
|
| abbruch:= v24open(comparameter);
|
| if abbruch = 0 then
|
| Button1.Caption := 'Beenden'
|
| else
|
| Button1.Caption := 'Weiter';
|
| end;
|
|
| procedure TForm1.Button1Click(Sender: TObject);
|
| begin
|
| if abbruch = 0 then
|
| Application.Terminate
|
| else
|
| begin
|
| sendestring:='X9N00U';
|
| v24senden(sendestring);
|
| repeat
|
| InString := v24lesen;
|
| until (length(instring) = 27) and (copy(instring,1,9) = 'X027UEADY');
|
| val(copy(instring,10,2),acatag,fehler);
|
| val(copy(instring,13,2),acamonat,fehler);
|
| val(copy(instring,16,2),acajahr,fehler);
|
| acajahr :=acajahr+2000;
|
| val(copy(instring,20,2),acastunde,fehler);
|
| val(copy(instring,23,2),acaminute,fehler);
|
| val(copy(instring,26,2),acasekunde,fehler);
|
| ACATime := EncodeDateTime(acajahr, acamonat, acatag, acastunde,
|
| acaminute, acasekunde, 0);
|
| TimeDiff := Now - acaTime;
|
| Form1.Free;
|
| end;
|
| end;
|
|
| end.
|
|
|
| unit V24;
|
|
| interface
|
|
| function v24open(comparameter: string):integer;
|
| procedure v24senden(sendestring: string);
|
| function v24lesen: string;
|
| procedure v24close;
|
| function acazustand: String;
|
|
| var
|
| sendestring: string;
|
| sendestringlaenge: integer;
|
| InString: String;
|
| instringlaenge: integer;
|
| fehler: integer;
|
| v24lesezeichen: Char;
|
|
| implementation
|
|
| uses RSCOMdec, Dialogs, SysUtils;
|
|
| function v24open(comparameter: string):integer;
|
| begin
|
| fehler := OPENCOM(pchar(comparameter));
|
| if fehler = 0 then
|
| showmessage('Schnittstelle nicht verfügbar!');
|
| v24open:=fehler;
|
| end;
|
|
| procedure v24close;
|
| begin
|
| CLOSECOM();
|
| end;
|
|
| procedure v24senden(sendestring: string);
|
| var i: integer;
|
| begin
|
| sendestringlaenge:=length(sendestring);
|
| for i := 1 to sendestringlaenge do
|
| begin
|
| SENDBYTE(ord(sendestring[i]));
|
| end;
|
| end;
|
|
| function v24lesen: string;
|
| var v24lesestring:string;
|
| begin
|
| repeat
|
| v24lesezeichen := chr(READBYTE);
|
| until v24lesezeichen = 'X';
|
| repeat
|
| v24lesestring := v24lesestring+v24lesezeichen;
|
| v24lesezeichen := chr(READBYTE);
|
| until IntToHex(ord(v24lesezeichen),2) = 'FF';
|
| result:= v24lesestring;
|
| end;
|
|
| function acazustand: String;
|
| begin
|
| sendestring:='X9N00Z';
|
| v24senden(sendestring);
|
| InString := v24lesen;
|
| val(copy(instring,2,3),instringlaenge,fehler);
|
| acazustand:=copy(instring,1,instringlaenge);
|
| end;
|
|
| end.
|
|
|
| unit SDIMain;
|
|
| interface
|
|
| uses Windows, Classes, Graphics, Forms, Controls, Menus,
|
| Dialogs, StdCtrls, Buttons, ExtCtrls, ComCtrls, ImgList,
|
| StdActns, ActnList, ToolWin, V24, RSCOMdec, LMDControl,
|
| LMDBaseControl, LMDBaseGraphicControl, LMDGraphicControl,
|
| LMDClock, Comwahl, SysUtils, LMDCustomButton, LMDButton;
|
|
| type
|
| TSDIAppForm = class(TForm)
|
| ToolBar1: TToolBar;
|
| ToolButton9: TToolButton;
|
| ToolButton1: TToolButton;
|
| ToolButton2: TToolButton;
|
| ToolButton3: TToolButton;
|
| ToolButton4: TToolButton;
|
| ToolButton5: TToolButton;
|
| ToolButton6: TToolButton;
|
| StatusBar: TStatusBar;
|
| ButtonMess: TButton;
|
| LabelBefehl: TLabel;
|
| ButtonKalib: TButton;
|
| ButtonKalibMess: TButton;
|
| ButtonSpuel: TButton;
|
| ButtonEntlueft: TButton;
|
| ButtonZustand: TButton;
|
| MainMenu1: TMainMenu;
|
| File1: TMenuItem;
|
| FileNewItem: TMenuItem;
|
| FileOpenItem: TMenuItem;
|
| FileSaveItem: TMenuItem;
|
| FileSaveAsItem: TMenuItem;
|
| N1: TMenuItem;
|
| FileExitItem: TMenuItem;
|
| Edit1: TMenuItem;
|
| CutItem: TMenuItem;
|
| CopyItem: TMenuItem;
|
| PasteItem: TMenuItem;
|
| Help1: TMenuItem;
|
| HelpAboutItem: TMenuItem;
|
| ActionList1: TActionList;
|
| FileNew1: TAction;
|
| FileOpen1: TAction;
|
| FileSave1: TAction;
|
| FileSaveAs1: TAction;
|
| FileExit1: TAction;
|
| EditCut1: TEditCut;
|
| EditCopy1: TEditCopy;
|
| EditPaste1: TEditPaste;
|
| HelpAbout1: TAction;
|
| ImageList1: TImageList;
|
| OpenDialog: TOpenDialog;
|
| SaveDialog: TSaveDialog;
|
| LabelZustand: TLabel;
|
| LabelZeitPC: TLabel;
|
| LabelZeitACA: TLabel;
|
| Timer1: TTimer;
|
| ButtonFastlynx: TButton;
|
| ButtonDaten: TButton;
|
| procedure ButtonDatenClick(Sender: TObject);
|
| procedure Timer1Timer(Sender: TObject);
|
| procedure ButtonFastlynxClick(Sender: TObject);
|
| procedure ButtonEntlueftClick(Sender: TObject);
|
| procedure ButtonKalibMessClick(Sender: TObject);
|
| procedure ButtonKalibClick(Sender: TObject);
|
| procedure ButtonMessClick(Sender: TObject);
|
| procedure ButtonZustandClick(Sender: TObject);
|
| procedure FormDestroy(Sender: TObject);
|
| procedure ButtonSpuelClick(Sender: TObject);
|
| procedure FileNew1Execute(Sender: TObject);
|
| procedure FileOpen1Execute(Sender: TObject);
|
| procedure FileSave1Execute(Sender: TObject);
|
| procedure FileExit1Execute(Sender: TObject);
|
| procedure HelpAbout1Execute(Sender: TObject);
|
| private
|
|
|
| public
|
|
|
| end;
|
|
| var
|
| SDIAppForm: TSDIAppForm;
|
| sendestring: string;
|
| pcjahr: string;
|
| pcmonat: string;
|
| pctag: string;
|
| pcstunde: string;
|
| pcminute: string;
|
| pcsekunde: string;
|
| TimePC: string;
|
| DatePC: string;
|
| timeaca: string;
|
| dateaca: string;
|
|
| implementation
|
|
| uses about, Daten;
|
|
| {$R *.dfm}
|
|
| procedure TSDIAppForm.FileNew1Execute(Sender: TObject);
|
| begin
|
|
|
| end;
|
|
| procedure TSDIAppForm.FileOpen1Execute(Sender: TObject);
|
| begin
|
| OpenDialog.Execute;
|
| end;
|
|
| procedure TSDIAppForm.FileSave1Execute(Sender: TObject);
|
| begin
|
| SaveDialog.Execute;
|
| end;
|
|
| procedure TSDIAppForm.FileExit1Execute(Sender: TObject);
|
| begin
|
| Close;
|
| end;
|
|
| procedure TSDIAppForm.HelpAbout1Execute(Sender: TObject);
|
| begin
|
| AboutBox.ShowModal;
|
| end;
|
|
| procedure TSDIAppForm.FormDestroy(Sender: TObject);
|
| begin
|
| CLOSECOM();
|
| end;
|
|
| procedure TSDIAppForm.ButtonZustandClick(Sender: TObject);
|
| begin
|
| labelZustand.Caption:=acazustand;
|
| end;
|
|
| procedure TSDIAppForm.ButtonMessClick(Sender: TObject);
|
| begin
|
| sendestring:='X9N00A';
|
| v24senden(sendestring);
|
| labelZustand.Caption:=acazustand;
|
| end;
|
|
| procedure TSDIAppForm.ButtonKalibClick(Sender: TObject);
|
| procedure TSDIAppForm.ButtonKalibMessClick(Sender: TObject);
|
| procedure TSDIAppForm.ButtonSpuelClick(Sender: TObject);
|
| procedure TSDIAppForm.ButtonEntlueftClick(Sender: TObject);
|
| procedure TSDIAppForm.ButtonFastlynxClick(Sender: TObject);
|
| begin
|
| sendestring:='X9N00T';
|
| v24senden(sendestring);
|
| CLOSECOM();
|
| labelZustand.Caption:='FastLynx';
|
| MessageDlg('FastLynx-Slavemodus auf Messgerät gestartet.'+#10#13+
|
| 'Nach der Dateiübertragung den Slavemodus über'+#10#13+
|
| 'FastLynx beenden, und dann auf "OK" klicken.',
|
| mtInformation,[mbOK],0);
|
| v24open(comparameter);
|
| labelZustand.Caption:=acazustand;
|
| end;
|
|
| procedure TSDIAppForm.Timer1Timer(Sender: TObject);
|
| begin
|
| TimePC := TimeToStr(Now);
|
| DatePC := DateToStr(Now);
|
| labelZeitpc.Caption := 'Zeit PC'+#10#13+TimePC+#10#13+DatePC;
|
| timeACA := TimeToStr(now-Timediff);
|
| dateaca := Datetostr(now-timediff);
|
| labelZeitACA.Caption := 'Zeit ACA'+#10#13+timeaca+#10#13+dateaca;
|
| end;
|
|
| end. |