티스토리 뷰
-----------------------------------------------------------------
// COM 열기 참고 코드
-----------------------------------------------------------------
nrComm: TnrComm;
nrComm.Active := False;
nrComm.ComPortNo := m_cs.nPort;
nrComm.BaudRate := m_cs.nBaud; //110 ~ 256000
nrComm.ByteSize := m_cs.nDataBit;
nrComm.Parity := TParity( m_cs.nParity );
nrComm.StopBits := TStopBits( m_cs.nStopBit );
nrComm.StreamProtocol := spNone;
nrComm.SetStateDTR( True );
nrComm.SetStateRTS( True );
nrComm.Active := True;
-----------------------------------------------------------------
// 쓰기 참고 코드
-----------------------------------------------------------------
var
nLen : Integer;
sendBuf : Array Of AnsiChar;
begin
nLen := 6;
Setlength( sendBuf, nLen );
sendBuf[0] := 'R';
sendBuf[1] := 'E';
sendBuf[2] := 'A';
sendBuf[3] := 'D';
sendBuf[4] := #$0D;
sendBuf[5] := #$0A;
nrComm.SendData( @sendBuf[0], nLen );
end;
-----------------------------------------------------------------
// 읽기 참고 코드
-----------------------------------------------------------------
procedure TfrmComm.nrCommAfterReceive( Com: TObject;
Buffer: Pointer;
Received: Cardinal );
var
I : Integer;
nLen : Integer;
sendBuf : Array Of AnsiChar;
begin
if( Received < 1 ) then
begin
Exit;
end;
for i := 0 to Received-1 do
begin
m_asBuf := m_asBuf + PAnsiChar(Buffer)[i];
nLen := Length( m_asBuf );
if( (m_asBuf[nLen-1] = #13 ) and
(m_asBuf[nLen-0] = #10 ) ) then
begin
// To Do Something..
//m_dicIndicator.Add( GetKeyCount(), m_asBuf );
mmoCOMM.Lines.Add( m_asBuf );
m_asBuf := '';
end;
end;
end;
'VCL' 카테고리의 다른 글
(URL) Media Player VLC ActiveX Delphi tutorial (0) | 2019.08.29 |
---|---|
(URL) ROUND / TRUNC / MOD on DELPHI (0) | 2019.08.26 |
(CODE) Playing .WAV files with MediaPlayer. (0) | 2019.07.22 |
(i) Delphi - FastReport VCL Pro 설치하기 (0) | 2019.07.02 |
(i) Delphi - KisPosAgent ActiveX(ocx) 등록하기 (0) | 2019.07.02 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 앱관리자
- Android 64
- .dproj
- Delphi
- 비에이블
- RADStudio11
- KSNetPOSLib
- mysql db 복구
- 키오스크
- SOLO1ASP
- Unable to load project
- DelphiZeroMQ
- FMX
- push server
- WidevineID
- 안드로이드관리자
- KSNetPOSLib.ocx
- solomonsystem
- 안드로이드_관리자
- TT쿼리
- 솔로원DB복제
- Firemonkey
- 솔로몬시스템
- Grijjy
- Could not convert variant of type (Null) into type (OleStr)
- delphi push message
- 스터디카페
- 식권발매
- 비에이블스터디카페
- READ_PRIVILEGED_PHONE_STATE
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
글 보관함