Difference between revisions of "Common xPC Blocks"
m |
m |
||
Line 2: | Line 2: | ||
The xPC blocks are found by opening up simulink and expanding the "xPC Target" menu to the left. It looks like this: |
The xPC blocks are found by opening up simulink and expanding the "xPC Target" menu to the left. It looks like this: |
||
[[image:xpcblocks00. |
[[image:xpcblocks00.jpg|thumb|center|300px]] |
||
Below you will find a list of commonly used blocks and those used specifically with the Sensoray 526 data aquisition board. The pictures will show how they could be used in common applications. |
Below you will find a list of commonly used blocks and those used specifically with the Sensoray 526 data aquisition board. The pictures will show how they could be used in common applications. |
||
<ul><li><h3>xPC Target \ Misc. \ Scope (xPC)</h3> |
<ul><li><h3>xPC Target \ Misc. \ Scope (xPC)</h3> |
||
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> |
|||
<table><tr> |
<table><tr> |
||
<td> |
<td>[[image:xpcblocks01.jpg|thumb|center|300px]]</td> |
||
<td> |
<td>[[image:xpcblocks01b.jpg|thumb|center|300px]]</td> |
||
</tr></table> |
</tr></table> |
||
</li> |
|||
<li><h3>xPC Target \ D/A \ Sensoray \ Sensoray526 DA</h3> |
<li><h3>xPC Target \ D/A \ Sensoray \ Sensoray526 DA</h3> |
||
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. |
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> |
|||
<table><tr> |
<table><tr> |
||
<td> |
<td>[[image:xpcblocks02.jpg|thumb|center|300px]]</td> |
||
<td> |
<td>[[image:xpcblocks03.jpg|thumb|center|300px]]</td> |
||
</tr></table> |
</tr></table> |
||
</li> |
|||
<li><h3>xPC Target \ A/D \ Sensoray \ Sensoray526 AD 1</h3> |
<li><h3>xPC Target \ A/D \ Sensoray \ Sensoray526 AD 1</h3> |
||
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. |
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> |
|||
<table><tr> |
<table><tr> |
||
<td> |
<td>[[image:xpcblocks04.jpg|thumb|center|300px]]</td> |
||
<td> |
<td>[[image:xpcblocks05.jpg|thumb|center|300px]]</td> |
||
</tr></table> |
</tr></table> |
||
</li> |
|||
<li><h3>xPC Target \ Digital Input \ Sensoray \ Sensoray526 DI</h3> |
<li><h3>xPC Target \ Digital Input \ Sensoray \ Sensoray526 DI</h3> |
||
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. |
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> |
|||
<table><tr> |
<table><tr> |
||
<td> |
<td>[[image:xpcblocks06.jpg|thumb|center|300px]]</td> |
||
<td> |
<td>[[image:xpcblocks07.jpg|thumb|center|300px]]</td> |
||
</tr></table> |
</tr></table> |
||
</li> |
|||
<li><h3>xPC Target \ Digital Output \ Sensoray \ Sensoray526 DO</h3> |
<li><h3>xPC Target \ Digital Output \ Sensoray \ Sensoray526 DO</h3> |
||
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> |
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> |
|||
<table><tr> |
<table><tr> |
||
<td> |
<td>[[image:xpcblocks08.jpg|thumb|center|300px]]</td> |
||
<td> |
<td>[[image:xpcblocks09.jpg|thumb|center|300px]]</td> |
||
</tr></table> |
</tr></table> |
||
</li> |
|||
<li><h3>xPC Target \ Incremental Encoder \ Sensoray \ Sensoray526 ENC</h3> |
<li><h3>xPC Target \ Incremental Encoder \ Sensoray \ Sensoray526 ENC</h3> |
||
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. |
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> |
|||
<table><tr> |
<table><tr> |
||
<td> |
<td>[[image:xpcblocks10.jpg|thumb|center|300px]]</td> |
||
<td> |
<td>[[image:xpcblocks11.jpg|thumb|center|300px]]</td> |
||
</tr></table> |
</tr></table> |
||
</li> |
|||
<li><h3>Simulink \ Signal Routing \ Data Store (Memory, Read, Write)</h3> |
<li><h3>Simulink \ Signal Routing \ Data Store (Memory, Read, Write)</h3> |
||
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. |
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> |
|||
<table><tr> |
<table><tr> |
||
<td> |
<td>[[image:xpcblocks12.jpg|thumb|center|300px]]</td> |
||
<td> |
<td>[[image:xpcblocks13.jpg|thumb|center|300px]]</td> |
||
</tr><tr> |
</tr><tr> |
||
<td> |
<td>[[image:xpcblocks14.jpg|thumb|center|300px]]</td> |
||
<td> |
<td>[[image:xpcblocks15.jpg|thumb|center|300px]]</td> |
||
</tr></table> |
</tr></table> |
||
</li> |
|||
<li><h3>Simulink \ Sinks \ Out1</h3> |
<li><h3>Simulink \ Sinks \ Out1</h3> |
||
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. |
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> |
|||
[[image:xpcblocks16.jpg|thumb|center|300px]]</a> |
|||
</li> |
|||
</ul> |
</ul> |
Revision as of 12:13, 18 May 2006
The xPC blocks are found by opening up simulink and expanding the "xPC Target" menu to the left. It looks like this:
Below you will find a list of commonly used blocks and those used specifically with the Sensoray 526 data aquisition board. The pictures will show how they could be used in common applications.
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).
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.
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.
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.
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)
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.
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.
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>