Difference between revisions of "Common xPC Blocks"

From Mech
Jump to navigationJump to search
 
m
Line 2: Line 2:


<ul>
<ul>
<li><div class="cmd">xPC Target \ Misc. \ Scope (xPC)</div>
<li>xPC Target \ Misc. \ Scope (xPC)
<p>The target scopes are used to display data on the xPC screen. This requires the target PC to be connected to a monitor. These scopes can either plot data over time or display numerical values. Signals can be muxed to display on the same scope or multiple scopes can be used. The scope shown below will show two sin waves (one inverted).
The target scopes are used to display data on the xPC screen. This requires the target PC to be connected to a monitor. These scopes can either plot data over time or display numerical values. Signals can be muxed to display on the same scope or multiple scopes can be used. The scope shown below will show two sin waves (one inverted).

<center>
<center>
<table><tr>
<table><tr>
Line 10: Line 9:
<td><a href="pics/xpcblocks01b.JPG"><img src="pics/xpcblocks01b.JPG" border="0"></a></td>
<td><a href="pics/xpcblocks01b.JPG"><img src="pics/xpcblocks01b.JPG" border="0"></a></td>
</tr></table>
</tr></table>
</center>
</center></li>


<li>xPC Target \ D/A \ Sensoray \ Sensoray526 DA
<p>
This block is used to output analog signals on the Analog Out pins. You cannot mux signals to this block. You must specify which pins you are using in the Block Parameters and connect the individual signals, as shown below.
<li><div class="cmd">xPC Target \ D/A \ Sensoray \ Sensoray526 DA</div>
<p>This block is used to output analog signals on the Analog Out pins. You cannot mux signals to this block. You must specify which pins you are using in the Block Parameters and connect the individual signals, as shown below.
<center>
<center>
<table><tr>
<table><tr>
Line 20: Line 18:
<td><a href="pics/xpcblocks03.JPG"><img src="pics/xpcblocks03.JPG" border="0"></a></td>
<td><a href="pics/xpcblocks03.JPG"><img src="pics/xpcblocks03.JPG" border="0"></a></td>
</tr></table>
</tr></table>
</center>
</center></li>


<li>xPC Target \ A/D \ Sensoray \ Sensoray526 AD 1
<p>
This block is used to read values from the Analog-IN pins on the Sensoray board. The pins have to be individually specified, as shown below.
<li><div class="cmd">xPC Target \ A/D \ Sensoray \ Sensoray526 AD 1</div>
<p>This block is used to read values from the Analog-IN pins on the Sensoray board. The pins have to be individually specified, as shown below.
<center>
<center>
<table><tr>
<table><tr>
Line 30: Line 27:
<td><a href="pics/xpcblocks05.JPG"><img src="pics/xpcblocks05.JPG" border="0"></a></td>
<td><a href="pics/xpcblocks05.JPG"><img src="pics/xpcblocks05.JPG" border="0"></a></td>
</tr></table>
</tr></table>
</center>
</center></li>


<li>xPC Target \ Digital Input \ Sensoray \ Sensoray526 DI
<p>
This block returns High (1) or Low (0) depending on the status of the defined pins. The block below shows how port one enabling the display of pin 2 on a Target Scope.
<li><div class="cmd">xPC Target \ Digital Input \ Sensoray \ Sensoray526 DI</div>
<p>This block returns High (1) or Low (0) depending on the status of the defined pins. The block below shows how port one enabling the display of pin 2 on a Target Scope.
<center>
<center>

<table><tr>
<table><tr>
<td><a href="pics/xpcblocks06.JPG"><img src="pics/xpcblocks06.JPG" border="0"></a></td>
<td><a href="pics/xpcblocks06.JPG"><img src="pics/xpcblocks06.JPG" border="0"></a></td>
<td><a href="pics/xpcblocks07.JPG"><img src="pics/xpcblocks07.JPG" border="0"></a></td>
<td><a href="pics/xpcblocks07.JPG"><img src="pics/xpcblocks07.JPG" border="0"></a></td>
</tr></table>
</tr></table>
</center>
</center></li>



