Software Library API naibrd 1.62
See all documentation at naii.docs.com
Pulse Width Modulation Functions

Functions

NAIBRDFUNC nai_status_t NAIAPI naibrd_DT_StartPWM (int32_t cardIndex, int32_t module, int32_t channel)
 Starts the PWM output for the selected channel on the module. For GEN5 module, PWM mode should be set up first, to the desired mode (continuous or burst).
The PWM mode setup will need to be done before each start command.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DT_StopPWM (int32_t cardIndex, int32_t module, int32_t channel)
 Stops the PWM output for the selected channel on the module. For Gen5 modules, this is done by taking the channel out of PWM mode and resetting to the input mode. To restart PWM, the PWM mode setting will need to be independently set up again.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DT_ResetPWMMasterChannelAll (int32_t cardIndex, int32_t module)
 Resets all master channel configurations for the module. This restores the power on default of independent PWM triggering on all channels.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DT_ResetPWMMasterChannel (int32_t cardIndex, int32_t module, int32_t channel)
 Resets the master channel configuration for the channel group associated with the selected channel. Associated channel groupings are Channels [1 to 6], [6 to 12], [13 to 18], [19 to 24].

 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DT_SetPWMMasterChannel (int32_t cardIndex, int32_t module, int32_t channel)
 Sets the channel to be designated as a master within its channel group on the module. The master channel allows synchronization of output timing for the other channels each respective 6 channel group.
Associated channel groupings are Channels [1 to 6], [6 to 12], [13 to 18], [19 to 24].
Note: Selection of a master channel will affect only the channels within its group. The master channel is used for timing synchronization of the output channels in the group.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DT_GetPWMMasterChannel (int32_t cardIndex, int32_t module, int32_t channel, int32_t *p_outchannel)
 Retrieves the master channel associated with the selected channel, in the associated channel group on the module. A zero return value indicates no master channel is set for the channel, so it operates independently.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DT_SetPWM_Period (int32_t cardIndex, int32_t module, int32_t channel, float64_t period)
 Sets the PWM period for the specified Discrete channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DT_GetPWM_Period (int32_t cardIndex, int32_t module, int32_t channel, float64_t *p_outperiod)
 Retrieves the PWM period value set for the specified Discrete channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DT_SetPWM_Pulsewidth (int32_t cardIndex, int32_t module, int32_t channel, float64_t pulsewidth)
 Sets the PWM pulsewidth for the specified Discrete channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DT_GetPWM_Pulsewidth (int32_t cardIndex, int32_t module, int32_t channel, float64_t *p_outpulsewidth)
 Retrieves the PWM pulsewidth value set for the specified Discrete channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DT_SetPWM_BurstNum (int32_t cardIndex, int32_t module, int32_t channel, uint32_t burstNum)
 Sets the number of cycles to output in the PWM burst mode for the specified Discrete channel. The set value is applicable for enhanced IO PWM burst mode (mode 12).
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DT_GetPWM_BurstNum (int32_t cardIndex, int32_t module, int32_t channel, uint32_t *p_outburstNum)
 Retrieves the number of cycles set to output in the PWM burst mode for the specified Discrete channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DT_SetPWM_Polarity (int32_t cardIndex, int32_t module, int32_t channel, nai_dt_pwm_polarity_t polarity)
 Sets the polarity for the PWM output for the selected channel on the module. Options are positive and negative polarity, where positive indicates the high state corresponds to the pulsewidth setting, and negative inverts it for a negative going pulse output.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DT_GetPWM_Polarity (int32_t cardIndex, int32_t module, int32_t channel, nai_dt_pwm_polarity_t *p_outpolarity)
 Retrieves the polarity setting for the PWM output for the selected channel on the module. Options are positive and negative polarity, where positive setting indicates the high state corresponds to the pulsewidth setting, and negative setting inverts it for a negative going pulse output.
 

Detailed Description


Function Documentation

◆ naibrd_DT_GetPWM_BurstNum()

NAIBRDFUNC nai_status_t NAIAPI naibrd_DT_GetPWM_BurstNum ( int32_t cardIndex,
int32_t module,
int32_t channel,
uint32_t * p_outburstNum )

