6
Answers

How to write a specific COM connection?

Sascha B

Sascha B

14y
5.6k
1
Hello,

I'm working with a measurement system (CL-200) and want to controll it with my computer.
So I connected it with the standart connection (BaudRate, DataBits, StopBits, Parity) but the original
software that I don't want to use sets the device in a "PC mode".
Only in this mode I can get answer with my Code requests.
So how do I set the needed values like this Software?
Cause with my connection the device isn't in a "Pc mode".

Here is a communication log from the software I want to emulate:
 
0 IRP_MJ_CREATE DOWN TRUE 0x0 43 00 4C 00 53 00 31 00 77 00 2E 00 65 00 78 00 65 00 00 00  C.L.S.1.w...e.x.e...
1 IRP_MJ_CREATE UP FALSE 0x0
2 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_BAUD_RATE: Retrieve Baud Rate) DOWN FALSE 0x0
3 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_BAUD_RATE: Retrieve Baud Rate) UP TRUE 0x0 80 25 00 00  €%..
4 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_LINE_CONTROL: Retrieve line control) DOWN FALSE 0x0
5 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_LINE_CONTROL: Retrieve line control) UP TRUE 0x0 00 00 08  ...
6 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_CHARS: Retrieve special characters) DOWN FALSE 0x0
7 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_CHARS: Retrieve special characters) UP TRUE 0x0 1A 00 00 1A 11 13  ......
8 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_HANDFLOW: Retrieve handshake information) DOWN FALSE 0x0
9 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_HANDFLOW: Retrieve handshake information) UP TRUE 0x0 00 00 00 00 00 00 00 00 19 00 00 00 19 00 00 00  ................
10 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_BAUD_RATE: Retrieve Baud Rate) DOWN FALSE 0x0
11 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_BAUD_RATE: Retrieve Baud Rate) UP TRUE 0x0 80 25 00 00  €%..
12 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_LINE_CONTROL: Retrieve line control) DOWN FALSE 0x0
13 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_LINE_CONTROL: Retrieve line control) UP TRUE 0x0 00 00 08  ...
14 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_CHARS: Retrieve special characters) DOWN FALSE 0x0
15 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_CHARS: Retrieve special characters) UP TRUE 0x0 1A 00 00 1A 11 13  ......
16 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_HANDFLOW: Retrieve handshake information) DOWN FALSE 0x0
17 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_HANDFLOW: Retrieve handshake information) UP TRUE 0x0 00 00 00 00 00 00 00 00 19 00 00 00 19 00 00 00  ................
18 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_BAUD_RATE: Set baud rate) DOWN TRUE 0x0 80 25 00 00  €%..
19 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_BAUD_RATE: Set baud rate) UP FALSE 0x0
20 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_RTS: Set RTS) DOWN FALSE 0x0
21 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_RTS: Set RTS) UP FALSE 0x0
22 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_DTR: Set DTR) DOWN FALSE 0x0
23 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_DTR: Set DTR) UP FALSE 0x0
24 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_LINE_CONTROL: Set line control) DOWN TRUE 0x0 00 02 07  ...
25 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_LINE_CONTROL: Set line control) UP FALSE 0x0
26 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_CHARS: Set special characters) DOWN TRUE 0x0 1A 00 00 1A 11 13  ......
27 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_CHARS: Set special characters) UP FALSE 0x0
28 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_HANDFLOW: Set handshake information) DOWN TRUE 0x0 01 00 00 00 40 00 00 00 19 00 00 00 19 00 00 00  ....@...........
29 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_HANDFLOW: Set handshake information) UP FALSE 0x0
30 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_TIMEOUTS: Set timeouts) DOWN TRUE 0x0 FF FF 00 00 01 00 00 00 2C 01 00 00 00 00 00 00 00 00 00 00  ÿÿ...... ...........
31 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_TIMEOUTS: Set timeouts) UP FALSE 0x0
32 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_PURGE: Purge requests) DOWN TRUE 0x0 0C 00 00 00  ....
33 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_PURGE: Purge requests) UP FALSE 0x0
34 IRP_MJ_WRITE DOWN TRUE 0x0 02 39 39 35 34 31 20 20 20 03 31 33 0D 0A  .99541   .13..
35 IRP_MJ_WRITE UP TRUE 0x0 02 39 39 35 34 31 20 20 20 03 31 33 0D 0A  .99541   .13..
36 IRP_MJ_READ DOWN FALSE 0x0
37 IRP_MJ_READ UP FALSE 0x102

