| Contents | Index |
| On this page… |
|---|
Interleaving Analog Input and Analog Output Blocks Using Multiple Boards for Simultaneous Analog to Digital Conversion |
The PMC-ADADIO board is an analog I/O PCI mezzanine card (PMC) device that can be used for a number of applications, such as data acquisition and process monitoring.
The xPC Target block library supports this board with A/D and D/A driver blocks. The following xPC Target driver blocks control the A/D functionality of the PMC-ADADIO board:
The following xPC Target driver blocks control the D/A functionality of the PMC-ADADIO board:
The use of these drivers differ slightly from other boards. Of particular note are the Boolean enable ports (labelled E) that most of the A/D and D/A blocks have for input and/or output. These enable ports perform the following:
Control block action. If the value of the input enable port is true, the block executes. If the value is false, the block does not execute. Most blocks also have output enable ports. The output enable port has the same value as the input enable port. This allows the control block action value to be passed to successive blocks.
Execute A/D and/or D/A blocks in the correct order. For example, the A/D Start block starts the analog to digital conversion of the channels selected by the A/D Read block. This block must finish its operation before the A/D Read block can execute. If the A/D Read block executes first, the A/D Read block waits indefinitely for the A/D conversion to complete.
An input enable port can have an Enable Signal block connected to the port. The Enable Signal block generates an input enable signal for the A/D and D/A blocks. If you do not connect an Enable Signal block to the A/D or D/A block, the input enable port has a constant value of 1, or `true.'
A typical A/D block configuration for analog input operation connects the AD Start block and AD Read block. Because the A/D Start block can take several microseconds to perform the analog to digital conversion of the channels selected by the A/D Read block, you can perform other operations in the meantime. For example, you can insert a typical D/A block configuration between the AD Start and Read blocks. A typical configuration for analog output operation connects the DA Write and DA Update blocks.
This section describes how to use the PMC-Adadio blocks to create a model that interleaves the analog input and analog output operations.
A typical A/D block configuration for analog input operation connects the AD Start block and AD Read block. The AD Start block converts the data of the channels selected by the AD Read block.
In the MATLAB Command Window, type
xpclib
The xPC Target driver block library opens.
Double-click the A/D group block.
A window with blocks for A/D drivers opens.
Double-click the General Standards group block.
A window with blocks for General Standards opens.
Drag and drop an AD Start block from the General Standards window to the new model.
By default, this block should have the Enable input port and Enable output port check boxes selected.
Drag and drop an AD Read block from the General Standards window to the new model.
By default, this block has the Enable input port and Enable output port check boxes selected. Double-click the AD Read block and clear the Enable output port check box. Clearing this check box prohibits the block from passing the Boolean value from the input enable port to the output enable port.
Connect the AD Start block to the AD Read block.

Note the following:
No signal has been connected to the AD Start block's input enable port, E, so the port has a default value of `true'. Accordingly, the output enable port of the AD Start block and input enable port of the AD Read block also have a value of `true'.
Tip
|
Connecting the output enable port of the AD Start block to the input enable port of the AD Read block causes the AD Start block to execute before the AD Read block. The AD Start block initiates the A/D conversion. The Read block waits until the conversion has completed before putting the results on its output port.
From the File menu, select Save As. Browse to a writable directory and enter a unique model name, for example, AdadioADDA. Then click Save.
Your next task is to add a Create Enable Signal block to this model. See Adding Enable Signal Blocks to A/D Blocks.
The A/D and D/A series of blocks both have Create Enable Signal blocks.

You can use a Create Enable Signal block to generate an input enable signal for A/D and D/A blocks. You can connect a signal generator to the input of the Create Enable Signal block to control the output enable port. You can then connect the output E port of the Create Enable Signal block to the input E port of an A/D or D/A block.
This procedure assumes that you have a model named AdadioADDA (see Adding A/D Blocks to a Model for Analog Input). Add a Create Enable Signal block to generate an input enable signal for the AD Start block. If you have Ground or Terminator blocks, remove them as you make connections to the additional blocks.
If your model AdadioADDA is not already open, in the MATLAB Command Window, type
AdadioADDA
The model opens.
xpclib
The xPC Target library opens.
Double-click the A/D group block.
A window with blocks for A/D drivers opens.
Double-click the General Standards group block.
A window with blocks for General Standards opens.
Drag and drop a Create Enable Signal block from the General Standards window to the new model.
Double click the Create Enable Signal block and deselect the Show input port for thresholding signal of type double.
The Create Enable block has an output enable port, E, that can provide an input enable signal for any of the other PMC-ADADIO blocks. The Boolean value of this output enable port is controlled by an input port, S, and (optionally) an input port, L. When the S port is connected to the output of an arbitrary block B, the Create Enable Signal block executes immediately after block B executes. The L port is a level-sensitive thresholding port that allows an attached signal to control the Boolean value at the output enable port E.
Click Sources. The Sources pane displays the included blocks.
Connect the output port of the Sine Wave block to the input port S of the Create Enable Signal block.
Connecting the Sine Wave to the Create Enable Signal block triggers the sequence chain of the ADADIO blocks.
In the new model, connect the S port of the Create Enable Signal block to the Sine Wave block.
In the new model, connect the AD Start block E port to the Create Enable Signal E port.
The output enable port, E, of the Create Enable Signal block provides the first Boolean output to feed into the other ADADIO driver blocks.