Retrieves the number of cycles set to output in the PWM burst mode for the specified Discrete channel.

Parameters
cardIndex: (Input) Logical Card Index assigned to connection with the NAI_BOARD (0 - NAI_MAX_CARDS-1).
module: (Input) Module Number of the module to access (1 - [max modules for board]).
channel: (Input) Channel Number of the channel to access (1 - [max channels for module]).
p_outburstNum: (Output)Number of cycles to output upon trigger, in PWM burst mode.
Returns
  • NAI_SUCCESS
  • NAI_ERROR_INVALID_CARD when invalid card parameter is specified.
  • NAI_ERROR_INVALID_MODULE when invalid module parameter is specified.
  • NAI_ERROR_NOT_OPEN when handle to board is invalid.
  • NAI_ERROR_INVALID_CHANNEL when invalid channel parameter.
  • NAI_ERROR_INVALID_VALUE when invalid format type parameter is specified.
  • NAI_ERROR_NOT_SUPPORTED when function is not supported.

◆ naibrd_DT_GetPWM_Period()

NAIBRDFUNC nai_status_t NAIAPI naibrd_DT_GetPWM_Period ( int32_t cardIndex,
int32_t module,
int32_t channel,
float64_t * p_outperiod )

Retrieves the PWM period value set for the specified Discrete channel.

Parameters
cardIndex: (Input) Logical Card Index assigned to connection with the NAI_BOARD (0 - NAI_MAX_CARDS-1).
module: (Input) Module Number of the module to access (1 - [max modules for board]).
channel: (Input) Channel Number of the channel to access (1 - [max channels for module]).
p_outperiod: (Output) PWM period, specified in milliseconds, increments of 0.000008 ms (8ns). (Valid Range 0.000016 to 34359.73836 milliseconds) (0x2 to 0xFFFFFFFF at 0.000008 ms LSB)
Returns
  • NAI_SUCCESS
  • NAI_ERROR_INVALID_CARD when invalid card parameter is specified.
  • NAI_ERROR_INVALID_MODULE when invalid module parameter is specified.
  • NAI_ERROR_NOT_OPEN when handle to board is invalid.
  • NAI_ERROR_INVALID_CHANNEL when invalid channel parameter.
  • NAI_ERROR_INVALID_VALUE when invalid format type parameter is specified.
  • NAI_ERROR_NOT_SUPPORTED when function is not supported.

◆ naibrd_DT_GetPWM_Polarity()

NAIBRDFUNC nai_status_t NAIAPI naibrd_DT_GetPWM_Polarity ( int32_t cardIndex,
int32_t module,
int32_t channel,
nai_dt_pwm_polarity_t * p_outpolarity )

Retrieves the polarity setting for the PWM output for the selected channel on the module. Options are positive and negative polarity, where positive setting indicates the high state corresponds to the pulsewidth setting, and negative setting inverts it for a negative going pulse output.

Parameters
cardIndex: (Input) Logical Card Index assigned to connection with the NAI_BOARD (0 - NAI_MAX_CARDS-1).
module: (Input) Module Number of the module to access (1 - [max modules for board]).
channel: (Input) Channel Number of the channel to access (1 - [max channels for module]).
p_outpolarity: (Output) Polarity selection, NAI_DT_PWMPOLARITY_POS or NAI_DT_PWMPOLARITY_NEG
Returns
  • NAI_SUCCESS
  • NAI_ERROR_INVALID_CARD when invalid card parameter is specified.
  • NAI_ERROR_INVALID_MODULE when invalid module parameter is specified.
  • NAI_ERROR_NOT_OPEN when handle to board is invalid.
  • NAI_ERROR_NOT_SUPPORTED when function is not supported.

◆ naibrd_DT_GetPWM_Pulsewidth()

NAIBRDFUNC nai_status_t NAIAPI naibrd_DT_GetPWM_Pulsewidth ( int32_t cardIndex,
int32_t module,
int32_t channel,
float64_t * p_outpulsewidth )

Retrieves the PWM pulsewidth value set for the specified Discrete channel.

