c# - 在 c# 中从 epson tm t80 打开抽屉
问题描述
我有一台使用此代码打印良好的 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 ,但它在我的控制台应用程序中不起作用。如果您查看上面的代码,我已经尝试过两种方式,但两者都不起作用。我希望有人可以在这里帮助我。谢谢你。
解决方案
推荐阅读
- python-3.x - python aws botocore.response.streamingbody 到 json
- python - 是否可以在没有深拷贝的情况下用另一个数组的视图替换 numpy 数组的内容?
- php - Woocommerce 产品导出:使用函数 add_export_data( $value, $product ) 添加多个元字段
- performance - CreateJS CDN 性能问题
- javascript - 如何让这个函数返回图像?
- asp.net - 在asp.net c#中将字节转换为图像
- c# - Asp.Net Core 3.1 控制器方法未调用
- api - 如何在 azure api 管理服务中自动导入 API
- spring-boot - 从 javascript 访问 html 模板
- reactjs - Mixins 在 create-react-app 中不能与 dart-sass 一起使用