Difference between revisions of "UDP Communications between Target and Host PC"

From Mech
Jump to navigationJump to search
 
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
__TOC__

==Mathworks UDP Documentation==
Click here to read Mathworks's documentation on UDP communications in XPC Target:[http://www.mathworks.com/access/helpdesk/help/toolbox/xpc/io_ref/f10-6068.html UDP Documentation.]
Click here to read Mathworks's documentation on UDP communications in XPC Target:[http://www.mathworks.com/access/helpdesk/help/toolbox/xpc/io_ref/f10-6068.html UDP Documentation.]

==Sample UDP Models==
Sample Mathworks Models:[[Media:UDP_Mathworks_sample_models.zip|Mathworks UDP sample models.]]

===Quick and Dirty Data Logging Model===
Here is a crude and simple system that will use the Host PC to log data sent from the Target PC. Load udpsend.mdl onto the Target PC, and run udprec.mdl in Simulink on the Host PC. The target PC will send a timestamp and a 3-by-3 matrix of data; the host PC will receive this data, record the data into the workspace, and print it out in the MATLAB command prompt in real time.

Because you cannot make Simulink's time steps run in real time (it runs as fast as it can, which is usually much faster than the time step you specified in the model), you can't synchronize the target and host PCs. If you have your target PC send data slow enough, you should be able to get most of the data. This provided sample (tested on a 1.5GHz laptop computer) is reliable only if your target PC sends data every 0.5 seconds or slower.

Download the files here: [[Media:UDP_logging_sample.zip|UDP model.]]

Latest revision as of 22:49, 2 June 2006

Mathworks UDP Documentation

Click here to read Mathworks's documentation on UDP communications in XPC Target:UDP Documentation.

Sample UDP Models

Sample Mathworks Models:Mathworks UDP sample models.

Quick and Dirty Data Logging Model

Here is a crude and simple system that will use the Host PC to log data sent from the Target PC. Load udpsend.mdl onto the Target PC, and run udprec.mdl in Simulink on the Host PC. The target PC will send a timestamp and a 3-by-3 matrix of data; the host PC will receive this data, record the data into the workspace, and print it out in the MATLAB command prompt in real time.

Because you cannot make Simulink's time steps run in real time (it runs as fast as it can, which is usually much faster than the time step you specified in the model), you can't synchronize the target and host PCs. If you have your target PC send data slow enough, you should be able to get most of the data. This provided sample (tested on a 1.5GHz laptop computer) is reliable only if your target PC sends data every 0.5 seconds or slower.

Download the files here: UDP model.