in reply to serial port control on Windows

What do you get from the mode comN: command after you've configured it?

require 5.003; use Win32::SerialPort qw( :STAT 0.19 ); use strict; my $line; my $deck = openSerial("com3:", 19200, 'none', 8, 1); # $deck->handshake("xon"); # $deck->buffers(4096,4096); print `mode com3:`; ...

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

Replies are listed 'Best First'.
Re^2: serial port control on Windows
by hydrodog (Novice) on Apr 23, 2008 at 18:58 UTC

    Wow, that was interesting.

    First of all, thanks for the mode command, I forgot that even existed.

    When I click into device manager, it tells me the USB to serial port converter is on COM3. It also told me the baud rate was 9600. I manually changed it to 19200. I got out of device manager in case it might be interfering.

    mode COM3: before opening the device gives me a baud rate of 1200, n, 7, 1. So much for my setting the port to 19200 in the device manager. When the code opens the port, mode says the device is not available. So at least perl grabbed the right device, but I can't tell what the settings are.

      When the code opens the port, mode says the device is not available. So at least perl grabbed the right device, but I can't tell what the settings are.

      Did you try setting the port then closing it before using the mode command? They (usually) retain the last set of settings until something changes them.

      Another old technique for setting up serial ports initially is to do everything from the command line:

      mode com3: ... copy con com3: type whatever the device is expecting here ^Z ## see what response you get copy com3: con

      If you need to send or receive binary , then judicious use of /b on the copy commands may be in order--though it is a pain entering Alt-nnn, Alt-nnn.

      Also, if the device doesn't respond then you will probably have to kill cmd.exe from the task manager to get control back.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.