Delphi TurboPower Async Professional Data Packet Access Violation…

358 Views Asked by At

I use windows 7, 64-bit SP1, and TP Async V4.07 and have the following problem: I have two Com ports, Com11, and Com18. I add the following components to my form:

enter image description here

I open a Com port on ApdComPort2 (Com18) and it works without a problem. The ApdDataPacket2 detects the packet terminator and the result displayed is what is expected. Both Com11 and Com18 work fine. Now if I open another Com port (Com11) with ApdComPort1 I get an Access violation:

enter image description here

The code that generates the error is this in the AdPacket module:

procedure TApdDataPacketManager.EnablePackets;
var
  i : integer;
begin
  for i := 0 to pred(PacketList.Count) do
    with TApdDataPacket(PacketList[i]) do
      if Enabled then
        Enable;
end;

It is the PacketList.Count that seems to be the problem when it iterates through the list but I can’t catch why:

enter image description here

Note that ApdComPort2 works without problem with both Com11 and Com18. If I remove the Apd2 components then Apd1 works as expected. The problems surface when I try to use two (or more) Apd components at the same time. Does anybody have a suggestion or can recommend a component that works with more than one serial port simultaneously?

1

There are 1 best solutions below

2
On

Some notes about the Turbo Power Async Professional components:

When using the Async components it is very important on how you add the components to the form. If you don’t does it in the right order and in the correct way it will not work if you use more than one serial port. You will actually get an access violation. For example, if you add the components below you have to do it in this way:

enter image description here

  1. Add one ApdComPort to the form, it will become ApdComPort1
  2. Now copy and paste this component to the form, it will become ApdComPort2
  3. Add one ApdDataPacket component to the form, it will become ApdDataPacket1
  4. Now copy and paste this component to the form, it will become ApdDataPacket2
  5. Add one ApdSLController component to the form, it will become ApdSLController1
  6. Now copy and paste this component to the form, it will become ApdSLController2

When doing it, as described above, it works to use two serial ports with ApdDatapacket. Now I don’t get any getting Access violations. I have tested it up to 4 ports and it works as well.