zoukankan      html  css  js  c++  java
  • HALCON串口通讯程序

    串口通讯程序

     
    * 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)
     
  • 相关阅读:
    CSS属性值一览
    CSS属性一览
    CSS选择器一览
    HTML颜色编码
    游戏
    数据库系统概念
    关于总结
    章节测试
    我的博客皮肤
    Emeditor所有快捷键操作
  • 原文地址:https://www.cnblogs.com/wenluderen/p/4957964.html
Copyright © 2011-2022 走看看