在liunx下读取串口的数据

1. 设置串口参数

首先是通过stty工具设置串口参数:

linux 复制代码
sudo stty -F /dev/ttyUSB0 比特率 cs8 -cstopb

如:sudo stty -F /dev/ttyUSB0 115200 cs8 -cstopb.

注意: 需要注意的是这里需要sudo权限;

2. 读取串口数据

然后读取串口的数据,存储到文档中:

linux 复制代码
sudo sh -c "cat /dev/ttyUSB0 > recorder.log" &

这样,串口的内容就保存在当前路径的recorder.log中,实时查看用以下命令:

linux 复制代码
tail -f recorder.log

参考:https://www.kancloud.cn/dlover/fpga/1858266

相关推荐
Js_cold1 天前
Verilog函数function
开发语言·fpga开发·verilog
Js_cold1 天前
Verilog任务task
开发语言·fpga开发·verilog
brave and determined1 天前
可编程逻辑器件学习(day3):FPGA设计方法、开发流程与基于FPGA的SOC设计详解
嵌入式硬件·fpga开发·soc·仿真·电路·时序·可编程逻辑器件
Lee_yayayayaya1 天前
锁相环技术及FPGA实现
fpga开发
Js_cold1 天前
Verilog局部参数localparam
开发语言·fpga开发·verilog
promising-w1 天前
【FPGA】使用移位实现LED流水灯
fpga开发
爱吃汽的小橘1 天前
ZYNQ介绍
fpga开发
ThreeYear_s2 天前
电力电子技术学习路径与FPGA/DSP技术结合方向(gemini生成)
学习·fpga开发
奋斗的牛马2 天前
FPGA—ZYNQ学习spi(六)
单片机·嵌入式硬件·学习·fpga开发·信息与通信
GateWorld2 天前
FPGA核心约束类型与语法
fpga开发