<li>xPC Target \ Digital Output \ Sensoray \ Sensoray526 DO
<p>
This block outputs High (1) or Low (0) to the defined Digital Out pins. You must specify the initial values and reset values of these pins. <b>NOTE: If you are using the BoB, you will need to set the initial and reset values to 1's because the pins are inverted (refer to the hardware documentation)</b>
<li><div class="cmd">xPC Target \ Digital Output \ Sensoray \ Sensoray526 DO</div>
<p>This block outputs High (1) or Low (0) to the defined Digital Out pins. You must specify the initial values and reset values of these pins. <b>NOTE: If you are using the BoB, you will need to set the initial and reset values to 1's because the pins are inverted (refer to the hardware documentation)</b>
<center>
<center>
<table><tr>
<table><tr>
Line 51: Line 46:
<td><a href="pics/xpcblocks09.JPG"><img src="pics/xpcblocks09.JPG" border="0"></a></td>
<td><a href="pics/xpcblocks09.JPG"><img src="pics/xpcblocks09.JPG" border="0"></a></td>
</tr></table>
</tr></table>
</center></li>


<li>xPC Target \ Incremental Encoder \ Sensoray \ Sensoray526 ENC
</center>
This block outputs the counts from an incremental encoder. The encoder starts counting from a specified value (usually zero). You have to use a separate block for each encoder, specifying the channel for each.

<p>
<li><div class="cmd">xPC Target \ Incremental Encoder \ Sensoray \ Sensoray526 ENC</div>
<p>This block outputs the counts from an incremental encoder. The encoder starts counting from a specified value (usually zero). You have to use a separate block for each encoder, specifying the channel for each.
<center>
<center>
<table><tr>
<table><tr>
Line 62: Line 55:
<td><a href="pics/xpcblocks11.JPG"><img src="pics/xpcblocks11.JPG" border="0"></a></td>
<td><a href="pics/xpcblocks11.JPG"><img src="pics/xpcblocks11.JPG" border="0"></a></td>
</tr></table>
</tr></table>
</center>
</center></li>


<p>
<li><div class="cmd">Simulink \ Signal Routing \ Data Store (Memory, Read, Write)</div>
<p>These blocks are used to store values in local memory during execution. This is especially useful for storing states over each timestep, such as position or heading. You must use the Data Store Memory block to define a variable name and reserve a place for it in the memory. You can then change the value using the Data Store Write block and read the value back using the Data Store Read block. For the Read/Write blocks, you must edit the Parameters to specify the name of the variable. The model below will create a variable called "A" and will add 1 to it (starts from zero) each timestep.


<li>Simulink \ Signal Routing \ Data Store (Memory, Read, Write)
These blocks are used to store values in local memory during execution. This is especially useful for storing states over each timestep, such as position or heading. You must use the Data Store Memory block to define a variable name and reserve a place for it in the memory. You can then change the value using the Data Store Write block and read the value back using the Data Store Read block. For the Read/Write blocks, you must edit the Parameters to specify the name of the variable. The model below will create a variable called "A" and will add 1 to it (starts from zero) each timestep.
<center>
<center>
<table><tr>
<table><tr>
Line 76: Line 68:
<td><a href="pics/xpcblocks15.JPG"><img src="pics/xpcblocks15.JPG" border="0"></a></td>
<td><a href="pics/xpcblocks15.JPG"><img src="pics/xpcblocks15.JPG" border="0"></a></td>
</tr></table>
</tr></table>
</center>
</center></li>


<li>Simulink \ Sinks \ Out1
<p>
You can use this block in an xPC model to record data. This data is available after execution has finished by reading tg.OutputLog. You can mux signals into this block and tg.OutputLog will be a matrix instead of an array.
<li><div class="cmd">Simulink \ Sinks \ Out1</div>
<p>You can use this block in an xPC model to record data. This data is available after execution has finished by reading tg.OutputLog. You can mux signals into this block and tg.OutputLog will be a matrix instead of an array.
<center>
<center>
<a href="pics/xpcblocks16.JPG"><img src="pics/xpcblocks16.JPG" border="0"></a>
<a href="pics/xpcblocks16.JPG"><img src="pics/xpcblocks16.JPG" border="0"></a>
</center>
</center></li>

</ul>
</ul>

Revision as of 13:03, 18 May 2006

