Arsip: kirim data ke mikro secara terus menurus

 
user image
more 16 years ago

westsumtra

dear all.. saya ada kesulitan ...tentang kirim data ke mikro secara terus menurus... mohon bantuan nya gimana cara nya setelah Button1 ditekan program delphi akan mengirimkan angka 1 ke mikro secara terus menerus ?? thx procedure TForm1.Button1Click(Sender: TObject); begin comport1.Writestr ("1"); end;
user image
more 16 years ago

DelphiExpert

gunakan loop forever, atau bisa anda gunakan timer dng set interval tertentu...

var
  Stop: Boolean; // --> global variable
begin
  Stop:= False;
  while not Stop do
  begin
    Comport1.WriteStr('1');
    Sleep(10); // kasih jeda 10 milidetik
    Application.ProcessMessages; // proses windows messages
  end;
end;
user image
more 16 years ago

albie

Button2 := STOP onClick : begin Stop := true; end; -> Nglengkapin punya Mr. DeX :)
user image
more 16 years ago

albie

Alternatif : Tambahin komponen Timer, Interval bisa diset terserah ( 1000 = tiap 1 detik) Button1Click : Timer1.enable := true; TimeronTimer : Comport.writestr('1'); Application.processMessages; Button2Click : Timer2.enable := false;
user image
more 16 years ago

westsumtra

bro thx pencerahan nya...
more ...
  • Pages:
  • 1
Share to

Random Topic

Local Business Directory, Search Engine Submission & SEO Tools FreeWebSubmission.com SonicRun.com