Computer Hope

Microsoft => Microsoft Windows => Windows XP => Topic started by: Ruprecht on September 16, 2009, 03:23:02 PM

Title: How to write a one to a com port using a Windows batch file
Post by: Ruprecht on September 16, 2009, 03:23:02 PM
Does anybody know if there is a way to write a 1 (high) to a com port using a Windows (XP) batch file?
Title: Re: How to write a one to a com port using a Windows batch file
Post by: Geek-9pm on September 16, 2009, 03:54:00 PM
Maybe. But may I ask does it need to be limited to just a batch file that could be used on any omputer?
It is quite easy to do that in a compiled or interpreted language. 
Such as VBS or QBASIC.
Also, when you say "1", do you really mean a break or mark or space. Or do you want an ASCII one to be written once to the serial output.
What baud rate?
What about RTS and DSR lines?
Look over the documentation the MODE command.
http://www.computerhope.com/modehlp.htm
(See Serial port)
Please be more specific ans to what you intend and you will find lots of help thee.
Title: Re: How to write a one to a com port using a Windows batch file
Post by: Ruprecht on September 16, 2009, 04:13:47 PM
I just need a high on the serial port and it needs to stay high forever or unitl a zero is written or power is cycled. For my specific purpose it needs to be executed from a Windows XP batch file.

Thanks for your help!
Title: Re: How to write a one to a com port using a Windows batch file
Post by: Helpmeh on September 16, 2009, 04:29:23 PM
I just need a high on the serial port and it needs to stay high forever or unitl a zero is written or power is cycled. For my specific purpose it needs to be executed from a Windows XP batch file.

Thanks for your help!
And what is your specific purpose. Writing it in VBS will work on any computer. Batch is kinda limiting for this type of thing.
Title: Re: How to write a one to a com port using a Windows batch file
Post by: Geek-9pm on September 16, 2009, 04:51:27 PM
OK. I will suppose that you will wire the connector to use the output you need.
The three outputs are:
Tx Data
RTS
DTR
Here are links that show wires and the names of the signals.
http://www.arcelect.com/rs232.htm
http://airborn.com.au/serial/rs232.html
(You may already know all that, but it is here for others.)


On some PCs the BIOS will automatically set the serial ports to the normal state. In any case the mode command can be:
mode com1: baud=48 dtr=on rts=on

This turns on both RTS and DTR for the PC.

When the PC is turned off the lines will drop down to zero bolts.
But to make sure, the following could be used:

mode com1: baud=48 dtr=off rts=off

http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/mode.mspx?mfr=true

screen shot:
http://geek9pm.com/pix/mode_com.png