Your next task is to set up the D/A blocks to provide the analog output for the analog input blocks.
A typical D/A block configuration for analog output operation connects the DA Write block and DA Update block. The DA Update block converts the data that the DA Write block puts out.
If the model AdadioADDA is not already open, in the MATLAB Command Window, type
AdadioADDA
The model opens.
xpclib
The xPC Target library opens.
Double-click the D/A group block.
A window with blocks for D/A drivers opens.
Double-click the General Standards group block.
A window with blocks for General Standards opens.
Drag and drop a DA Write block from the General Standards window to the new model.
Drag and drop a DA Update block from the General Standards window to the new model.
Connect the DA Update block to the DA Write block.

Note the following:
No signal has been connected to the DA Write block's input enable port, E, so the port has a default value of 'true'. Accordingly, the output enable port of the DA Write block and input enable port of the DA Update block also have a value of 'true'.
Connecting the output enable port of the DA Write block to the input enable port of the DA Update block causes the DA Write block to execute before the DA Update block. The DA Write block loads the PMC-ADADIO registers in preparation for the D/A conversion. The DA Update block waits until the loading has completed before initiating the D/A conversion. As with the AD Start and Read blocks, the DA Write and Update blocks do not need to be directly connected to each other. You can interleave other blocks if you want.
You can interleave the analog output blocks between the AD Start and AD Read blocks. Such a configuration allows the analog output block to perform concurrently with the A/D conversion by the AD Start block. To connect to the AD Start and AD Read blocks, the interleaving block(s) must have an input enable port and an output enable port. See Interleaving Analog Input and Analog Output Blocks.
After the AD Start block executes, the acquisition hardware becomes busy with the operation. If you have the AD Read block execute immediately, it will idle waiting for the hardware to finish the acquisition. Rather than allowing idle cycles, you can insert other blocks between the AD Start and AD Read block. You can insert
An atomic subsystem that has a pass through input for the enable signal from the AD Start to the AD Read blocks. This type of system enforces an execution order where the inserted subsystem executes between the other two blocks.
A pair of blocks that already have an enable port, such as DA Write and DA Update. Because the DA Write and DA Update blocks already have an enable port, you do not have to include them in another subsystem to execute them in the correct order. See the following enable line for the execution order:
AD Start enable out to DA Write enable in
DA Write enable out to DA Update enable in
DA Update enable out to AD Read enable in
This results in the time sequence: AD Start > DA Write > DA Update > AD Read. By the time AD Read executes, the hardware has either finished or is much closer to finishing. Less time is wasted than if you use no interleaving. Note that the data input to DA Write comes from another part of the model. Typically, it will be the value calculated from the AD Read from the previous time step.
The following procedure assumes that you have a model named AdadioADDA that has AD Start and Read blocks, an Enable Create Signal block, and DA Write and Update blocks:
If the model AdadioADDA is not already open, in the MATLAB Command Window, type
AdadioADDA
The model opens.
xpclib
The xPC Target library opens.
Disconnect the AD Start block from the AD Read block.
Perform this step to insert the intermediate DA blocks between the AD Start and Read blocks.
Connect the output E port of the AD Start block to the input E port of the DA Write block.
Connect the output port of the Sine Wave block to the input 1 port of the DA Write block.
Connect the output E port of the DA Write block to the input E port of the DA Update block.
Connect the output E port of the DA Update block to the input E port of the AD Read block.
At the xPC Target library, double-click the Misc group block
Drag and drop the Scope (xPC) block into the AdadioADDA model.
Connect the output E port of the AD Read block to the Scope (xPC) block.

You can build and run the model and download it to your target computer like any other xPC Target model.
The previous topics describe how to set up a model for up to eight channels performing simultaneous analog to digital conversion. You can increase the number of channels for this conversion by using two or more PMC-ADADIO boards, configured in a master/slave configuration.
In such a configuration, observe the following guidelines:
Decide how many slave PMC-ADADIO boards you want in your configuration.
Identify one PMC-ADADIO as the master board.
Create a model that uses the master PMC-ADADIO board. This model must contain an A/D Start block for the master board.
For each PMC-ADADIO board in your system, including the master and all slave boards, the model must contain an associated A/D Read block.
Connect the Enable output port (E) of the A/D Start block of the master board to the Enable input port (E) of each of the slave A/D Read blocks. You can do this in one of the following ways. Note that the order in which the A/D Read blocks are connected is irrelevant.
Directly connect the Enable output port (E) of the A/D Start block to the Enable input port (E) of each of the slave A/D Read blocks.
Directly connect the Enable output port (E) of the A/D Start block to the Enable input port (E) of the first slave A/D Read block, then create a daisy chain of slave Enable input to Enable output ports for the slave A/D Read blocks. For example

Connect pin4 of the P5B connector (INPUT TRIGGER READY signal) of the master board to pin 2 of the P5B connector (INPUT TRIGGER signal) of all the slave boards. For example

Note The pulse of the master board INPUT TRIGGER READY output occurs 250 nanoseconds after the software trigger in the A/D Start block. This results in a 250 nanosecond delay, relative to the master board, for the slave boards, but should still be considered simultaneous in most situations. |
![]() | General Standards | Overview of Audio Applications | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |