ASCII Encode
将 Simulink 值转换为 uint8 字符向量
库:
Simulink Real-Time /
RS232
描述
ASCII Encode 模块生成一个 uint8 输出向量,该向量包含基于类似 printf 格式字符串的 NULL 终止字符向量。数据来自输入端口。
有关详细信息,请参阅RS-232 串行通信和RS-232 Legacy Drivers。
示例
ASCII Encoding/Decoding Resync Loopback Test (with Baseboard Blocks)
Use the ability of the FIFO Read HDRS block to resynchronize after being repeatedly disabled and apply this ability to resolve errors such as when a message is only partially complete at the time the read is attempted.
Binary Encoding/Decoding Loopback Test (with Baseboard Blocks)
Send Binary data over a serial link.
Binary Encoding/Decoding Resync Loopback Test (with Baseboard Blocks)
Use the ability of the FIFO Read BINARY block to handle messages that are interrupted and only partially complete.
端口
输入
模块编码为空终止字符向量的值。
数据类型: double | int8 | uint8 | int16 | uint16 | int32 | uint32
输出
生成包含 NULL 终止字符向量的 uint8 输出向量。
参数
输入类似 printf 的格式字符串。对于每个格式指定符(如 %d),该模块会将格式指定符替换为对应输入变量中的转换值。格式指定符遵循 printf 的常规描述。
编程用法
模块参数:format |
每个端口的数值将按 Format string 中指定的格式插入输出字符向量。
编程用法
模块参数:nvars |
该模块为输出端口分配了足够的内存以支持此长度。在指定此长度时,请在字符向量中包含 NULL 终止符。
若转换后的字符向量超过此长度,该模块将返回错误且不会将该字符向量写入输出端口。
编程用法
模块参数:maxlength |
与 Number of variables 中指定元素数量相同的单元向量,可为每个输入端口指定不同的数据类型。单个元素被复制。例如:
nvars=3
{ } - 这三个输入都是双精度数值。
{'uint8'} - 这三个输入是 uint8。
{'uint16', 'double', 'uint8'} - 第一个输入是 uint16,第二个输入是 double,第三个输入是 uint8。
编程用法
模块参数:vartypes |
扩展功能
C/C++ 代码生成
使用 Simulink® Coder™ 生成 C 代码和 C++ 代码。
版本历史记录
在 R2020b 中推出
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)








