1.18. lpc17xx_mcpwm
Module¶
Motor control PWM client library functions. Find implementation details in LPC17xx CMSIS-Compliant Standard Peripheral Firmware Driver Library documentation.
-
robovero.lpc17xx_mcpwm.
MCPWM_ACMode
(MCPWMx, acMode)¶ Enables/Disables 3-phase AC motor mode on MCPWM peripheral.
Args:
- MCPWMx: Motor Control PWM peripheral selected. Should be: LPC_MCPWM
- acMode: State of this command, should be: ENABLE or DISABLE.
-
class
robovero.lpc17xx_mcpwm.
MCPWM_CAPTURE_CFG_Type
(**kwargs)¶ Bases:
robovero.internals.cstruct
MCPWM Capture Configuration type definition.
- captureChannel: Capture Channel Number, should be in range from 0 to 2
- captureRising: Enable/Disable Capture on Rising Edge event, should be:
- ENABLE or DISABLE.
- captureFalling: Enable/Disable Capture on Falling Edge event, should be:
- ENABLE or DISABLE.
- timerReset: Enable/Disable Timer reset function an capture, should be:
- ENABLE or DISABLE.
- hnfEnable: Enable/Disable Hardware noise filter function, should be:
- ENABLE or DISABLE.
- ptr: LPC1769 memory address where structure is stored. Use this in place of the C reference operator (&).
-
class
robovero.lpc17xx_mcpwm.
MCPWM_CHANNEL_CFG_Type
(**kwargs)¶ Bases:
robovero.internals.cstruct
Motor Control PWM Channel Configuration structure type definition.
- channelType: Edge/center aligned mode for this channel, should be:
- MCPWM_CHANNEL_EDGE_MODE: Channel is in Edge mode MCPWM_CHANNEL_CENTER_MODE: Channel is in Center mode
- channelPolarity: Polarity of the MCOA and MCOB pins, should be:
- MCPWM_CHANNEL_PASSIVE_LO: Passive state is LOW, active state is HIGH MCPWM_CHANNEL_PASSIVE_HI: Passive state is HIGH, active state is LOW
- channelDeadtimeEnable: Enable/Disable DeadTime function for channel, should
- be: ENABLE or DISABLE.
- channelDeadtimeValue: DeadTime value, should be less than 0x3FF
- channelUpdateEnable: Enable/Disable updates of functional registers, should
- be: ENABLE or DISABLE.
- channelTimercounterValue: MCPWM Timer Counter value
- channelPeriodValue: MCPWM Period value
- channelPulsewidthValue: MCPWM Pulse Width value
- ptr: LPC1769 memory address where structure is stored. Use this in place of
- the C reference operator (&).
-
class
robovero.lpc17xx_mcpwm.
MCPWM_COUNT_CFG_Type
(**kwargs)¶ Bases:
robovero.internals.cstruct
MCPWM Count Control Configuration type definition.
- counterChannel: Counter Channel Number, should be in range from 0 to 2
- countRising: Enable/Disable Capture on Rising Edge event, should be: ENABLE
- or DISABLE.
- countFalling: Enable/Disable Capture on Falling Edge event, should be: ENABLE
- or DISABLE.
- ptr: LPC1769 memory address where structure is stored. Use this in place of
- the C reference operator (&).
-
robovero.lpc17xx_mcpwm.
MCPWM_ClearCapture
(MCPWMx, captureChannel)¶ Clears current captured value in specified capture channel.
Args:
- MCPWMx: Motor Control PWM peripheral selected. Should be: LPC_MCPWM
- captureChannel: Capture channel number, should be: 0..2
-
robovero.lpc17xx_mcpwm.
MCPWM_ConfigCapture
(MCPWMx, channelNum, captureConfig)¶ Configures capture function in MCPWM peripheral.
Args:
- MCPWMx: Motor Control PWM peripheral selected. Should be: LPC_MCPWM
- channelNum: MCI (Motor Control Input pin) number. Should be: 0..2
- captureConfig: Pointer to a MCPWM_CAPTURE_CFG_Type structure that contains
- the configuration information for the specified MCPWM capture.
-
robovero.lpc17xx_mcpwm.
MCPWM_ConfigChannel
(MCPWMx, channelNum, channelSetup)¶ Configures each channel in MCPWM peripheral according to the specified parameters in the MCPWM_CHANNEL_CFG_Type.
Args:
- MCPWMx: Motor Control PWM peripheral selected. Should be: LPC_MCPWM
- channelNum: Channel number, should be: 0..2.
- channelSetup: Pointer to a MCPWM_CHANNEL_CFG_Type structure that contains the
- configuration information for the specified MCPWM channel.
-
robovero.lpc17xx_mcpwm.
MCPWM_CountConfig
(MCPWMx, channelNum, countMode, countConfig)¶ Configures Count control in MCPWM peripheral.
Args:
- MCPWMx: Motor Control PWM peripheral selected. Should be: LPC_MCPWM
- channelNum: Channel number, should be: 0..2
- countMode: Count mode, should be:
- ENABLE: Enables count mode.
- DISABLE: Disable count mode, the channel is in timer mode.
- countConfig: Pointer to a MCPWM_COUNT_CFG_Type structure that contains the
- configuration information for the specified MCPWM count control.
-
robovero.lpc17xx_mcpwm.
MCPWM_DCMode
(MCPWMx, dcMode, outputInvered, outputPattern)¶ Enables/Disables 3-phase DC motor mode on MCPWM peripheral.
Args:
MCPWMx: Motor Control PWM peripheral selected. Should be: LPC_MCPWM
dcMode: State of this command, should be: ENABLE or DISABLE.
outputInvered: Polarity of the MCOB outputs for all 3 channels, should be:
- ENABLE: The MCOB outputs have opposite polarity from the MCOA outputs.
- DISABLE: The MCOB outputs have the same basic polarity as the MCOA outputs.
- outputPattern: A value contains bits that enables/disables the specified
output pins route to the internal MCOA0 signal, should be:
- MCPWM_PATENT_A0: MCOA0 tracks internal MCOA0
- MCPWM_PATENT_B0: MCOB0 tracks internal MCOA0
- MCPWM_PATENT_A1: MCOA1 tracks internal MCOA0
- MCPWM_PATENT_B1: MCOB1 tracks internal MCOA0
- MCPWM_PATENT_A2: MCOA2 tracks internal MCOA0
- MCPWM_PATENT_B2: MCOB2 tracks internal MCOA0
-
robovero.lpc17xx_mcpwm.
MCPWM_GetCapture
(MCPWMx, captureChannel)¶ Get current captured value in specified capture channel.
Args:
- MCPWMx: Motor Control PWM peripheral selected. Should be: LPC_MCPWM
- captureChannel: Capture channel number, should be: 0..2
Return: Captured value in channel 0, 1, or 2
-
robovero.lpc17xx_mcpwm.
MCPWM_GetIntStatus
(MCPWMx, ulIntType)¶ Check whether if the specified interrupt in MCPWM is set or not.
Args:
- MCPWMx: Motor Control PWM peripheral selected. Should be: LPC_MCPWM
- ulIntType: Interrupt type, should be:
- MCPWM_INTFLAG_LIM0: Limit interrupt for channel (0)
- MCPWM_INTFLAG_MAT0: Match interrupt for channel (0)
- MCPWM_INTFLAG_CAP0: Capture interrupt for channel (0)
- MCPWM_INTFLAG_LIM1: Limit interrupt for channel (1)
- MCPWM_INTFLAG_MAT1: Match interrupt for channel (1)
- MCPWM_INTFLAG_CAP1: Capture interrupt for channel (1)
- MCPWM_INTFLAG_LIM2: Limit interrupt for channel (2)
- MCPWM_INTFLAG_MAT2: Match interrupt for channel (2)
- MCPWM_INTFLAG_CAP2: Capture interrupt for channel (2)
- MCPWM_INTFLAG_ABORT: Fast abort interrupt
Return: SET or RESET
-
robovero.lpc17xx_mcpwm.
MCPWM_INT_ICAP
(n)¶
-
robovero.lpc17xx_mcpwm.
MCPWM_INT_ILIM
(n)¶
-
robovero.lpc17xx_mcpwm.
MCPWM_INT_IMAT
(n)¶
-
robovero.lpc17xx_mcpwm.
MCPWM_Init
(MCPWMx)¶ Initializes the MCPWM peripheral.
Args:
- MCPWMx: Motor Control PWM peripheral selected. Should be: LPC_MCPWM
-
robovero.lpc17xx_mcpwm.
MCPWM_IntClear
(MCPWMx, ulIntType)¶ Clear the specified interrupt pending for MCPWM peripheral.
Args:
- MCPWMx: Motor Control PWM peripheral selected. Should be: LPC_MCPWM
- ulIntType: Interrupt type, should be:
- MCPWM_INTFLAG_LIM0: Limit interrupt for channel (0)
- MCPWM_INTFLAG_MAT0: Match interrupt for channel (0)
- MCPWM_INTFLAG_CAP0: Capture interrupt for channel (0)
- MCPWM_INTFLAG_LIM1: Limit interrupt for channel (1)
- MCPWM_INTFLAG_MAT1: Match interrupt for channel (1)
- MCPWM_INTFLAG_CAP1: Capture interrupt for channel (1)
- MCPWM_INTFLAG_LIM2: Limit interrupt for channel (2)
- MCPWM_INTFLAG_MAT2: Match interrupt for channel (2)
- MCPWM_INTFLAG_CAP2: Capture interrupt for channel (2)
- MCPWM_INTFLAG_ABORT: Fast abort interrupt
-
robovero.lpc17xx_mcpwm.
MCPWM_IntConfig
(MCPWMx, ulIntType, NewState)¶ Configures the specified interrupt in MCPWM peripheral.
Args:
- MCPWMx: Motor Control PWM peripheral selected. Should be: LPC_MCPWM
- ulIntType: Interrupt type, should be:
- MCPWM_INTFLAG_LIM0: Limit interrupt for channel (0)
- MCPWM_INTFLAG_MAT0: Match interrupt for channel (0)
- MCPWM_INTFLAG_CAP0: Capture interrupt for channel (0)
- MCPWM_INTFLAG_LIM1: Limit interrupt for channel (1)
- MCPWM_INTFLAG_MAT1: Match interrupt for channel (1)
- MCPWM_INTFLAG_CAP1: Capture interrupt for channel (1)
- MCPWM_INTFLAG_LIM2: Limit interrupt for channel (2)
- MCPWM_INTFLAG_MAT2: Match interrupt for channel (2)
- MCPWM_INTFLAG_CAP2: Capture interrupt for channel (2)
- MCPWM_INTFLAG_ABORT: Fast abort interrupt
- NewState: New State of this command, should be: ENABLE or DISABLE.
-
robovero.lpc17xx_mcpwm.
MCPWM_IntSet
(MCPWMx, ulIntType)¶ Sets/Forces the specified interrupt for MCPWM peripheral.
Args:
- MCPWMx: Motor Control PWM peripheral selected. Should be: LPC_MCPWM
- ulIntType: Interrupt type, should be:
- MCPWM_INTFLAG_LIM0: Limit interrupt for channel (0)
- MCPWM_INTFLAG_MAT0: Match interrupt for channel (0)
- MCPWM_INTFLAG_CAP0: Capture interrupt for channel (0)
- MCPWM_INTFLAG_LIM1: Limit interrupt for channel (1)
- MCPWM_INTFLAG_MAT1: Match interrupt for channel (1)
- MCPWM_INTFLAG_CAP1: Capture interrupt for channel (1)
- MCPWM_INTFLAG_LIM2: Limit interrupt for channel (2)
- MCPWM_INTFLAG_MAT2: Match interrupt for channel (2)
- MCPWM_INTFLAG_CAP2: Capture interrupt for channel (2)
- MCPWM_INTFLAG_ABORT: Fast abort interrupt
-
robovero.lpc17xx_mcpwm.
MCPWM_Start
(MCPWMx, channel0, channel1, channel2)¶ Start MCPWM activity for each MCPWM channel. Args:
- MCPWMx: Motor Control PWM peripheral selected. Should be: LPC_MCPWM
- channel0: State of this command on channel 0:
- ENABLE: ‘Start’ command will effect on channel 0
- DISABLE: ‘Start’ command will not effect on channel 0
- channel1: State of this command on channel 1:
- ENABLE: ‘Start’ command will effect on channel 1
- DISABLE: ‘Start’ command will not effect on channel 1
- channel2: State of this command on channel 2:
- ENABLE: ‘Start’ command will effect on channel 2
- DISABLE: ‘Start’ command will not effect on channel 2
-
robovero.lpc17xx_mcpwm.
MCPWM_Stop
(MCPWMx, channel0, channel1, channel2)¶ Stop MCPWM activity for each MCPWM channel.
Args:
- MCPWMx: Motor Control PWM peripheral selected. Should be: LPC_MCPWM
- channel0: State of this command on channel 0:
- ENABLE: ‘Stop’ command will effect on channel 0
- DISABLE: ‘Stop’ command will not effect on channel 0
- channel1: State of this command on channel 1:
- ENABLE: ‘Stop’ command will effect on channel 1
- DISABLE: ‘Stop’ command will not effect on channel 1
- channel2: State of this command on channel 2:
- ENABLE: ‘Stop’ command will effect on channel 2
- DISABLE: ‘Stop’ command will not effect on channel 2
-
robovero.lpc17xx_mcpwm.
MCPWM_WriteToShadow
(MCPWMx, channelNum, channelSetup)¶ Write to MCPWM shadow registers - Update the value for period and pulse width in MCPWM peripheral.
Args:
- MCPWMx: Motor Control PWM peripheral selected. Should be: LPC_MCPWM
- channelNum: Channel number, should be: 0..2
- channelSetup: Pointer to a MCPWM_CHANNEL_CFG_Type structure that contains the
- configuration information for the specified MCPWM channel.