Real-Time Workshop |
 |
Configuring Device Driver Blocks
Each device driver block has a dialog box that you use to set configuration parameters. As with all Simulink blocks, double-clicking on the block displays the dialog box. Some of the device driver block parameters (such as Base I/O Address) are hardware specific and are set either at the factory or configured via DIP switches at the time of installation.
Analog Input (ADC) Block Parameters

- Base I/O Address: The beginning of the I/O address space assigned to the board. The value specified here must match the board's configuration. Note that this parameter is a hexadecimal number and must be entered in the dialog as a MATLAB string (e.g.,
'0x300'
).
- Analog Input Range: This two-element vector specifies the range of values supported by the ADC. The specified range must match the
I/O board's settings. Specifically, the DAS-1600/1400 Series boards switches can be configured to either [0 10]
for unipolar or [-10 10]
for bipolar input signals.
- Hardware Gain: This parameter specifies the programmable gain that is applied to the input signal before presenting it to the ADC. Specifically, the DAS-1601/1401 boards have programmable gains of 1, 10, 100, and 500. The DAS-1602/1402 boards have programmable gains of 1, 2, 4, and 8. Configure the Analog Input Range and the Hardware Gain parameters depending on the type and range of the input signal being measured. For example, a DAS-1601 board in bipolar configuration with a programmable gain of 100 is best suited to measure input signals in the range between [±10v] ÷ 100 = ±0.1v.
- Voltage levels beyond this range will saturate the block output form the ADC block. Please adhere to manufacturers' electrical specifications to avoid damage to the board.
- Number of Channels: The number of analog input channels enabled on the I/O board. The DAS-1600/1400 Series boards offer up to 16 ADC channels when configured in unipolar mode (8 ADC channels if you select differential mode). The output port width of the ADC block is equal to the number of channels enabled.
- Sample Time (sec): Device drivers are discrete blocks that require you to specify a sample time. In the generated code, these blocks are executed at the specified rate. Specifically, when the ADC block is executed, it causes the ADC to perform a single conversion on the enabled channels, and the converted values are written to the block output vector.
Analog Output (DAC) Block Parameters

- Base I/O Address: The beginning of the I/O address space assigned to the board. The value specified here must match the board's configuration. Note that this parameter is a hexadecimal number and must be entered in the dialog as a MATLAB string (e.g.,
'0x300')
.
- Analog Output Range: This parameter specifies the output range settings of the DAC section of the I/O board. Typically, unipolar ranges are between
[0 10]
volts and bipolar ranges are between [-10 10]
volts. Refer to the DAS-1600 documentation for other supported output ranges.
- Initial Output(s): This parameter can be specified either as a scalar or as an N element vector, where N is the number of channels. If a single scalar value is entered, the same scalar is applied to output. The specified initial output(s) is written to the DAC channels in the
mdlInitializeConditions
function.
- Final Output(s): This parameter is specified in a manner similar to the Initial Output(s) parameter except that the specified final output values are written out to the DAC channels in the
mdlTerminate
function. Once the generated code completes execution, the code sets the final output values prior to terminating execution.
- Number of Channels: Number of DAC channels enabled. The DAS-1600 Series I/O boards have two 12-bit DAC channels. The DAS-1400 Series I/O boards do not have any DAC channels. The input port width of this block is equal to the number of channels enabled.
- Sample Time (sec): DAC device drivers are discrete blocks that require you to specify a sample time. In the generated code, these blocks are executed at the specified rate. Specifically, when the DAC block is executed, it causes the DAC to convert a single value on each of the enabled DAC channels, which produces a corresponding voltage on the DAC output pin(s).
Digital Input Block Parameters

- Base I/O Address: The beginning of the I/O address space assigned to the board. The value specified here must match the board's configuration. Note that this parameter is a hexadecimal number and must be entered in the dialog as a MATLAB string (e.g.,
'0x300'
).
- Number of Channels: This parameter specifies the number of 1-bit digital input channels being enabled. This parameter also determines the output port width of the block in Simulink. Specifically, the DAS-1600/1400 Series boards provide four bits (i.e., channels) for digital I/O.
- Sample Time (sec): Digital input device drivers are discrete blocks that require you to specify a sample time. In the generated code, these blocks are executed at the specified rate. Specifically, when the digital input block is executed, it reads a boolean value from the enabled digital input channels. The corresponding input values are written to the block output vector.
Digital Output Block Parameters

- Base I/O Address: The beginning of the I/O address space assigned to the board. The value specified here must match the board's configuration. Note that this parameter is a hexadecimal number and must be entered in the dialog as a MATLAB string (e.g.,
'0x300'
).
- Low/High Threshold Values: This parameter specifies the threshold levels,
[lo hi]
, for converting the block inputs into 0/1 digital values. The signal in the block diagram connected to the block input should rise above the high threshold level for a 0 to 1 transition in the corresponding digital output channel on the I/O board. Similarly, the input should fall below the low threshold level for a 1 to 0 transition.
- Initial Output(s): Same as the Analog Output block, except the specified values are converted to 0 or 1 based on the lower threshold value before they are written to the corresponding digital output channel.
- Final Output(s): Same as the Analog Output block, except the specified values are converted to 0 or 1 based on the lower threshold value before they are written to the corresponding digital output channel on the I/O board.
- Number of Channels: This parameter specifies the number of 1-bit digital I/O channels being enabled. This parameter also determines the output port width of the block. Specifically, the DAS-1600/1400 Series boards provide four bits (i.e., channels) for digital I/O.
- Sample Time (sec): Digital output device drivers are discrete blocks that require you to specify a sample time. In the generated code, these blocks are executed at the specified rate. Specifically, when the digital output block is executed, it causes corresponding boolean values to be output from the board's digital I/O channels.
| Device Driver Block Library | | Adding Device Driver Blocks to the Model |  |