zoukankan      html  css  js  c++  java
  • 串口编程初步



    1.同步查询方式
            CreateFile( lpFileName,                                   //串口号                              %%%
                         dwDesiredAccess,                            //GENERIC_READ|GENERIC_WRITE
                         dwSharedMode,                               //0 不允许共享
                         lpSecurityAttributes,                        //NULL
                         dwCreationDisposition,                     //OPEN_EXISTING
                         dwFlagsAndAttributes,                     //FILE_ATTRIBUTE_NORMAL   %%%
                                                                              //FILE_FLAG_OVERLAPPED     %%%重叠I/O方式时使用
                         hTemplateFile)                                 //NULL

                  SetupComm          //设置输入输出缓存大小

                  GetCommState      //获得一DCB结构
      
                  SetCommState

          ReadFile                                                                               TimeProc(hwnd,uMsg,idEvent,uElapse,lpTimerFunc)

         WriteFile                                                                                SetTimer
         
         CloseHandle                                                                           KillTimer
    2.重叠I/O方式
         CreateThread
         
            ThreadProc

               CreateEvent
     
               WaitForSingleObject

               GetOverlappedResult

    3.事件驱动方式
               
              SetCommMask
     
              建立事件线程CreateThread
         
            ThreadProc

                 WaitCommEvent
                 WaitForSingleObject

                 ClearCommError

              
                                 

  • 相关阅读:
    getBoundingClientRect()方法
    Sublime Text3 安装less
    less知识点总结(一)
    跨域知识(二)——JSONP
    面向过程和面向对象的区别(转)
    暴力+DP:买卖股票的最佳时机
    车的可用捕获量(3.26leetcode每日打卡)
    三维形体的表面积(3.25leetcode每日打卡)
    基础练习:FJ的字符串
    DP:打家劫舍
  • 原文地址:https://www.cnblogs.com/westwind/p/1528903.html
Copyright © 2011-2022 走看看