Main Content

loadDriver

Load driver instance into real-time kernel

Since R2023b

Description

driverObj = loadDriver(RT.Kernel,Name) loads a driver with the specified name into the kernel. The driver uses the default address and uses the default parameters.

driverObj = loadDriver(RT.Kernel,Name,Address) loads a driver with the specified name into the kernel. The driver uses the specified address and the default parameters.

driverObj = loadDriver(RT.Kernel,Name,Address,Parameters) load a driver with the specified name into the kernel. The load operation uses the specified address and the specified parameters.

example

Examples

collapse all

This example shows how to find driver information for a block in a model, then use the information to load the driver. To select and configure the board, select Block Parameters > Install new board dialog box for the Counter Input block

Open the model. Get driver information for a block in the model. Load the driver into the real-time kernel.

openExample('sldrtex_counter');
myBoard = get_param(['sldrtex_counter','/Counter Input'], 'DrvName');
loadDriver(RT.Kernel,myBoard)
ans = 

  Driver with properties:

     Parent: [1×1 RT.Kernel]
       Name: 'Standard_Devices/UDP_Protocol'
    Address: 16384
    IOSizes: [1×1 struct]

Input Arguments

collapse all

The RT.Kernel argument specifies the real-time kernel object.

The Name argument specifies the driver name.

The Address argument specifies the driver address.

The Parameters argument provides a cell array of driver parameters and values.

Output Arguments

collapse all

The driverObj object represents the driver and provides driver information through object properties.

Version History

Introduced in R2023b