如何更改串口的收发缓存的大小
17 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
我使用的serialport函数创建的串口,可以正常与外部设备建立连接
但是当我进行大批量的数据读取的时候发现报错了,错误提式大概是说读取的数据量要小于InputNuffSize的值
但是在查阅了serialport函数之后,并没有发现相关的函数可以修改输入输出缓存的值
相应的两个属性还都是只读的?
那请问该如何修改输入输出缓存呢
0 commentaires
Réponses (1)
Raghav
le 4 Avr 2023
Hi,
Based on your question, I can understand that you need to know about changing the buffer size of the serial port.
In MATLAB, earlier, the input-output buffer size for a serial port can be modified by user explicitly by using the properties 'InputBufferSize' and 'OutputBufferSize' of serial function. These properties used to control the size of the input and output buffers in bytes, respectively.
But now it is recommended to use the serialport function as in this ‘InputBufferSize’ & ‘OutputBufferSize’ are automatically managed and sized as needed.
To check the official documentation to transition your code to serialport interface, please visit the following link:
Note that the maximum buffer size that can be set depends on the operating system and the hardware capabilities of your computer. Setting a buffer size that is too large may result in memory allocation errors or other issues.
Thanks,
Raghav Bansal
0 commentaires
Voir également
Catégories
En savoir plus sur 串行端口设备 dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!