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

Functions

NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_SetPWM_Polarity (int32_t cardIndex, int32_t module, int32_t channel, nai_dsw_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_DSW_GetPWM_Polarity (int32_t cardIndex, int32_t module, int32_t channel, nai_dsw_pwm_polarity_t *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.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_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_DSW_GetPWM_Pulsewidth (int32_t cardIndex, int32_t module, int32_t channel, float64_t *outpulsewidth)
 Retrieves the PWM pulsewidth value set for the specified Discrete channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_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_DSW_GetPWM_Period (int32_t cardIndex, int32_t module, int32_t channel, float64_t *outperiod)
 Retrieves the PWM period value set for the specified Discrete channel.
 
NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_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_DSW_GetPWM_BurstNum (int32_t cardIndex, int32_t module, int32_t channel, uint32_t *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_DSW_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_DSW_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.
 

Detailed Description


Function Documentation

◆ naibrd_DSW_GetPWM_BurstNum()

NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_GetPWM_BurstNum ( int32_t cardIndex,
int32_t module,
int32_t channel,
uint32_t * 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]).
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 card 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_DSW_GetPWM_Period()

NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_GetPWM_Period ( int32_t cardIndex,
int32_t module,
int32_t channel,
float64_t * 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]).
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 card 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_DSW_GetPWM_Polarity()

NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_GetPWM_Polarity ( int32_t cardIndex,
int32_t module,
int32_t channel,
nai_dsw_pwm_polarity_t * 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]).
outpolarity: (Output) Polarity selection, NAI_DSW_PWMPOLARITY_POS or NAI_DSW_PWMPOLARITY_NEG
Returns
  • NAI_SUCCESS
  • NAI_ERROR_INVALID_CARD when invalid card parameter is specified.
  • NAI_ERROR_INVALID_MODULE when invalid card parameter is specified.
  • NAI_ERROR_NOT_OPEN when handle to board is invalid.
  • NAI_ERROR_NOT_SUPPORTED when function is not supported.

◆ naibrd_DSW_GetPWM_Pulsewidth()

NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_GetPWM_Pulsewidth ( int32_t cardIndex,
int32_t module,
int32_t channel,
float64_t * 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]).
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 card 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_DSW_SetPWM_BurstNum()

NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_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 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 card 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_DSW_SetPWM_Period()

NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_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 card 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_DSW_SetPWM_Polarity()

NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_SetPWM_Polarity ( int32_t cardIndex,
int32_t module,
int32_t channel,
nai_dsw_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_DSW_PWMPOLARITY_POS or NAI_DSW_PWMPOLARITY_NEG
Returns
  • NAI_SUCCESS
  • NAI_ERROR_INVALID_CARD when invalid card parameter is specified.
  • NAI_ERROR_INVALID_MODULE when invalid card parameter is specified.
  • NAI_ERROR_NOT_OPEN when handle to board is invalid.
  • NAI_ERROR_NOT_SUPPORTED when function is not supported.

◆ naibrd_DSW_SetPWM_Pulsewidth()

NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_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 card 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_DSW_StartPWM()

NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_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 card parameter is specified.
  • NAI_ERROR_NOT_OPEN when handle to board is invalid.
  • NAI_ERROR_NOT_SUPPORTED when function is not supported.

◆ naibrd_DSW_StopPWM()

NAIBRDFUNC nai_status_t NAIAPI naibrd_DSW_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 card parameter is specified.
  • NAI_ERROR_NOT_OPEN when handle to board is invalid.
  • NAI_ERROR_NOT_SUPPORTED when function is not supported.