And here is the log of my current connection:

 
0 IRP_MJ_CREATE DOWN TRUE 0x0 53 00 65 00 72 00 69 00 61 00 6C 00 50 00 6F 00 72 00 74 00 20 00 54 00 65 00 72 00 6D 00 69 00 6E 00 61 00 6C 00 2E 00 76 00 73 00 68 00 6F 00 73 00 74 00 2E 00 65 00 78 00 65 00 00 00  S.e.r.i.a.l.P.o.r.t. .T.e.r.m.i.n.a.l...v.s.h.o.s.t...e.x.e...
1 IRP_MJ_CREATE UP FALSE 0x0
2 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_PROPERTIES: Retrieve COM properties) DOWN FALSE 0x0
3 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_PROPERTIES: Retrieve COM properties) UP TRUE 0x0 40 00 02 00 01 00 00 00 00 00 00 00 00 10 00 00 00 10 00 00 00 00 02 00 06 00 00 00 CB 01 00 00 7F 00 00 00 70 6B 06 00 0F 00 07 1F 00 00 00 00 64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  @...........................Ë......pk..........d...............
4 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_MODEMSTATUS: Retrieve modem status) DOWN FALSE 0x0
5 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_MODEMSTATUS: Retrieve modem status) UP TRUE 0x0 30 00 00 00  0...
6 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_BAUD_RATE: Retrieve Baud Rate) DOWN FALSE 0x0
7 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_BAUD_RATE: Retrieve Baud Rate) UP TRUE 0x0 B0 04 00 00  °...
8 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_LINE_CONTROL: Retrieve line control) DOWN FALSE 0x0
9 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_LINE_CONTROL: Retrieve line control) UP TRUE 0x0 00 00 07  ...
10 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_CHARS: Retrieve special characters) DOWN FALSE 0x0
11 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_CHARS: Retrieve special characters) UP TRUE 0x0 00 00 00 00 00 00  ......
12 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_HANDFLOW: Retrieve handshake information) DOWN FALSE 0x0
13 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_HANDFLOW: Retrieve handshake information) UP TRUE 0x0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
14 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_BAUD_RATE: Retrieve Baud Rate) DOWN FALSE 0x0
15 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_BAUD_RATE: Retrieve Baud Rate) UP TRUE 0x0 B0 04 00 00  °...
16 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_LINE_CONTROL: Retrieve line control) DOWN FALSE 0x0
17 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_LINE_CONTROL: Retrieve line control) UP TRUE 0x0 00 00 07  ...
18 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_CHARS: Retrieve special characters) DOWN FALSE 0x0
19 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_CHARS: Retrieve special characters) UP TRUE 0x0 00 00 00 00 00 00  ......
20 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_HANDFLOW: Retrieve handshake information) DOWN FALSE 0x0
21 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_HANDFLOW: Retrieve handshake information) UP TRUE 0x0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
22 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_BAUD_RATE: Set baud rate) DOWN TRUE 0x0 80 25 00 00  ?%..
23 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_BAUD_RATE: Set baud rate) UP FALSE 0x0
24 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_CLR_RTS: Clear RTS) DOWN FALSE 0x0
25 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_CLR_RTS: Clear RTS) UP FALSE 0x0
26 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_CLR_DTR: Clear DTR) DOWN FALSE 0x0
27 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_CLR_DTR: Clear DTR) UP FALSE 0x0
28 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_LINE_CONTROL: Set line control) DOWN TRUE 0x0 00 02 07  ...
29 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_LINE_CONTROL: Set line control) UP FALSE 0x0
30 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_CHARS: Set special characters) DOWN TRUE 0x0 1A 3F 3F 1A 11 13  .??...
31 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_CHARS: Set special characters) UP FALSE 0x0
32 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_HANDFLOW: Set handshake information) DOWN TRUE 0x0 00 00 00 00 04 00 00 00 19 00 00 00 19 00 00 00  ................
33 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_HANDFLOW: Set handshake information) UP FALSE 0x0
34 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_BAUD_RATE: Retrieve Baud Rate) DOWN FALSE 0x0
35 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_BAUD_RATE: Retrieve Baud Rate) UP TRUE 0x0 80 25 00 00  ?%..
36 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_LINE_CONTROL: Retrieve line control) DOWN FALSE 0x0
37 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_LINE_CONTROL: Retrieve line control) UP TRUE 0x0 00 02 07  ...
38 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_CHARS: Retrieve special characters) DOWN FALSE 0x0
39 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_CHARS: Retrieve special characters) UP TRUE 0x0 1A 3F 3F 1A 11 13  .??...
40 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_HANDFLOW: Retrieve handshake information) DOWN FALSE 0x0
41 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_HANDFLOW: Retrieve handshake information) UP TRUE 0x0 00 00 00 00 04 00 00 00 19 00 00 00 19 00 00 00  ................
42 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_BAUD_RATE: Set baud rate) DOWN TRUE 0x0 80 25 00 00  ?%..
43 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_BAUD_RATE: Set baud rate) UP FALSE 0x0
44 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_CLR_RTS: Clear RTS) DOWN FALSE 0x0
45 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_CLR_RTS: Clear RTS) UP FALSE 0x0
46 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_CLR_DTR: Clear DTR) DOWN FALSE 0x0
47 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_CLR_DTR: Clear DTR) UP FALSE 0x0
48 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_LINE_CONTROL: Set line control) DOWN TRUE 0x0 00 02 07  ...
49 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_LINE_CONTROL: Set line control) UP FALSE 0x0
50 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_CHARS: Set special characters) DOWN TRUE 0x0 1A 3F 3F 1A 11 13  .??...
51 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_CHARS: Set special characters) UP FALSE 0x0
52 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_HANDFLOW: Set handshake information) DOWN TRUE 0x0 00 00 00 00 04 00 00 00 19 00 00 00 19 00 00 00  ................
53 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_HANDFLOW: Set handshake information) UP FALSE 0x0
54 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_CLR_DTR: Clear DTR) DOWN FALSE 0x0
55 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_CLR_DTR: Clear DTR) UP FALSE 0x0
56 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_TIMEOUTS: Set timeouts) DOWN TRUE 0x0 FF FF FF FF FF FF FF FF FE FF FF FF 00 00 00 00 00 00 00 00  ÿÿÿÿÿÿÿÿþÿÿÿ........
57 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_TIMEOUTS: Set timeouts) UP FALSE 0x0
58 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_WAIT_MASK: Set current event mask) DOWN TRUE 0x0 FB 01 00 00  û...
59 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_WAIT_MASK: Set current event mask) UP FALSE 0x0
60 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_QUEUE_SIZE: Set queue size) DOWN TRUE 0x0 00 10 00 00 00 08 00 00  ........
61 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_QUEUE_SIZE: Set queue size) UP FALSE 0x0
62 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_WAIT_ON_MASK: Wait for event) DOWN FALSE 0x0

See mine is so much different than the connection I want to have.

Thanks for answers
Answers (6)