我有一台使用此代码打印良好的 epson 售票机 -->
static SerialPort _serialPort = new SerialPort("COM10", 38400, Parity.None, 8, StopBits.One);
static void Main(string[] args)
{
_serialPort.DtrEnable = true;
_serialPort.Handshake = Handshake.None;
Byte[] cashDrawerCmd = { 27, 112, 0, 25, 250 };
try
{
if (!(_serialPort.IsOpen))
_serialPort.Open();
_serialPort.WriteLine(" ");
_serialPort.WriteLine("*********Prueba*********** ");
_serialPort.WriteLine("*********************** ");
/* _serialPort.WriteLine(" " + GetLogo()); */
_serialPort.WriteLine("Prueba \r\n");
_serialPort.Write(cashDrawerCmd, 0, cashDrawerCmd.Length);
//is not working thiscode for open drawer
OpenDrawer(); //is not working this function neither
Console.ReadLine();
}
catch (Exception ex)
{
Console.WriteLine("Error opening/writing to serial port :: " + ex.Message, "Error!");
}
}
public static void OpenDrawer()
{
_serialPort.Write(char.ConvertFromUtf32(27) +
char.ConvertFromUtf32(112) +
char.ConvertFromUtf32(0) +
char.ConvertFromUtf32(5) +
char.ConvertFromUtf32(250));
}
我想打开抽屉机,但没有打开。我已经查找了信息,并且在大多数文档中都说默认命令是 --> 27, 112, 0, 25, 250 ,但它在我的控制台应用程序中不起作用。如果您查看上面的代码,我已经尝试过两种方式,但两者都不起作用。我希望有人可以在这里帮助我。谢谢你。