I've been trying to interface with a scanner connected via USB on a virtual com port in order to trigger it with a serial command. I am restricted to using Powershell due to the nature of the environment (work computer, no access to other applications or even allowed to run.ps1 scripts). I am able to create/open a port, set some parameters and receive data from the scanner however it seems like no matter what command I send via $port.Write(command), nothing ever happens. I do have the right COM port, the right matching baud rates. According to the user guide the command to trigger is SYNTCR or 0x16 0x54 0x0d, but I just cannot figure out how to correctly format it. So far this is what I type into the console:
$port = New-Object System.IO.Ports.SerialPort COM3, 38400, None, 8, one
$port.DTREnable = $True
$port.RTSEnable = $True
$port.Open()
$port.Write(command)
$port.ReadExisting()
$port.Close()
I've tried all the following combinations of commands to send to the port with no success:
Here's an image showing more information regarding the $port from Powershell: https://i.sstatic.net/3Aje4.png
To send the three bytes 0x16 0x54 0x0d try sending:
[char]22+[char]84+[char]13