Setting Up a Wi-Fi TCP/IP Connection with Connected IO in Simulink
Perform these steps to set up and configure Wi-Fi® TCP/IP connection with Connected IO in your Simulink® model.
Open a Simulink Simulink model.
Insert a WiFi TCP/IP Send block and establish a connection with a Constant block.
Double-click the WiFi TCP/IP Send block to open the Block Parameters dialog. Modify the default Local IP Port setting (25000) to your preferred value.
In the Simulink model, on the Modeling tab, click Model Settings to open the Configuration Parameters dialog box.
In the Configuration Parameters dialog box, select the appropriate hardware from the
Hardware Board
drop-down list, such as Arduino MKR WiFi 1010.Navigate to Target hardware resources > WiFi properties and configure the Wi-Fi properties by specifying the SSID and Wi-Fi encryption settings according to your network requirements.
On the Hardware tab of the Simulink model, navigate to the Mode section. Select Connected IO and initiate the simulation by clicking Run with IO.
Check the diagnostic viewer to view the IP address assigned to the target.
These steps ensure the correct setup and configuration for using Wi-Fi TCP/IP communication in your Simulink model.
Run the host model to receive data from the target model
Open a new Simulink model.
Add a TCP/IP Receive block and connect it to a Display block.
Double-click the TCP/IP Receive block. Ensure that the IP address is same as the IP address displayed in the diagnostic viewer of Connected IO mode. Also, the port must be same as the value specified in the WiFi TCP/IP block.
In the Simulation tab of the Simulink model, click Run. Observe the Scope to confirm that the target hardware is successfully transmitting the data, which includes a ramp signal and a pulse.