I'm still stuck! I used PortMon to analyse the port, firstly for my program running alone:
0 0.04459980 MatOrbOfficialT IRP_MJ_CREATE VCP0 SUCCESS Options: Open
1 0.00000531 MatOrbOfficialT IOCTL_SERIAL_GET_PROPERTIES VCP0 SUCCESS
2 0.00000335 MatOrbOfficialT IOCTL_SERIAL_GET_MODEMSTATUS VCP0 SUCCESS
3 0.00000251 MatOrbOfficialT IOCTL_SERIAL_GET_BAUD_RATE VCP0 SUCCESS
4 0.00000251 MatOrbOfficialT IOCTL_SERIAL_GET_LINE_CONTROL VCP0 SUCCESS
5 0.00000223 MatOrbOfficialT IOCTL_SERIAL_GET_CHARS VCP0 SUCCESS
6 0.00000251 MatOrbOfficialT IOCTL_SERIAL_GET_HANDFLOW VCP0 SUCCESS
7 0.00000307 MatOrbOfficialT IOCTL_SERIAL_GET_BAUD_RATE VCP0 SUCCESS
8 0.00000223 MatOrbOfficialT IOCTL_SERIAL_GET_LINE_CONTROL VCP0 SUCCESS
9 0.00000196 MatOrbOfficialT IOCTL_SERIAL_GET_CHARS VCP0 SUCCESS
10 0.00000196 MatOrbOfficialT IOCTL_SERIAL_GET_HANDFLOW VCP0 SUCCESS
11 0.00216620 MatOrbOfficialT IOCTL_SERIAL_SET_BAUD_RATE VCP0 SUCCESS Rate: 19200
12 0.00295484 MatOrbOfficialT IOCTL_SERIAL_SET_RTS VCP0 SUCCESS
13 0.00297244 MatOrbOfficialT IOCTL_SERIAL_CLR_DTR VCP0 SUCCESS
14 0.00297496 MatOrbOfficialT IOCTL_SERIAL_SET_LINE_CONTROL VCP0 SUCCESS StopBits: 1 Parity: NONE WordLength: 8
15 0.00000251 MatOrbOfficialT IOCTL_SERIAL_SET_CHAR VCP0 SUCCESS EOF:1a ERR:0 BRK:0 EVT:1a XON:11 XOFF:13
16 0.00501293 MatOrbOfficialT IOCTL_SERIAL_SET_HANDFLOW VCP0 SUCCESS Shake:0 Replace:40 XonLimit:1024 XoffLimit:1024
17 0.00000251 MatOrbOfficialT IOCTL_SERIAL_GET_BAUD_RATE VCP0 SUCCESS
18 0.00000223 MatOrbOfficialT IOCTL_SERIAL_GET_LINE_CONTROL VCP0 SUCCESS
19 0.00000223 MatOrbOfficialT IOCTL_SERIAL_GET_CHARS VCP0 SUCCESS
20 0.00000223 MatOrbOfficialT IOCTL_SERIAL_GET_HANDFLOW VCP0 SUCCESS
21 0.00282829 MatOrbOfficialT IOCTL_SERIAL_SET_BAUD_RATE VCP0 SUCCESS Rate: 19200
22 0.00293892 MatOrbOfficialT IOCTL_SERIAL_SET_RTS VCP0 SUCCESS
23 0.00296909 MatOrbOfficialT IOCTL_SERIAL_CLR_DTR VCP0 SUCCESS
24 0.00297719 MatOrbOfficialT IOCTL_SERIAL_SET_LINE_CONTROL VCP0 SUCCESS StopBits: 1 Parity: NONE WordLength: 8
25 0.00000279 MatOrbOfficialT IOCTL_SERIAL_SET_CHAR VCP0 SUCCESS EOF:1a ERR:0 BRK:0 EVT:1a XON:11 XOFF:13
26 0.00294954 MatOrbOfficialT IOCTL_SERIAL_SET_HANDFLOW VCP0 SUCCESS Shake:0 Replace:40 XonLimit:1024 XoffLimit:1024
27 0.00288919 MatOrbOfficialT IOCTL_SERIAL_CLR_DTR VCP0 SUCCESS
28 0.00000447 MatOrbOfficialT IOCTL_SERIAL_GET_BAUD_RATE VCP0 SUCCESS
29 0.00000223 MatOrbOfficialT IOCTL_SERIAL_GET_LINE_CONTROL VCP0 SUCCESS
30 0.00000251 MatOrbOfficialT IOCTL_SERIAL_GET_CHARS VCP0 SUCCESS
31 0.00000223 MatOrbOfficialT IOCTL_SERIAL_GET_HANDFLOW VCP0 SUCCESS
32 0.00285763 MatOrbOfficialT IOCTL_SERIAL_SET_BAUD_RATE VCP0 SUCCESS Rate: 19200
33 0.00296406 MatOrbOfficialT IOCTL_SERIAL_CLR_RTS VCP0 SUCCESS
34 0.00298753 MatOrbOfficialT IOCTL_SERIAL_CLR_DTR VCP0 SUCCESS
35 0.00292132 MatOrbOfficialT IOCTL_SERIAL_SET_LINE_CONTROL VCP0 SUCCESS StopBits: 1 Parity: NONE WordLength: 8
36 0.00000559 MatOrbOfficialT IOCTL_SERIAL_SET_CHAR VCP0 SUCCESS EOF:1a ERR:0 BRK:0 EVT:1a XON:11 XOFF:13
37 0.00491962 MatOrbOfficialT IOCTL_SERIAL_SET_HANDFLOW VCP0 SUCCESS Shake:0 Replace:0 XonLimit:1024 XoffLimit:1024
38 0.00292942 MatOrbOfficialT IOCTL_SERIAL_CLR_RTS VCP0 SUCCESS
39 0.00000475 MatOrbOfficialT IOCTL_SERIAL_SET_TIMEOUTS VCP0 SUCCESS RI:-1 RM:-1 RC:-2 WM:0 WC:0
40 0.00245674 MatOrbOfficialT IOCTL_SERIAL_SET_WAIT_MASK VCP0 SUCCESS Mask: RXCHAR RXFLAG CTS DSR RLSD BRK ERR RING
41 0.00000670 MatOrbOfficialT IOCTL_SERIAL_SET_QUEUE_SIZE VCP0 SUCCESS InSize: 4096 OutSize: 2048
42 0.00000000 MatOrbOfficialT IOCTL_SERIAL_WAIT_ON_MASK VCP0
43 0.00049811 MatOrbOfficialT IRP_MJ_WRITE VCP0 SUCCESS Length 2: .X
Then for LCDC:
0 0.05153979 LCDC.exe IRP_MJ_CREATE VCP0 SUCCESS Options: Open
1 0.00000503 LCDC.exe IOCTL_SERIAL_SET_QUEUE_SIZE VCP0 SUCCESS InSize: 1024 OutSize: 1024
2 0.00000251 LCDC.exe IOCTL_SERIAL_GET_BAUD_RATE VCP0 SUCCESS
3 0.00000279 LCDC.exe IOCTL_SERIAL_GET_LINE_CONTROL VCP0 SUCCESS
4 0.00000223 LCDC.exe IOCTL_SERIAL_GET_CHARS VCP0 SUCCESS
5 0.00000251 LCDC.exe IOCTL_SERIAL_GET_HANDFLOW VCP0 SUCCESS
6 0.00274029 LCDC.exe IOCTL_SERIAL_SET_BAUD_RATE VCP0 SUCCESS Rate: 19200
7 0.00299563 LCDC.exe IOCTL_SERIAL_CLR_RTS VCP0 SUCCESS
8 0.00295205 LCDC.exe IOCTL_SERIAL_CLR_DTR VCP0 SUCCESS
9 0.00289757 LCDC.exe IOCTL_SERIAL_SET_LINE_CONTROL VCP0 SUCCESS StopBits: 1 Parity: NONE WordLength: 8
10 0.00000531 LCDC.exe IOCTL_SERIAL_SET_CHAR VCP0 SUCCESS EOF:b0 ERR:1 BRK:1 EVT:0 XON:79 XOFF:13
11 0.00296155 LCDC.exe IOCTL_SERIAL_SET_HANDFLOW VCP0 SUCCESS Shake:0 Replace:0 XonLimit:256 XoffLimit:256
12 0.00000307 LCDC.exe IOCTL_SERIAL_SET_TIMEOUTS VCP0 SUCCESS RI:-1 RM:0 RC:0 WM:100 WC:1000
13 0.00251401 LCDC.exe IOCTL_SERIAL_SET_WAIT_MASK VCP0 SUCCESS Mask: RXCHAR ERR
14 0.00000335 LCDC.exe IOCTL_SERIAL_GET_MODEMSTATUS VCP0 SUCCESS
15 0.00000251 LCDC.exe IOCTL_SERIAL_GET_MODEMSTATUS VCP0 SUCCESS
16 0.00000251 LCDC.exe IOCTL_SERIAL_GET_MODEMSTATUS VCP0 SUCCESS
17 0.00000391 LCDC.exe IOCTL_SERIAL_PURGE VCP0 SUCCESS Purge: TXCLEAR RXCLEAR
18 0.00066545 LCDC.exe IRP_MJ_WRITE VCP0 SUCCESS Length 3: .P.
19 3.94750981 LCDC.exe IOCTL_SERIAL_WAIT_ON_MASK VCP0 SUCCESS
20 0.00091632 LCDC.exe IRP_MJ_WRITE VCP0 SUCCESS Length 3: ...
Any ideas?
I noticed the LCDC did an IOCTL_SERIAL_PURGE right before writing, but my program does this on disconnection - and then it still doesn't work after reconnecting (so I'm assuming that it's not to do with this purge).
If I run my program again after LCDC, it reads exactly the same except for:
26 0.00294954 MatOrbOfficialT IOCTL_SERIAL_SET_HANDFLOW VCP0 SUCCESS Shake:0 Replace:0 XonLimit:1024 XoffLimit:1024
Where is says Replace:0 used to read Replace:40, is this significant?
As far as I can tell... all other values set by LCDC are reset by my program after I run it, so surely it should make no difference that some values are different? Given that my program does write successfully... Only after LCDC has done it's business!
Thanks again,
Duncan.