V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Lynntox
V2EX  ›  C#

C#串口通信问题 求教

  •  
  •   Lynntox · 11 天前 · 557 次点击

    我使用 labview 写的是没有问题的,通过串口助手发送产品也有反应

    但是在使用 C#就没办法正常通讯

    首先 我确认了线是没问题的,串口属性是没问题的 9600-8-n-1

    byte[] command = new byte[] { 0xAA, 0x55, 0x12, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xEE };

    // 发送数据 serialPort.Write(command, 0, command.Length);

    就很奇怪

    2 条回复    2024-09-18 09:02:51 +08:00
    sunmker
        1
    sunmker  
       7 天前
    先打开串口,.open
    Lynntox
        2
    Lynntox  
    OP
       1 天前
    @sunmker 这个肯定是 open 了,写了两个 command ,第一条是没有问题的,第二条就无响应了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5849 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 02:12 · PVG 10:12 · LAX 19:12 · JFK 22:12
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.