掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
RS232Cの制御電文におけるBCC(Block Checking Code)算出について (ID:150641)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
違いましたか TCommがおかれているサイトがあったので抜粋してみたのですが特におかしいところがありません https://basicc.exblog.jp/i11/ procedure TComm.SendString(S: string); begin Write(PChar(S), Length(S)); end; procedure TComm.Write(Buffer: PChar; Size: Integer); var dwError: DWord; Stat: TComStat; dwBytesWritten: DWord; begin if FHandle = INVALID_HANDLE_VALUE then raise ECommError.Create('通信が開始されていません。'); if FOutQueueSize < Size then raise ECommError.Create('送信データ長が長すぎます。'); repeat ClearCommError(FHandle, dwError, @Stat); until (FOutQueueSize - Stat.cbOutQue) >= Word(Size); if FWinVersion <> VER_PLATFORM_WIN32_NT then begin if (cfcRtsCts in FFlowControls) and (FRtsControls = crcToggle) then begin while not IOCheck do ; if RtsSendHi then begin EscapeCommFunction(FHandle, SETRTS); end else begin EscapeCommFunction(FHandle, CLRRTS); end; end; end; if not WriteFile(FHandle, Buffer^, Size, dwBytesWritten, @FWriteOs) then begin if FWinVersion <> VER_PLATFORM_WIN32_NT then begin if (cfcRtsCts in FFlowControls) and (FRtsControls = crcToggle) then begin while not IOCheck do ; if RtsSendHi then begin EscapeCommFunction(FHandle, CLRRTS); end else begin EscapeCommFunction(FHandle, SETRTS); end; end else begin EscapeCommFunction(FHandle, SETRTS); end; end; if GetLastError = ERROR_IO_PENDING then begin while not GetOverlappedResult(FHandle, FWriteOs, dwBytesWritten, True) do begin if GetLastError = ERROR_IO_INCOMPLETE then Continue else begin ClearCommError(FHandle, dwError, @Stat); Break; end; end; end else begin ClearCommError(FHandle, dwError, @Stat); raise ECommReadWriteError.Create(dwError); end; end; end;
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.