m_gpscomm.PortNum := m_CommPort;
m_gpscomm.DeviceName := 'COM' + inttostr(m_CommPort);
i := 6;
case m_BaudRate of
110: i :=Integer(br110);
300: i :=Integer(br300);
600: i :=Integer(br600);
1200: i :=Integer(br1200);
2400: i :=Integer(br2400);
4800: i :=Integer(br4800);
9600: i :=Integer(br9600);
14400: i :=Integer(br14400);
19200: i :=Integer(br19200);
38400: i :=Integer(br38400);
56000: i :=Integer(br56000);
57600: i :=Integer(br57600);
115200: i :=Integer(br115200);
128000: i :=Integer(br128000);
256000: i :=Integer(br256000);
end;
m_gpscomm.BaudRate := TvaBaudRate(i);
if m_GPSType in [1, 2] then
begin
try
m_gpscomm.Open;
except
Application.MessageBox('Not opened serial port' , 'Error Serial port', 0);
end;
답변이라기는 좀 멋하지만 경험상 말씀드립니다.
시리얼 컴포넌트에 따라서 값이 변하는 경우가 생기더군요.
멀쩡하게 신호가 들어오다가 컴에 따라서 잘 안들어오기도 하더군요.
저는 컴포넌트의 종류를 바꾸어가면서 제대로 된 값이 들어오는 넘을 골라서 썼습니다. 컴포넌트를 바꾸어 보십시오.
설정을 어떻게 했는지 대해서 아무런 정보가 없네요
님이 쓰신 글을 보면 너무 빈약해서 어떻게 답변드려야 할지
막막해요.
일단 값이 들어온다면 첫째 의심가는것은 속도설정이 안되었을경우이네요
확인해보세요
참고로 GPS일경우 표준포맷이라면 GPS전용 컴퍼넌트도 있습니다.
그리고 제것의 설정 이고요
Delphi 6.0, Windows 2000; Varian Async32;
/////////////////////////////////////////////////
m_gpscomm := TVaComm.Create(Application);
m_gpscomm.Databits := TvaDataBits(db8);
m_gpscomm.Parity := TvaParity(paNone);
m_gpscomm.StopBits := TvaStopBits(sb1);
m_gpscomm.Buffers.ReadSize := 4096;
m_gpscomm.Buffers.WriteSize := 2048;
m_gpscomm.Buffers.WriteTimeout := 1000;
m_gpscomm.Buffers.ReadTimeout := 1000;
m_gpscomm.MonitorEvents := [TVaCommEvent(ceRxFlag)];
m_gpscomm.Options := [];
m_gpscomm.Parity := paNone;
m_gpscomm.EventChars.EventChar := '<';
m_gpscomm.EventChars.EofChar := '<';
m_gpscomm.FlowControl.DsrSensitivity := false;
m_gpscomm.FlowControl.OutCtsFlow := false;
m_gpscomm.FlowControl.OutDsrFlow := false;
m_gpscomm.FlowControl.TxContinueOnXoff := false;
m_gpscomm.FlowControl.XonXoffOut := false;
m_gpscomm.FlowControl.XonXoffIn := false;
m_gpscomm.OnRxFlag := m_gpsCommRxFlag;
if m_gpscomm.Active then
m_gpscomm.Close;
m_gpscomm.PortNum := m_CommPort;
m_gpscomm.DeviceName := 'COM' + inttostr(m_CommPort);
i := 6;
case m_BaudRate of
110: i :=Integer(br110);
300: i :=Integer(br300);
600: i :=Integer(br600);
1200: i :=Integer(br1200);
2400: i :=Integer(br2400);
4800: i :=Integer(br4800);
9600: i :=Integer(br9600);
14400: i :=Integer(br14400);
19200: i :=Integer(br19200);
38400: i :=Integer(br38400);
56000: i :=Integer(br56000);
57600: i :=Integer(br57600);
115200: i :=Integer(br115200);
128000: i :=Integer(br128000);
256000: i :=Integer(br256000);
end;
m_gpscomm.BaudRate := TvaBaudRate(i);
if m_GPSType in [1, 2] then
begin
try
m_gpscomm.Open;
except
Application.MessageBox('Not opened serial port' , 'Error Serial port', 0);
end;
end;
/////////////////////////////////////////////////