halcon 与PLC串口通信解决方案
2016-03-29 22:39
337 查看
OpSystem := environment('OS')
if (OpSystem='Windows_NT') open_serial ('COM1', SerialHandle) else open_serial ('/dev/tty', SerialHandle) endif set_serial_param (SerialHandle, 9600, 8, 'none', 'none', 1, 1000, 'unchanged') write_serial (SerialHandle, ords('Hello world!\n\r')) while(1) read_serial (SerialHandle, 10, Data) if (|Data| > 0) Read := chrt(Data)
break endif
endwhile
1、main主函数直接调用串口相关函数,如打开串口,设定串口参数,读写串口;
2、while(1)循环 做数据收到 读取PLC发来的接受信息,终止程序。
相关文章推荐
- 90.高精度爬楼梯(未结题)
- Socket开发框架之数据加密及完整性检查
- HDU 5653 Bomber Man wants to bomb an Array. DP
- 探索软件工程道路上的我 IV (Θ∀Θ#)
- Dev Http Client(Chrome的HTTP插件)
- HBase--Coprocessor协处理器
- Android中ActionBar的使用
- HTTP深入浅出 http请求
- Lombok-极度精简Java代码的工具
- git
- 《Unity 游戏设计与实现 南梦宫一线程序员的开发实例》学习笔记01
- web前端开发怎么学习比较快
- Web开发者应该有哪些必备的技能?
- ThinkPHP学习笔记
- 03-29复利计算单元测试
- 快速排序及其java实现代码
- BootStrap[ day01 ]--2016.3.29
- Linux系统管理与维护的基本命令
- Mac Nginx
- 1、elasticsearch简介