Windows will twiddle the serial ports on bootup and there's nothing you can do about it. It's loading drivers and probing for attached devices.
I've also seen it occasionally poke serial ports if nothing else has it open. Probably trying to auto-discover something or other.
You might be able to come up with some sort of latch based on signal combinations that windows doesn't use, or delay circuits to try and not make changes during a windows transient event, but I wouldn't go that route, as windows is a large "black box" that you do not have sufficient control over to guarantee ongoing success. What if windows updates a driver which applies different signal patterns or has different delay times during assertion of various signals.
The only to make this work reliably is to use something that can interpret unique strings of serial data to perform commanded functions. Additional advantages to this approach:
- You can implement/move extra functionality into the dedicated device. This could be things like automatic timers, monitoring etc.
- You can maintain function when the PC is crashed/rebooting/off
You mention controlling a 50A power supply ... how safety or otherwise critical is this operation? Arduino is fine for quick and dirty one-of's, but you have to keep in mind that there's a lot of code that comes along with it that you don't have control of (or know the quality of). If it's a critical function, I'd probably use an STM32 "blue pill" running my own "bare metal" code, where I can implement watchdogs and other safeguards to control exactly what it does in a failure situation. These can be purchased on eBay/Ali for only a couple of dollars. That being said, you are coming from direct windows control, so almost anything would be an improvement.
The "SimpleTimer" you attached contains only a .EXE (which is not a DOS program btw, it's win32). I don't run random EXEs from the internet, but looking inside it I see a few hints as to what it does in the strings contained within. It looks it remains active (running) and turns the DTR and RTS lines ON/OFF in a com port at specified times... Is this correct? Is this a program you wrote, or are you only using off-the shelf bits? ... how tolerant is your PC side of changing to use something different for this function?
With a simple "blue pill" (or Arduino) device, you could move the job of maintaining the timer off of the PC, which means you would only have to set it up once and it would run independently of the PC until you told it otherwise. You would need a little program on the PC to send the setup command to the device. All depends on how much development work you want to do.
Dave