I have an old VB6 program that opens COM1 for serial port reading only; To initialize the COM1 serial port I do the following on Form_Load() event:
commStats.ComPort = 1
commStats.Settings = "9600,N,8,1"
commStats.InputMode = comInputModeText
commStats.InputLen = 0
commStats.PortOpen = True
I read the serial port on a timer event and parse the input buffer - the packet I receive is very simple; starts with an STX and ends with a ETX all the bytes between the STX and ETX are ASCII printable characters. The packet is not very big maybe 100 bytes at most.
I have been reading this packet for years on my ASUS XP laptop during development, debug, and testing without a problem. For the first time in about 2 years I went back to doing some testing of the program and started testing sending these packets to this program again. To my surprise I was getting errors parsing the packets and discovered that when the packet had 3 ASCII zeros in a row the third zero was not a zero but a degree symbol in my VB6 receive packet?
I thought it was the computer sending the data packets so I went into HyperTerminal on the receiving computer and used HyperTerminal to view the received packets but did not see the degree symbol in HyperTerminal. So I exited HyperTerminal and went back to my VB6 program and started the test over and the packet was correct no more degree symbols for every 3rd ASCII zero in the packet they were ASCII zeros.
Can anyone explain what might have happened - it appears to me that HyperTerminal changed some setting of the COM1 serial port that fixed the problem? I have been trying to recreate the problem so I know what the root cause was; I have a straight C program that uses the old Win32 API and DCB structure to modify the serial port settings and as yet I can not recreate the problem described above
Any ideas how that serial port got into a mode to do what was described above?
Here is what a received packet in VB6 looks likes now that it is arriving with no degree symbol:
"STX6C1505 3008019003008004004001003005005001005000023032004005003006000013004000HTaurasi, Diana 15F5ETX"
work your way over to the part of the packet above where you see 1005000023 - that 3rd ASCII zero after the 5 was a degree symbol and all other packets that had 3 ASCII zeros in a row the 3rd ASCII zero was converted to a degree symbol - in VB6 debug watcher when it was wrong as reported above initially it look like this:
100500°023
What I am trying to do is figure out how that happened?