procedure TDXCommdlg.ApplyComm();
begin
if (MComport.Active=false) then
begin
MComport.Close;
MComport.Active:=false;
if (TypeOfCon.ItemIndex=0) then
begin
//showmessage('USB');
case Commport.ItemIndex of
1:MComport.Device:='/dev/ttyUSB0';
2:MComport.Device:='/dev/ttyUSB1';
3:MComport.Device:='/dev/ttyUSB2';
4:MComport.Device:='/dev/ttyUSB3';
5:MComport.Device:='/dev/ttyUSB4';
end;
end
else
begin
//showmessage('AMA0');
case Commport.ItemIndex of
1:MComport.Device:='/dev/ttyAMA0';
2:MComport.Device:='/dev/ttyAMA1';
3:MComport.Device:='/dev/ttyAMA2';
4:MComport.Device:='/dev/ttyAMA3';
5:MComport.Device:='/dev/ttyAMA4';
end;
end;
case BaudRate.ItemIndex of
0:MComport.BaudRate:=br___300;//tmpbaud:=300;
1:MComport.BaudRate:=br__1200;//tmpbaud:=1200;
2:MComport.BaudRate:=br__2400;//tmpbaud:=2400;
3:MComport.BaudRate:=br__4800;//tmpbaud:=4800;
4:MComport.BaudRate:=br__9600;//tmpbaud:=9600;
5:MComport.BaudRate:=br_19200;//tmpbaud:=19200;
6:MComport.BaudRate:=br_38400;//tmpbaud:=38400;
7:MComport.BaudRate:=br_57600;//tmpbaud:=57600;
8:MComport.BaudRate:=br115200;//tmpbaud:=115200;
end;
case paritygroup.ItemIndex of
0:MComport.Parity:=pEven;
1:MComport.Parity:=pNone;
end;
MComport.StopBits:=sbOne;
MComport.FlowControl:=fcNone;
MComport.DataBits:=db8bits;
MComport.RcvLineCRLF:=false;
MComport.SynSer.EnableRTSToggle(true);
try
MComPort.Open;
except on Exception do
ShowMessage('Can''t connect to '+ Inttostr(Commport.ItemIndex));
end;
end;
end;