Elektroda.pl
Elektroda.pl
X
Proszę, dodaj wyjątek www.elektroda.pl do Adblock.
Dzięki temu, że oglądasz reklamy, wspierasz portal i użytkowników.

Delphi rs232 - problem z odbiorem danych

pawlo002 19 Paź 2008 13:05 2360 5
  • #1 19 Paź 2008 13:05
    pawlo002
    Poziom 10  

    Witam
    Mam urządzenie i gotowy program exe na PC do jego obsługi.
    muszę się podrobienia z komunikacją. z tego co widziałem po rozebraniu urządzenia to z 9 piniowego złącza podłączony jest tylko 2 i 3 pin i masa rxd txd gdn. Mam zainstalowany Eltima Software Serial Port Monitor" w którym podglądam zachowanie gotowego programu. nigdy nic z rs232 nie robiłem. i już się tydzień mecze i urządzenie nie odpowiada.
    TO CO Robi Gotowiec

    Code:
    0   19:19:34:937   IRP_MJ_CREATE   
    
    1   19:19:34:937   IRP_MJ_CREATE   
    2   19:19:34:937   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_TIMEOUTS)   
    3   19:19:34:937   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_TIMEOUTS)   00 00 00 00 00 00 00 00 00 00 00 00 64 00 00 00 b8 0b 00 00
    4   19:19:34:968   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_TIMEOUTS)   00 00 00 00 00 00 00 00 b8 0b 00 00 00 00 00 00 e8 03 00 00
    5   19:19:34:968   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_TIMEOUTS)   
    6   19:19:34:968   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_QUEUE_SIZE)   f4 01 00 00 f4 01 00 00
    7   19:19:34:968   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_QUEUE_SIZE)   
    8   19:19:34:968   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_PURGE)   0f 00 00 00
    9   19:19:34:968   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_PURGE)   
    10   19:19:34:984   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_BAUD_RATE)   
    11   19:19:34:984   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_BAUD_RATE)   00 4b 00 00
    12   19:19:34:984   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_LINE_CONTROL)   
    13   19:19:35:000   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_LINE_CONTROL)   00 03 08
    14   19:19:35:000   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_CHARS)   
    15   19:19:35:000   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_CHARS)   54 00 00 00 0a 13
    16   19:19:35:000   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_HANDFLOW)   
    17   19:19:35:000   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_HANDFLOW)   41 00 00 00 8c 00 00 00 00 08 00 00 00 02 00 00
    18   19:19:35:015   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_BAUD_RATE)   




    19   19:19:35:015   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_BAUD_RATE)   00 4b 00 00
    20   19:19:35:015   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_LINE_CONTROL)   
    21   19:19:35:015   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_LINE_CONTROL)   00 03 08
    22   19:19:35:031   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_CHARS)   
    23   19:19:35:031   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_CHARS)   54 00 00 00 0a 13
    24   19:19:35:031   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_HANDFLOW)   
    25   19:19:35:031   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_HANDFLOW)   41 00 00 00 8c 00 00 00 00 08 00 00 00 02 00 00
    26   19:19:35:031   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_BAUD_RATE)   00 4b 00 00
    27   19:19:35:031   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_BAUD_RATE)   
    28   19:19:35:046   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_CLR_RTS)   
    29   19:19:35:046   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_CLR_RTS)   
    30   19:19:35:140   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_CLR_DTR)   
    31   19:19:35:140   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_CLR_DTR)   
    32   19:19:35:140   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_LINE_CONTROL)   00 00 08
    33   19:19:35:156   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_LINE_CONTROL)   
    34   19:19:35:156   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_CHARS)   54 00 00 00 0a 13
    35   19:19:35:156   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_CHARS)   
    36   19:19:35:156   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_HANDFLOW)   00 00 00 00 04 00 00 80 00 08 00 00 00 02 00 00
    37   19:19:35:156   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_HANDFLOW)   
    38   19:19:35:171   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_RTS)   
    39   19:19:35:171   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_RTS)   
    40   19:19:35:171   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_PURGE)   0c 00 00 00
    41   19:19:35:171   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_PURGE)   
    42   19:19:35:187   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_BAUD_RATE)   
    43   19:19:35:187   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_BAUD_RATE)   00 4b 00 00
    44   19:19:35:187   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_LINE_CONTROL)   
    45   19:19:35:187   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_LINE_CONTROL)   00 00 08
    46   19:19:35:203   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_CHARS)   
    47   19:19:35:203   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_CHARS)   54 00 00 00 0a 13
    48   19:19:35:203   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_HANDFLOW)   
    49   19:19:35:203   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_HANDFLOW)   00 00 00 00 04 00 00 80 00 08 00 00 00 02 00 00
    50   19:19:35:218   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_BAUD_RATE)   
    51   19:19:35:218   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_BAUD_RATE)   00 4b 00 00
    52   19:19:35:218   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_LINE_CONTROL)   
    53   19:19:35:218   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_LINE_CONTROL)   00 00 08
    54   19:19:35:218   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_CHARS)   
    55   19:19:35:218   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_CHARS)   54 00 00 00 0a 13
    56   19:19:35:234   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_HANDFLOW)   
    57   19:19:35:234   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_HANDFLOW)   00 00 00 00 04 00 00 80 00 08 00 00 00 02 00 00
    58   19:19:35:328   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_BAUD_RATE)   00 4b 00 00
    59   19:19:35:328   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_BAUD_RATE)   
    60   19:19:35:343   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_CLR_RTS)   
    61   19:19:35:343   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_CLR_RTS)   
    62   19:19:35:343   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_CLR_DTR)   
    63   19:19:35:343   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_CLR_DTR)   
    64   19:19:35:359   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_LINE_CONTROL)   00 03 08
    65   19:19:35:359   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_LINE_CONTROL)   
    66   19:19:35:375   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_CHARS)   54 00 00 00 0a 13
    67   19:19:35:375   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_CHARS)   
    68   19:19:35:375   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_HANDFLOW)   00 00 00 00 04 00 00 80 00 08 00 00 00 02 00 00
    69   19:19:35:375   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_HANDFLOW)   
    70   19:19:35:375   IRP_MJ_WRITE   
    71   19:19:35:390   IRP_MJ_WRITE   5b
    72   19:19:35:390   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_BAUD_RATE)   
    73   19:19:35:390   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_BAUD_RATE)   00 4b 00 00
    74   19:19:35:390   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_LINE_CONTROL)   
    75   19:19:35:406   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_LINE_CONTROL)   00 03 08
    76   19:19:35:406   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_CHARS)   
    77   19:19:35:406   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_CHARS)   54 00 00 00 0a 13
    78   19:19:35:406   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_HANDFLOW)   
    79   19:19:35:406   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_HANDFLOW)   00 00 00 00 04 00 00 80 00 08 00 00 00 02 00 00
    80   19:19:35:421   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_BAUD_RATE)   
    81   19:19:35:421   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_BAUD_RATE)   00 4b 00 00
    82   19:19:35:421   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_LINE_CONTROL)   
    83   19:19:35:421   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_LINE_CONTROL)   00 03 08
    84   19:19:35:515   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_CHARS)   
    85   19:19:35:515   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_CHARS)   54 00 00 00 0a 13
    86   19:19:35:515   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_HANDFLOW)   
    87   19:19:35:531   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_HANDFLOW)   00 00 00 00 04 00 00 80 00 08 00 00 00 02 00 00
    88   19:19:35:531   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_BAUD_RATE)   00 4b 00 00
    89   19:19:35:531   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_BAUD_RATE)   
    90   19:19:35:531   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_CLR_RTS)   
    91   19:19:35:531   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_CLR_RTS)   
    92   19:19:35:546   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_CLR_DTR)   
    93   19:19:35:546   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_CLR_DTR)   
    94   19:19:35:546   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_LINE_CONTROL)   00 04 08
    95   19:19:35:546   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_LINE_CONTROL)   
    96   19:19:35:562   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_CHARS)   54 00 00 00 0a 13
    97   19:19:35:562   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_CHARS)   
    98   19:19:35:562   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_HANDFLOW)   00 00 00 00 04 00 00 80 00 08 00 00 00 02 00 00
    99   19:19:35:578   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_HANDFLOW)   
    100   19:19:35:578   IRP_MJ_WRITE   
    101   19:19:35:578   IRP_MJ_WRITE   03 05 ab c9
    102   19:19:35:593   IRP_MJ_READ   
    103   19:19:35:593   IRP_MJ_READ   03 06
    104   19:19:35:593   IRP_MJ_READ   
    105   19:19:35:593   IRP_MJ_READ   35 95
    106   19:19:35:609   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_PURGE)   0c 00 00 00
    107   19:19:35:609   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_PURGE)   
    108   19:19:35:609   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_BAUD_RATE)   
    109   19:19:35:609   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_BAUD_RATE)   00 4b 00 00
    110   19:19:35:625   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_LINE_CONTROL)   
    111   19:19:35:625   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_LINE_CONTROL)   00 04 08
    112   19:19:35:625   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_CHARS)   
    113   19:19:35:625   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_CHARS)   54 00 00 00 0a 13
    114   19:19:35:640   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_HANDFLOW)   
    115   19:19:35:640   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_HANDFLOW)   00 00 00 00 04 00 00 80 00 08 00 00 00 02 00 00
    116   19:19:35:640   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_BAUD_RATE)   
    117   19:19:35:640   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_BAUD_RATE)   00 4b 00 00
    118   19:19:35:656   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_LINE_CONTROL)   
    119   19:19:35:656   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_LINE_CONTROL)   00 04 08
    120   19:19:35:656   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_CHARS)   
    121   19:19:35:656   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_CHARS)   54 00 00 00 0a 13
    122   19:19:35:656   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_HANDFLOW)   
    123   19:19:35:656   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_HANDFLOW)   00 00 00 00 04 00 00 80 00 08 00 00 00 02 00 00
    124   19:19:35:671   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_BAUD_RATE)   00 4b 00 00
    125   19:19:35:671   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_BAUD_RATE)   
    126   19:19:35:671   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_CLR_RTS)   
    127   19:19:35:671   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_CLR_RTS)   
    128   19:19:35:687   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_CLR_DTR)   
    129   19:19:35:687   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_CLR_DTR)   
    130   19:19:35:687   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_LINE_CONTROL)   00 03 08
    131   19:19:35:687   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_LINE_CONTROL)   
    132   19:19:35:703   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_CHARS)   54 00 00 00 0a 13
    133   19:19:35:703   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_CHARS)   
    134   19:19:35:703   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_HANDFLOW)   00 00 00 00 04 00 00 80 00 08 00 00 00 02 00 00
    135   19:19:35:703   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_HANDFLOW)   
    136   19:19:35:718   IRP_MJ_WRITE   
    137   19:19:35:718   IRP_MJ_WRITE   5b
    138   19:19:35:765   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_BAUD_RATE)   
    139   19:19:35:765   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_BAUD_RATE)   00 4b 00 00
    140   19:19:35:781   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_LINE_CONTROL)   
    141   19:19:35:781   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_LINE_CONTROL)   00 03 08
    142   19:19:35:781   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_CHARS)   
    143   19:19:35:781   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_CHARS)   54 00 00 00 0a 13
    144   19:19:35:781   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_HANDFLOW)   
    145   19:19:35:796   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_HANDFLOW)   00 00 00 00 04 00 00 80 00 08 00 00 00 02 00 00
    146   19:19:35:796   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_BAUD_RATE)   
    147   19:19:35:796   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_BAUD_RATE)   00 4b 00 00
    148   19:19:35:796   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_LINE_CONTROL)   
    149   19:19:35:796   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_LINE_CONTROL)   00 03 08
    150   19:19:35:812   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_CHARS)   
    151   19:19:35:812   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_CHARS)   54 00 00 00 0a 13
    152   19:19:35:812   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_HANDFLOW)   
    153   19:19:35:812   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_HANDFLOW)   00 00 00 00 04 00 00 80 00 08 00 00 00 02 00 00
    154   19:19:35:828   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_BAUD_RATE)   00 4b 00 00
    155   19:19:35:828   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_BAUD_RATE)   
    156   19:19:35:828   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_CLR_RTS)   
    157   19:19:35:828   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_CLR_RTS)   
    158   19:19:35:828   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_CLR_DTR)   
    159   19:19:35:843   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_CLR_DTR)   
    160   19:19:35:843   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_LINE_CONTROL)   00 04 08
    161   19:19:35:843   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_LINE_CONTROL)   
    162   19:19:35:859   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_CHARS)   54 00 00 00 0a 13
    163   19:19:35:859   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_CHARS)   
    164   19:19:35:859   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_HANDFLOW)   00 00 00 00 04 00 00 80 00 08 00 00 00 02 00 00
    165   19:19:35:859   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_HANDFLOW)   
    166   19:19:35:859   IRP_MJ_WRITE   
    167   19:19:35:859   IRP_MJ_WRITE   03 49 22 81
    168   19:19:35:875   IRP_MJ_READ   
    169   19:19:35:875   IRP_MJ_READ   04 49
    170   19:19:35:890   IRP_MJ_READ   
    171   19:19:35:890   IRP_MJ_READ   42 03 12
    172   19:45:23:453   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_PURGE)   0f 00 00 00
    173   19:45:24:812   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_PURGE)   
    174   19:45:26:765   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_CLR_DTR)   
    175   19:45:26:781   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_CLR_DTR)   
    176   19:45:27:250   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_TIMEOUTS)   00 00 00 00 00 00 00 00 00 00 00 00 64 00 00 00 b8 0b 00 00
    177   19:45:27:250   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_TIMEOUTS)   
    178   19:45:27:359   IRP_MJ_CLOSE   
    179   19:45:27:359   IRP_MJ_CLOSE   

    KOD MOJEGO PROGRAMU (nie ma to większego składu ładu bo narazie tylko chce dostać odpowiedz, już się maksymalnie starałem upodobnić transmisje)
    Code:
    unit Unit1;
    

    interface

    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, RsPin;

    type

      TForm1 = class(TForm)
        Button1: TButton;
        Edit1: TEdit;
        RsPin1: TRsPin;
        function OpenPort:boolean;
        procedure Write_Comm(hCommDev: THANDLE;nNumberOfBytesToWrite: DWORD);
       // procedure FormCreate(Sender: TObject);
        procedure Read_Comm(hCommDev: THANDLE; Buf_Size: DWORD);
        procedure FormCreate(Sender: TObject);
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;

    var
      Form1: TForm1;
      dcb: TDCB;
      Gdcb: TDCB;
      hCommFile : THandle;
      errorCode : dword;
      errorName : string;
     // danesterownika : array [1..50] of TDaneSterownika;
      CommPort : string = 'COM1:';

    implementation

    {$R *.dfm}
    const


      cbInQueue = 16;
      cbOutQueue = 16;
    var
    i:integer;

    Buffer_O : array[1..cbOutQueue] of Char; // bufor wyjściowy
     Buffer_I : ARRAY[1..cbInQueue] of Char;  // bufor wejściowy
     fdwEvtMask : DWORD;
      Stat : TCOMSTAT;
      Errors : DWORD;
       Number_Bytes_Read : DWORD;




    procedure ClosePort;
     begin
      CloseHandle(hCommFile);
     end;


      //otwarcie portu
    function TForm1.OpenPort:boolean;
    var
    X : commtimeouts;
    Y : CommConfig;
    GX : commtimeouts;
    le : dword;
     begin
     result:=true;
      hCommFile := CreateFile(PChar(CommPort),
                              GENERIC_READ OR GENERIC_WRITE,
                              0,
                              nil,
                              OPEN_EXISTING,
                              FILE_ATTRIBUTE_NORMAL,
                              0);
      le:=getlasterror or 0;
      if (le > 0) and (le < 32) then
       begin
           ErrorCode:=mb_IconStop;
           ErrorName:='Wybrany port szeregowy jest już używany lub nie istnieje';
        MessageBox( WindowHandle, 'Wybrany port szeregowy jest już używany lub nie istnieje', 'Błąd otwarcia portu', MB_OK or MB_ICONSTOP );
        result:=false;
        exit;
       end;
      fillchar( dcb, sizeof(dcb), 0 );
      dcb.DCBLength := sizeof(dcb); // dcb structure size
      DCB.BaudRate:= CBR_19200; // baud rate to use
       //dcb.fDtrControl = DTR_CONTROL_DISABLE;
      //.fBinary Set fBinary: Win32 does not support non binary mode transfers
      // (also disable EOF check)
      //dcb.EofChar := 0;
      dcb.Parity := 0; // type of parity to use
      //OutxCtsFlow
      //OutxDsrFlow
    //dcb.FtrControll:=0x00;
      //DsrSensitivity
      //TXContinueOnXoff
      //OutX
      //inX
      // ErrorChar
      // Null
    // dcb.FRtsControl:=0x00;
     dcb.XonLim := 2048;
     dcb.XoffLim := 512;
      dcb.ByteSize := 8; // how many data bits to use
      dcb.StopBits := 0; // how many stop bits to use
    dcb.Flags := 1155;
      dcb.XONChar := #17;//XON ASCII char
      dcb.XOFFChar := #19; // XOFF ASCII char
     // dcb.ErrorChar :=0;
     // dcb.EofChar :=0;
     // dcb.EvtChar :=0;
     //
     //GetCommTimeouts  ;

      Y.dwProviderSize:=0;
      //SetCommConfig ( hCommFile , Y ,0) ;
      // Change the COMMTIMEOUTS structure settings.

    X.ReadIntervalTimeout := 0;
    X.ReadTotalTimeoutMultiplier := 0;
    X.ReadTotalTimeoutConstant := 3000;
    X.WriteTotalTimeoutMultiplier := 0;
    X.WriteTotalTimeoutConstant := 1000;
    GetCommTimeouts ( hCommFile ,GX ) ;
    SetCommTimeouts (hCommFile, X);
    //SetupComm ( hCommFile , 500, 500 ) ;
    //ClearCommBreak(hCommFile);
    PurgeComm(hCommFile, 15);
    GetCommState ( hCommFile ,GDcb ) ;
    //EscapeCommFunction(hCommFile,CLRDTR);
    //BuildCommDCB('96,n,8,1,0',dcb);
    SetCommState( hCommFile, dcb );
     EscapeCommFunction (hCommFile, SETRTS    );
    // SetCommMask ( hCommFile,1 ) ;
    //AComHandle - jw.
     PurgeComm(hCommFile, 12);
    GetCommState ( hCommFile ,GDcb ) ;
      dcb.Parity := 3;
     SetCommState( hCommFile,Dcb);
         Buffer_O[1]:='[';
    Write_Comm(hCommFile,1);
    GetCommState ( hCommFile ,GDcb ) ;
      dcb.Parity := 4;
    SetCommState( hCommFile, dcb );
        Buffer_O[1]:=char($03);
        Buffer_O[2]:=char($05);
        Buffer_O[3]:=char($ab);
        Buffer_O[4]:=char($c9);
    Write_Comm(hCommFile,4);
     Read_Comm(hCommFile,2);
     Read_Comm(hCommFile,2);
    //PurgeComm(hCommFile, 12);
    //y.dwSize:=500;
    //SetCommCONFIG (hCommFile, y);

    //zamknięci3e portu


     
      // SetCommState( hCommFile, dcb );
    end;
    procedure TForm1.Write_Comm(hCommDev: THANDLE;
                                nNumberOfBytesToWrite: DWORD);
      var
        NumberOfBytesWritten : DWORD;

    begin


       WriteFile(hCommDev, Buffer_O, nNumberOfBytesToWrite, NumberOfBytesWritten, NIL);
      // WaitCommEvent(hCommDev, fdwEvtMask, NIL);
    end;

    procedure TForm1.Read_Comm(hCommDev: THANDLE; Buf_Size: DWORD);
      var
         nNumberOfBytesToRead: DWORD;
    begin
     {  ClearCommError(hCommDev, Errors, @Stat);
       if (Stat.cbInQue > 0) then
         begin
            if (Stat.cbInQue > Buf_Size) then
              nNumberOfBytesToRead := Buf_Size
              else
                 nNumberOfBytesToRead := Stat.cbInQue;  }
             ReadFile(hCommDev, Buffer_I, 8,Number_Bytes_Read, NIL);
       {  end
           else
              Number_Bytes_Read := 0;   }
    end;


    procedure TForm1.FormCreate(Sender: TObject);
    begin
          OpenPort();
    end;




    I TO CO W MONITORKU rs pokazuje gdy odpalę swoją ap

    Code:
    11:18:17:265   IRP_MJ_CREATE   
    
    11:18:17:312   IRP_MJ_CREATE   
    11:18:17:312   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_TIMEOUTS)   
    11:18:17:312   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_TIMEOUTS)   00 00 00 00 00 00 00 00 b8 0b 00 00 00 00 00 00 e8 03 00 00
    11:18:17:312   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_TIMEOUTS)   00 00 00 00 00 00 00 00 b8 0b 00 00 00 00 00 00 e8 03 00 00
    11:18:17:312   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_TIMEOUTS)   
    11:18:17:328   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_PURGE)   0f 00 00 00
    11:18:17:328   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_PURGE)   
    11:18:17:328   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_BAUD_RATE)   
    11:18:17:375   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_BAUD_RATE)   00 4b 00 00
    11:18:17:390   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_LINE_CONTROL)   
    11:18:17:390   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_LINE_CONTROL)   00 04 08
    11:18:17:390   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_CHARS)   
    11:18:17:390   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_CHARS)   00 00 00 00 11 13
    11:18:17:390   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_HANDFLOW)   
    11:18:17:390   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_HANDFLOW)   00 00 00 00 04 00 00 80 00 08 00 00 00 02 00 00
    11:18:17:406   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_BAUD_RATE)   
    11:18:17:406   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_BAUD_RATE)   00 4b 00 00
    11:18:17:406   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_LINE_CONTROL)   
    11:18:17:406   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_LINE_CONTROL)   00 04 08
    11:18:17:421   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_CHARS)   
    11:18:17:421   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_CHARS)   00 00 00 00 11 13
    11:18:17:421   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_HANDFLOW)   
    11:18:17:421   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_HANDFLOW)   00 00 00 00 04 00 00 80 00 08 00 00 00 02 00 00
    11:18:17:421   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_BAUD_RATE)   00 4b 00 00
    11:18:17:437   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_BAUD_RATE)   
    11:18:17:484   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_CLR_RTS)   
    11:18:17:484   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_CLR_RTS)   
    11:18:17:484   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_CLR_DTR)   
    11:18:17:484   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_CLR_DTR)   
    11:18:17:500   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_LINE_CONTROL)   00 00 08
    11:18:17:500   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_LINE_CONTROL)   
    11:18:17:500   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_CHARS)   00 00 00 00 11 13
    11:18:17:500   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_CHARS)   
    11:18:17:515   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_HANDFLOW)   00 00 00 00 04 00 00 80 00 08 00 00 00 02 00 00
    11:18:17:515   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_HANDFLOW)   
    11:18:17:515   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_RTS)   
    11:18:17:515   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_RTS)   
    11:18:17:531   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_PURGE)   0c 00 00 00
    11:18:17:531   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_PURGE)   
    11:18:17:531   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_BAUD_RATE)   
    11:18:17:531   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_BAUD_RATE)   00 4b 00 00
    11:18:17:546   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_LINE_CONTROL)   
    11:18:17:546   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_LINE_CONTROL)   00 00 08
    11:18:17:546   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_CHARS)   
    11:18:17:546   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_CHARS)   00 00 00 00 11 13
    11:18:17:546   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_HANDFLOW)   
    11:18:17:562   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_HANDFLOW)   00 00 00 00 04 00 00 80 00 08 00 00 00 02 00 00
    11:18:17:562   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_BAUD_RATE)   
    11:18:17:562   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_BAUD_RATE)   00 4b 00 00
    11:18:17:562   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_LINE_CONTROL)   
    11:18:17:562   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_LINE_CONTROL)   00 00 08
    11:18:17:578   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_CHARS)   
    11:18:17:578   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_CHARS)   00 00 00 00 11 13
    11:18:17:578   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_HANDFLOW)   
    11:18:17:578   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_HANDFLOW)   00 00 00 00 04 00 00 80 00 08 00 00 00 02 00 00
    11:18:17:593   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_BAUD_RATE)   00 4b 00 00
    11:18:17:593   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_BAUD_RATE)   
    11:18:17:593   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_CLR_RTS)   
    11:18:17:593   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_CLR_RTS)   
    11:18:17:609   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_CLR_DTR)   
    11:18:17:609   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_CLR_DTR)   
    11:18:17:609   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_LINE_CONTROL)   00 03 08
    11:18:17:609   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_LINE_CONTROL)   
    11:18:17:625   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_CHARS)   00 00 00 00 11 13
    11:18:17:625   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_CHARS)   
    11:18:17:625   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_HANDFLOW)   00 00 00 00 04 00 00 80 00 08 00 00 00 02 00 00
    11:18:17:625   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_HANDFLOW)   
    11:18:17:625   IRP_MJ_WRITE   
    11:18:17:640   IRP_MJ_WRITE   5b
    11:18:17:640   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_BAUD_RATE)   
    11:18:17:640   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_BAUD_RATE)   00 4b 00 00
    11:18:17:640   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_LINE_CONTROL)   
    11:18:17:656   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_LINE_CONTROL)   00 03 08
    11:18:17:656   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_CHARS)   
    11:18:17:656   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_CHARS)   00 00 00 00 11 13
    11:18:17:687   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_HANDFLOW)   
    11:18:17:687   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_HANDFLOW)   00 00 00 00 04 00 00 80 00 08 00 00 00 02 00 00
    11:18:17:687   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_BAUD_RATE)   
    11:18:17:687   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_BAUD_RATE)   00 4b 00 00
    11:18:17:703   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_LINE_CONTROL)   
    11:18:17:703   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_LINE_CONTROL)   00 03 08
    11:18:17:703   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_CHARS)   
    11:18:17:703   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_CHARS)   00 00 00 00 11 13
    11:18:17:718   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_HANDFLOW)   
    11:18:17:718   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_HANDFLOW)   00 00 00 00 04 00 00 80 00 08 00 00 00 02 00 00
    11:18:17:718   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_BAUD_RATE)   00 4b 00 00
    11:18:17:718   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_BAUD_RATE)   
    11:18:17:718   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_CLR_RTS)   
    11:18:17:734   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_CLR_RTS)   
    11:18:17:734   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_CLR_DTR)   
    11:18:17:734   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_CLR_DTR)   
    11:18:17:781   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_LINE_CONTROL)   00 04 08
    11:18:17:781   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_LINE_CONTROL)   
    11:18:17:796   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_CHARS)   00 00 00 00 11 13
    11:18:17:796   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_CHARS)   
    11:18:17:796   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_HANDFLOW)   00 00 00 00 04 00 00 80 00 08 00 00 00 02 00 00
    11:18:17:796   IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_HANDFLOW)   
    11:18:17:812   IRP_MJ_WRITE   
    11:18:17:812   IRP_MJ_WRITE   03 05 ab c9
    11:18:17:812   IRP_MJ_READ   
    11:18:20:265   IRP_MJ_READ   
    11:18:20:328   IRP_MJ_READ   
    11:18:23:265   IRP_MJ_READ   
    12:52:05:468   IRP_MJ_CLOSE   
    12:52:05:546   IRP_MJ_CLOSE   



    W czym robie zle czas mojego jest o polowe krótszy. może za mało czasu daje na ustawienia i na nadanie odpowiedzi.?[/b]

    0 5
  • #2 19 Paź 2008 16:17
    190175
    Użytkownik usunął konto  
  • #3 19 Paź 2008 17:31
    pawlo002
    Poziom 10  

    Code:
    [17:25:23:468] - Open COM1 port (Z:\Aps..exe)
    



    [17:25:23:906] - Written data

    5b 03 05 ab c9             [..«É

    [17:25:23:984] - Read data

    03 06 35 95                ..5•


    a tu nic nie odbiera
    Code:
    [17:28:28:328] - Open COM1 port (D:\Program Files\Borland\Delphi7\Projects\dsc\Project1.exe)
    



    [17:28:28:734] - Written data

    5b 03 05 ab c9             [..«É


    A ma znaczenie czas miedzy poleceniami nadawaniem odbieranie ustawianiem ??? Comport mam ale nie mogłem ustawić pewnych flag :(

    0
  • #4 19 Paź 2008 18:23
    190175
    Użytkownik usunął konto  
  • #5 21 Paź 2008 12:30
    pawlo002
    Poziom 10  

    hehe już wiem co robiłem nie tak nie dałem czasu na przestawienie bits mark a space wystarczyło sleep(1);


    Ale mam jeszcze pytanko jak odbieram Dane comport.readstr(bufffor, Integer) to jak dowiedzieć sie ile danych jest w bufforze ?

    0
  • #6 21 Paź 2008 13:16
    190175
    Użytkownik usunął konto  
  Szukaj w 5mln produktów