Serial Communication Delphi Xe2
I am using Delphi XE2 and I try to communicate with some device via serial port. Communication should be straight forward, but I have some problems. The device communication protocol is as follows:I (master) send frame starting with ':' and ending with CRLF.The device (slave) sends response in the same format (starting with ':' and ending with CRLF).
Oct 24, 2017. Communication with devices connected to serial port; easy of use and very powerful; uses multithreading and overlapping for maximum performance; available for Delphi/C++ Builder 5 - 10.2 and Lazarus 1.6.4; source code included in registered version; royalty free distribution in applications. Torry's Delphi Pages Delphi xe2 serial port.. Description AVSD OEM is a programming interface, which allows you to add support of virtual serial ports to your own application Delphi xe2 serial port. I would like to use Delphi XE2 Starter Firemonkey to make a 3D visualize the signals from an Inertial Measurment Unit (IMU). The IMU sends measures through a serial port. To read from that serial port, I tried to use the TApdComPort component, in the APRO librairy from TurboPower Asynchronous.
I am using WinAPI and non overlapped IO. The problem I have is that, very often I receive #0 chars as response from the device. I am sure the problem is on my side, because I can use device provider application, and I can see that communication goes fine.
Here is how I setup my COM port:
Here is how I do write:
Just look at the Alekhine-Chatard Attack for instance!(2) It allows the Winawer. For instance, there is the Classical French, with all its variations and sub-variations. The french tarrasch variation pdf converter.
And finally here it is how I do reads:
As I mentioned above, in reads instead of getting actual frame I do get string of #0 chars. I think, that my mistake might be with WaitCommEvent API calls, as I am very new to serial communication.
Thanks for help!
1 Answer
Maybe you forgot the '@': ReadFile(FFileHandle, @ S[1], Length(S), BytesRead, nil)
I'm doing like this to read string from COM:
FEOSChar
end of string byte/char. To get string
from TBytes
you can use SysUtils.StringOf()
function
upd: