Navigation

    全志在线开发者论坛

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • 在线文档
    • 社区主页

    V3s两个串口同时打开报错

    V Series
    全志v3s 串口
    4
    6
    1322
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      B18770205274 LV 2 last edited by xiaowenge

      f9580450bc5256e88bf62637d5e27af.png
      我想同时打开两个串口,为啥一直显示打开错误,这两个串口分别打开的时候都是没有问题的。
      d26ee447657a6dab721fc8b8b192d0d.png

      Z 1 Reply Last reply Reply Quote Share 0
      • Z
        zoipuus LV 5 @B18770205274 last edited by

        @b18770205274 send_fd怎么没有< 0

        B 1 Reply Last reply Reply Quote Share 0
        • B
          B18770205274 LV 2 @zoipuus last edited by

          @zoipuus send_fd || receive_fd < 0,里面不就包含了send_fd < 0

          KunYi 1 Reply Last reply Reply Quote Share 0
          • KunYi
            KunYi LV 8 @B18770205274 last edited by KunYi

            @b18770205274
            不是喔
            你的語法是 send_fd > 0 就會執行 printf("open error\n"); exit(EXIT_FAILURE);

            要 if ((send_fd < 0) || (receive_fd < 0))這樣才是你說的意思

            Z 1 Reply Last reply Reply Quote Share 0
            • X
              xajh233 LV 2 last edited by

              我是小白,想学v851s,想问一下你的sdk在哪下载的

              1 Reply Last reply Reply Quote Share 0
              • Z
                zoipuus LV 5 @KunYi last edited by

                @kunyi 在 v3s两个串口同时打开报错 中说:

                @b18770205274
                不是喔
                你的語法是 send_fd > 0 就會執行 printf("open error\n"); exit(EXIT_FAILURE);

                要 if ((send_fd < 0) || (receive_fd < 0))這樣才是你說的意思

                @B18770205274 就像Kunyi说的,if (send_fd || receive_fd < 0)相当于send_fd > 0或者receive_fd < 0就会执行里面的代码块,所以if (send_fd < 0 || receive_fd < 0)才是任意一个打开失败就执行里面的代码块

                1 Reply Last reply Reply Quote Share 0
                • Moved from 其它全志芯片讨论区 by  xiaowenge xiaowenge 
                • 1 / 1
                • First post
                  Last post

                Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号

                行为准则 | 用户协议 | 隐私权政策