1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

simulink UART出力

Last updated at Posted at 2023-02-23

 matlabのsimulinkの環境で、シリアル(UART)で信号を出力する実験です。matlabはR2022bです。

UARTボードを用意

 アマゾンで、KKHMF 3個 CP2102モジュール マイクロ USB転UART TTL 6ピン シリアル コンバーターを入手します。筆者が購入したときは2個セットでした。
 PCとUSBケーブルで接続します。
ファイル名

 RXIとTXDをオシロスコープのプローブに接続します。

simulinkの設定

 Instrument Control ToolboxのSerial ConfigurationとSerial Sendをドラッグします。入力用に定数もドラッグして接続します。

sim201.png

 それぞれの設定です。

 COM3ポートにボードがつながっています。9600ボー、8ビット、パリティなし、ストップ・ビットは1に設定しました。
 
sim202.png

 ヘッダーは0xf0、ターミネータは0x55にして、オシロスコープで見たときにわかるようにしました。
sim203.png

 2バイトのデータを送ります。
sim204.png

オシロスコープで見る

 リトル・エンディアンで0x02が送られていることが確認できました。

sim102.png

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?