Common Blocks

  • xPC Target \ Misc. \ Scope (xPC) The target scopes are used to display data on the xPC screen. This requires the target PC to be connected to a monitor. These scopes can either plot data over time or display numerical values. Signals can be muxed to display on the same scope or multiple scopes can be used. The scope shown below will show two sin waves (one inverted).
    <a href="pics/xpcblocks01.JPG"><img src="pics/xpcblocks01.JPG" border="0"></a> <a href="pics/xpcblocks01b.JPG"><img src="pics/xpcblocks01b.JPG" border="0"></a>
  • xPC Target \ D/A \ Sensoray \ Sensoray526 DA This block is used to output analog signals on the Analog Out pins. You cannot mux signals to this block. You must specify which pins you are using in the Block Parameters and connect the individual signals, as shown below.
    <a href="pics/xpcblocks02.JPG"><img src="pics/xpcblocks02.JPG" border="0"></a> <a href="pics/xpcblocks03.JPG"><img src="pics/xpcblocks03.JPG" border="0"></a>
  • xPC Target \ A/D \ Sensoray \ Sensoray526 AD 1 This block is used to read values from the Analog-IN pins on the Sensoray board. The pins have to be individually specified, as shown below.
    <a href="pics/xpcblocks04.JPG"><img src="pics/xpcblocks04.JPG" border="0"></a> <a href="pics/xpcblocks05.JPG"><img src="pics/xpcblocks05.JPG" border="0"></a>
  • xPC Target \ Digital Input \ Sensoray \ Sensoray526 DI This block returns High (1) or Low (0) depending on the status of the defined pins. The block below shows how port one enabling the display of pin 2 on a Target Scope.
    <a href="pics/xpcblocks06.JPG"><img src="pics/xpcblocks06.JPG" border="0"></a> <a href="pics/xpcblocks07.JPG"><img src="pics/xpcblocks07.JPG" border="0"></a>

  • xPC Target \ Digital Output \ Sensoray \ Sensoray526 DO This block outputs High (1) or Low (0) to the defined Digital Out pins. You must specify the initial values and reset values of these pins. NOTE: If you are using the BoB, you will need to set the initial and reset values to 1's because the pins are inverted (refer to the hardware documentation)
    <a href="pics/xpcblocks08.JPG"><img src="pics/xpcblocks08.JPG" border="0"></a> <a href="pics/xpcblocks09.JPG"><img src="pics/xpcblocks09.JPG" border="0"></a>
  • xPC Target \ Incremental Encoder \ Sensoray \ Sensoray526 ENC This block outputs the counts from an incremental encoder. The encoder starts counting from a specified value (usually zero). You have to use a separate block for each encoder, specifying the channel for each.
    <a href="pics/xpcblocks10.JPG"><img src="pics/xpcblocks10.JPG" border="0"></a> <a href="pics/xpcblocks11.JPG"><img src="pics/xpcblocks11.JPG" border="0"></a>

  • Simulink \ Signal Routing \ Data Store (Memory, Read, Write) These blocks are used to store values in local memory during execution. This is especially useful for storing states over each timestep, such as position or heading. You must use the Data Store Memory block to define a variable name and reserve a place for it in the memory. You can then change the value using the Data Store Write block and read the value back using the Data Store Read block. For the Read/Write blocks, you must edit the Parameters to specify the name of the variable. The model below will create a variable called "A" and will add 1 to it (starts from zero) each timestep.
    <a href="pics/xpcblocks12.JPG"><img src="pics/xpcblocks12.JPG" border="0"></a> <a href="pics/xpcblocks13.JPG"><img src="pics/xpcblocks13.JPG" border="0"></a>
    <a href="pics/xpcblocks14.JPG"><img src="pics/xpcblocks14.JPG" border="0"></a> <a href="pics/xpcblocks15.JPG"><img src="pics/xpcblocks15.JPG" border="0"></a>
  • Simulink \ Sinks \ Out1 You can use this block in an xPC model to record data. This data is available after execution has finished by reading tg.OutputLog. You can mux signals into this block and tg.OutputLog will be a matrix instead of an array.

    <a href="pics/xpcblocks16.JPG"><img src="pics/xpcblocks16.JPG" border="0"></a>