Parameters
cardIndex: (Input) Logical Card Index assigned to connection with the NAI_BOARD (0 - NAI_MAX_CARDS-1).
module: (Input) Module Number of the module to access (1 - [max modules for board]).
channel: (Input) Channel Number of the channel to access (1 - [max channels for module]).
p_outpulsewidth: (Output) PWM pulsewidth, specified in milliseconds, increments of 0.000008 ms (8ns). (Valid Range 0.000008 to 34359.73836 milliseconds) (0x1 to 0xFFFFFFFF at 0.000008 ms LSB)
Returns
  • NAI_SUCCESS
  • NAI_ERROR_INVALID_CARD when invalid card parameter is specified.
  • NAI_ERROR_INVALID_MODULE when invalid module parameter is specified.
  • NAI_ERROR_NOT_OPEN when handle to board is invalid.
  • NAI_ERROR_INVALID_CHANNEL when invalid channel parameter.
  • NAI_ERROR_INVALID_VALUE when invalid format type parameter is specified.
  • NAI_ERROR_NOT_SUPPORTED when function is not supported.

◆ naibrd_DT_GetPWMMasterChannel()

NAIBRDFUNC nai_status_t NAIAPI naibrd_DT_GetPWMMasterChannel ( int32_t cardIndex,
int32_t module,
int32_t channel,
int32_t * p_outchannel )

Retrieves the master channel associated with the selected channel, in the associated channel group on the module. A zero return value indicates no master channel is set for the channel, so it operates independently.

Parameters
cardIndex: (Input) Logical Card Index assigned to connection with the NAI_BOARD (0 - NAI_MAX_CARDS-1).
module: (Input) Module Number of the module to access (1 - [max modules for board]).
channel: (Input) The channel number for the group from which to retrieve the master channel configuration(1 - [max channels for module])
p_outchannel: (Output) The master channel assigned in the group associated with the selected channel.
Returns
  • NAI_SUCCESS
  • NAI_ERROR_INVALID_CARD when invalid card parameter is specified.
  • NAI_ERROR_INVALID_MODULE when invalid module parameter is specified.
  • NAI_ERROR_NOT_OPEN when handle to board is invalid.
  • NAI_ERROR_NOT_SUPPORTED when function is not supported.

◆ naibrd_DT_ResetPWMMasterChannel()

NAIBRDFUNC nai_status_t NAIAPI naibrd_DT_ResetPWMMasterChannel ( int32_t cardIndex,
int32_t module,
int32_t channel )

Resets the master channel configuration for the channel group associated with the selected channel. Associated channel groupings are Channels [1 to 6], [6 to 12], [13 to 18], [19 to 24].

Parameters
cardIndex: (Input) Logical Card Index assigned to connection with the NAI_BOARD (0 - NAI_MAX_CARDS-1).
module: (Input) Module Number of the module to access (1 - [max modules for board]).
channel: (Input) The channel number of the group to be cleared of master control.(1 - [max channels for module])
Returns
  • NAI_SUCCESS
  • NAI_ERROR_INVALID_CARD when invalid card parameter is specified.
  • NAI_ERROR_INVALID_MODULE when invalid module parameter is specified.
  • NAI_ERROR_NOT_OPEN when handle to board is invalid.
  • NAI_ERROR_NOT_SUPPORTED when function is not supported.

◆ naibrd_DT_ResetPWMMasterChannelAll()

NAIBRDFUNC nai_status_t NAIAPI naibrd_DT_ResetPWMMasterChannelAll ( int32_t cardIndex,
int32_t module )

Resets all master channel configurations for the module. This restores the power on default of independent PWM triggering on all channels.

Parameters
cardIndex: (Input) Logical Card Index assigned to connection with the NAI_BOARD (0 - NAI_MAX_CARDS-1).
module: (Input) Module Number of the module to access (1 - [max modules for board]).
Returns
  • NAI_SUCCESS
  • NAI_ERROR_INVALID_CARD when invalid card parameter is specified.
  • NAI_ERROR_INVALID_MODULE when invalid module parameter is specified.
  • NAI_ERROR_NOT_OPEN when handle to board is invalid.
  • NAI_ERROR_NOT_SUPPORTED when function is not supported.

◆ naibrd_DT_SetPWM_BurstNum()

NAIBRDFUNC nai_status_t NAIAPI naibrd_DT_SetPWM_BurstNum ( int32_t cardIndex,
int32_t module,
int32_t channel,
uint32_t burstNum )

