串口通讯程序

 
* Note: This example is meant to demonstrate the use of the serial interface
* of HALCON.  On Unix machines, the output and input is from /dev/tty, i.e., the
* window from which you have started HDevelop.  On Windows NT machines,
* this program will only run if you have a device attached to COM1.
* Open the serial interface (for reading and writing).
OpSystem := environment('OS')
if (OpSystem == 'Windows_NT')
    open_serial ('COM1', SerialHandle)
else
*     open_serial ('/dev/tty', SerialHandle)
endif
* Set the parameters of the serial interface (e.g., a character-based terminal).
set_serial_param (SerialHandle, 9600, 8, 'none', 'none', 1, 1000, 'unchanged')
* Display a nice message on the terminal.
write_serial (SerialHandle, ords('11,12,1'))
* Now read 10 characters from the terminal...
while(1)
read_serial (SerialHandle, 2, Data)
* ...and if the user typed some characters within the one second...
if (|Data| > 0)
    * ...convert the read data to a string.
    Read := chrt(Data)
    if(Read='A0')
        break
    endif
endif
wait_seconds (0.1)
endwhile
stop ()
* Finally, close the serial interface so other programs can use it.
close_serial (SerialHandle)
 

HALCON串口通讯程序的更多相关文章

  1. 用SPCOMM 在 Delphi中实现串口通讯 转

      用Delphi 实现串口通讯,常用的几种方法为:使用控件如MSCOMM和SPCOMM,使用API函数或者在Delphi 中调用其它串口通讯程序.利用API编写串口通信程序较为复杂,需要掌握大量通信 ...

  2. 浅析PC机串口通讯流控制

    转自浅析PC机串口通讯流控制 我们在串行通讯处理中,常常看到RTS/CTS和XON/XOFF这两个选项,这就是两个流控制的选项,目前流控制主要应用于调制解调器的数据通讯中,但对普通RS232编程,了解 ...

  3. Java利用Rxtx进行串口通讯

    最近在做传感器数据采集的工作,底层是基于Zigbee的无线传感网络,所有数据采集到Zigbee协调器上然后通知上位机数据采集完成,上位机通过USB转串口去读取数据就可以了.那么问题来了,如何进行串口通 ...

  4. C#中缓存的使用 ajax请求基于restFul的WebApi(post、get、delete、put) 让 .NET 更方便的导入导出 Excel .net core api +swagger(一个简单的入门demo 使用codefirst+mysql) C# 位运算详解 c# 交错数组 c# 数组协变 C# 添加Excel表单控件(Form Controls) C#串口通信程序

    C#中缓存的使用   缓存的概念及优缺点在这里就不多做介绍,主要介绍一下使用的方法. 1.在ASP.NET中页面缓存的使用方法简单,只需要在aspx页的顶部加上一句声明即可:  <%@ Outp ...

  5. C#串口通信程序实现无感知签到与答题

    最近公司项目上线,之前利用串口通讯实现校牌的无感知签到程序, 项目上线以后刚刚好有时间把之前的出现的问题做下记录,废话不多,直接到主题 串口介绍: 串行接口简称串口,也称串行通信接口或串行通讯接口(通 ...

  6. python实现串口通讯小程序(GUI界面)

    python实现串口通讯小程序(GUI界面) 使用python实现串口通讯需要使用python的pyserial库来实现,这个库在安装python的时候没有自动进行安装,需要自己进行安装. 1.安装p ...

  7. C#串口通讯实例

    本文参考<C#网络通信程序设计>(张晓明  编著) 程序界面如下图: 参数设置界面代码如下: using System; using System.Collections.Generic; ...

  8. C语言PIC32 serial bootloader和C#语言bootloader PC端串口通信程序

    了解更多关于bootloader 的C语言实现,请加我QQ: 1273623966 (验证信息请填 bootloader),欢迎咨询或定制bootloader(在线升级程序). 今天介绍下我新完成的为 ...

  9. C语言PIC16 serial bootloader和C#语言bootloader PC端串口通信程序

    了解更多关于bootloader 的C语言实现,请加我QQ: 1273623966 (验证信息请填 bootloader),欢迎咨询或定制bootloader(在线升级程序). 新PIC16 Boot ...

随机推荐

  1. JS侦测设备旋转方向

    window.onload = window.onresize = function initialLoad(){updateOrientation();} function updateOrient ...

  2. 关于Unity屏幕分辨率的比例

    1.Free Aspect任意窗口大小 2.16:9是1920*1080的手机 3.4:3是1024*768ipad 4.3:2是960*640,iPhone4手机屏幕 5.480*800,竖屏手机游 ...

  3. python中的字典 和 集合

    python中字典是一种key-value的数据类型 字典的特性: 1.无序的 2.key必须的唯一的,so,字典天生去重 语法: 增加 修改 删除 查找 多级字典嵌套及操作 字典的其他用法 #set ...

  4. android 全屏设置

    更改styles.xml文件 <!-- 去掉标题栏 --> <style name="AppTheme" parent="Theme.AppCompat ...

  5. 【BZOJ】1044: [HAOI2008]木棍分割(二分+dp)

    http://www.lydsy.com/JudgeOnline/problem.php?id=1044 如果只求最大的最小,,直接二分就行了...可是要求方案.. 好神! 我竟然想不到! 因为我们得 ...

  6. 【Debian】ftp安装

    http://www.2cto.com/os/201107/98311.html http://jingyan.baidu.com/article/adc815133476bdf723bf7393.h ...

  7. hdu 1520(简单树形dp)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1520 思路:dp[u][0]表示不取u的最大价值,dp[u][1]表示取u的最大价值,于是有dp[u] ...

  8. c#后台读写Cookie

    public class BaseCookies { #region Cookies public static void SetCookieValue(string key, string valu ...

  9. Jenkins publish over ssh 上传 文件夹 配置方式

    需要把编译后 目录下的 lib文件夹下的jar包都上传到服务器上 1.配置 2.完成截图 3.服务器截图 注意:  真实脚本 建议写 全路径 注意:多条命令时  添加 英文分号

  10. vim 命令重新安装

    author : headsen chendate: 2018-05-11 09:50:23 [root@localhost ~]# which vim /usr/bin/vim [root@loca ...