• 【二次开发】串口DLL


    代码
    /*
    ---------------------------------------------------------------
    文件名称:SmartMComDll.h
    说 明:声明串口DLL函数
    作 者:温子祺
    创建时间:2010-08-06
    联系方式:wenziqi@hotmail.com
    博 客:
    http://www.cnblogs.com/wenziqi/
    小 组:
    http://group.ednchina.com/2748/
    官 网:www.smartmcu.com
    ---------------------------------------------------------------
    */
    #ifdef SMARTMCOMDLL_EXPORTS
    #define SMARTMCOMDLL_API __declspec(dllexport)
    #else
    #define SMARTMCOMDLL_API __declspec(dllimport)
    #endif


    #ifdef __cplusplus
    extern "C" {
    #endif
    /*****************************************************
    *函数名称:Init
    *输 入:portnr 端口号
    baud 波特率
    parity 校验方式
    databits 数据位
    stopbits 停止位
    *输 出:TRUE/FALSE
    *功 能:初始化串口

    *示 例:
    BOOL b=Init(1,9600,NOPARITY,8,ONESTOPBIT);
    *****************************************************
    */
    SMARTMCOMDLL_API
    extern BOOL Init(UINT portnr,
    UINT baud,
    UINT parity,
    UINT databits,
    UINT stopbits);

    /*****************************************************
    *函数名称:Close
    *输 入:无
    *输 出:TRUE/FALSE
    *功 能:关闭串口
    *示 例:
    BOOL b=Close();
    *****************************************************
    */
    SMARTMCOMDLL_API
    extern BOOL Close(void);
    /*****************************************************
    *函数名称:Send
    *输 入:pSendBytes 发送数据缓冲区
    unSendLength 发送数据长度
    *输 出:成功发送的字节数
    *功 能:串口发送数据
    *示 例:
    UINT8 buf[3]={0x01,0x02,0x03}
    UINT b=Send(buf,3);
    *****************************************************
    */
    SMARTMCOMDLL_API
    extern UINT Send(UCHAR *pSendBytes,UINT unSendLength);
    /*****************************************************
    *函数名称:Recv
    *输 入:pRecvBytes 接收数据缓冲区
    unRecvLength 接收数据长度
    *输 出:成功接收的字节数
    *功 能:串口接收数据
    *示 例:
    UINT8 buf[3];
    UINT b=Recv(buf,3);
    *****************************************************
    */
    SMARTMCOMDLL_API
    extern UINT Recv(UCHAR *pRecvBytes,UINT unRecvLength);


    #ifdef __cplusplus
    }
    #endif

    (请复制整个下载地址到迅雷、快车、QQ旋风进行下载)

    下载地址:https://files.cnblogs.com/wenziqi/SmartMComDll.rar

  • 相关阅读:
    导航栏下拉至一定高度后固定在顶部的特效
    laravel表单中文错误提示本地化
    laravel模板使用
    网站测试用例
    sublime安装ctags用于追踪函数
    ecshop头部添加所在城市
    php 常用的redis操作语法
    mysql where与 having的区别
    mysql 列类型以及属性特点
    不错的博客链接
  • 原文地址:https://www.cnblogs.com/wenziqi/p/1794606.html
Copyright © 2020-2023  润新知