Sets the number of cycles to output in the PWM burst mode for the specified Discrete channel. The set value is applicable for enhanced IO PWM burst mode (mode 12).

Parameters
cardIndex: (Input) Logical Card Index assigned to connection with the NAI_BOARD (0 - NAI_MAX_CARDS-1).
module: (Input) Module Number of the module to access (1 - [max modules for board]).
channel: (Input) Channel Number of the channel to access (1 - [max channels for module]).
burstNum: (Input)Number (>=1) of cycles to output upon trigger, in PWM burst mode.
Returns
  • NAI_SUCCESS
  • NAI_ERROR_INVALID_CARD when invalid card parameter is specified.
  • NAI_ERROR_INVALID_MODULE when invalid module parameter is specified.
  • NAI_ERROR_NOT_OPEN when handle to board is invalid.
  • NAI_ERROR_INVALID_CHANNEL when invalid channel parameter.
  • NAI_ERROR_INVALID_VALUE when invalid format type parameter is specified.
  • NAI_ERROR_NOT_SUPPORTED when function is not supported.

◆ naibrd_DT_SetPWM_Period()

NAIBRDFUNC nai_status_t NAIAPI naibrd_DT_SetPWM_Period ( int32_t cardIndex,
int32_t module,
int32_t channel,
float64_t period )

Sets the PWM period for the specified Discrete channel.

Parameters
cardIndex: (Input) Logical Card Index assigned to connection with the NAI_BOARD (0 - NAI_MAX_CARDS-1).
module: (Input) Module Number of the module to access (1 - [max modules for board]).
channel: (Input) Channel Number of the channel to access (1 - [max channels for module]).
period: (Input)PWM period specified in milliseconds, increments of 0.000008 ms (8ns). (Range 0.000016 to 34359.73836 milliseconds) (0x2 to 0xFFFFFFFF at 0.000008 ms LSB)
Returns
  • NAI_SUCCESS
  • NAI_ERROR_INVALID_CARD when invalid card parameter is specified.
  • NAI_ERROR_INVALID_MODULE when invalid module parameter is specified.
  • NAI_ERROR_NOT_OPEN when handle to board is invalid.
  • NAI_ERROR_INVALID_CHANNEL when invalid channel parameter.
  • NAI_ERROR_INVALID_VALUE when invalid format type parameter is specified.
  • NAI_ERROR_NOT_SUPPORTED when function is not supported.

◆ naibrd_DT_SetPWM_Polarity()

NAIBRDFUNC nai_status_t NAIAPI naibrd_DT_SetPWM_Polarity ( int32_t cardIndex,
int32_t module,
int32_t channel,
nai_dt_pwm_polarity_t polarity )

Sets the polarity for the PWM output for the selected channel on the module. Options are positive and negative polarity, where positive indicates the high state corresponds to the pulsewidth setting, and negative inverts it for a negative going pulse output.

Parameters
cardIndex: (Input) Logical Card Index assigned to connection with the NAI_BOARD (0 - NAI_MAX_CARDS-1).
module: (Input) Module Number of the module to access (1 - [max modules for board]).
channel: (Input) Channel Number of the channel to access (1 - [max channels for module]).
polarity: (Input) Polarity selection, NAI_DT_PWMPOLARITY_POS or NAI_DT_PWMPOLARITY_NEG
Returns
  • NAI_SUCCESS
  • NAI_ERROR_INVALID_CARD when invalid card parameter is specified.
  • NAI_ERROR_INVALID_MODULE when invalid module parameter is specified.
  • NAI_ERROR_NOT_OPEN when handle to board is invalid.
  • NAI_ERROR_NOT_SUPPORTED when function is not supported.

◆ naibrd_DT_SetPWM_Pulsewidth()

NAIBRDFUNC nai_status_t NAIAPI naibrd_DT_SetPWM_Pulsewidth ( int32_t cardIndex,
int32_t module,
int32_t channel,
float64_t pulsewidth )

Sets the PWM pulsewidth for the specified Discrete channel.

Parameters
cardIndex: (Input) Logical Card Index assigned to connection with the NAI_BOARD (0 - NAI_MAX_CARDS-1).
module: (Input) Module Number of the module to access (1 - [max modules for board]).
channel: (Input) Channel Number of the channel to access (1 - [max channels for module]).
pulsewidth: (Input)PWM pulsewidth specified in milliseconds, increments of 0.000008 ms (8ns). (Range 0.000008 to 34359.73836 milliseconds) (0x1 to 0xFFFFFFFF at 0.000008 ms LSB)
Returns
  • NAI_SUCCESS
  • NAI_ERROR_INVALID_CARD when invalid card parameter is specified.
  • NAI_ERROR_INVALID_MODULE when invalid module parameter is specified.
  • NAI_ERROR_NOT_OPEN when handle to board is invalid.
  • NAI_ERROR_INVALID_CHANNEL when invalid channel parameter.
  • NAI_ERROR_INVALID_VALUE when invalid format type parameter is specified.
  • NAI_ERROR_NOT_SUPPORTED when function is not supported.

◆ naibrd_DT_SetPWMMasterChannel()

NAIBRDFUNC nai_status_t NAIAPI naibrd_DT_SetPWMMasterChannel ( int32_t cardIndex,
int32_t module,
int32_t channel )

Sets the channel to be designated as a master within its channel group on the module. The master channel allows synchronization of output timing for the other channels each respective 6 channel group.
Associated channel groupings are Channels [1 to 6], [6 to 12], [13 to 18], [19 to 24].
Note: Selection of a master channel will affect only the channels within its group. The master channel is used for timing synchronization of the output channels in the group.

Parameters
cardIndex: (Input) Logical Card Index assigned to connection with the NAI_BOARD (0 - NAI_MAX_CARDS-1).
module: (Input) Module Number of the module to access (1 - [max modules for board]).
channel: (Input) The channel number to set as master (1 - [max channels for module])
Returns
  • NAI_SUCCESS
  • NAI_ERROR_INVALID_CARD when invalid card parameter is specified.
  • NAI_ERROR_INVALID_MODULE when invalid module parameter is specified.
  • NAI_ERROR_NOT_OPEN when handle to board is invalid.
  • NAI_ERROR_NOT_SUPPORTED when function is not supported.

◆ naibrd_DT_StartPWM()

NAIBRDFUNC nai_status_t NAIAPI naibrd_DT_StartPWM ( int32_t cardIndex,
int32_t module,
int32_t channel )

Starts the PWM output for the selected channel on the module. For GEN5 module, PWM mode should be set up first, to the desired mode (continuous or burst).
The PWM mode setup will need to be done before each start command.

Parameters
cardIndex: (Input) Logical Card Index assigned to connection with the NAI_BOARD (0 - NAI_MAX_CARDS-1).
module: (Input) Module Number of the module to access (1 - [max modules for board]).
channel: (Input) Channel Number of the channel to access (1 - [max channels for module]).
Returns
  • NAI_SUCCESS
  • NAI_ERROR_INVALID_CARD when invalid card parameter is specified.
  • NAI_ERROR_INVALID_MODULE when invalid module parameter is specified.
  • NAI_ERROR_NOT_OPEN when handle to board is invalid.
  • NAI_ERROR_NOT_SUPPORTED when function is not supported.

◆ naibrd_DT_StopPWM()

NAIBRDFUNC nai_status_t NAIAPI naibrd_DT_StopPWM ( int32_t cardIndex,
int32_t module,
int32_t channel )

Stops the PWM output for the selected channel on the module. For Gen5 modules, this is done by taking the channel out of PWM mode and resetting to the input mode. To restart PWM, the PWM mode setting will need to be independently set up again.

Parameters
cardIndex: (Input) Logical Card Index assigned to connection with the NAI_BOARD (0 - NAI_MAX_CARDS-1).
module: (Input) Module Number of the module to access (1 - [max modules for board]).
channel: (Input) Channel Number of the channel to access (1 - [max channels for module]).
Returns
  • NAI_SUCCESS
  • NAI_ERROR_INVALID_CARD when invalid card parameter is specified.
  • NAI_ERROR_INVALID_MODULE when invalid module parameter is specified.
  • NAI_ERROR_NOT_OPEN when handle to board is invalid.
  • NAI_ERROR_NOT_SUPPORTED when function is not supported.