Main Content

DC Motor

Drive a DC motor in either direction

Add-On Required: This feature requires the Simulink Coder Support Package for NXP FRDM-KL25Z Board add-on.


Simulink Coder Support Package for NXP FRDM-KL25Z Board/ FRDM-TFC Shield

  • DC Motor block


The NXP TFC shield can have up to two DC motors connected to it. The DC Motor Block drives a DC motor with torque between full reverse (-1.0) and full forward (1.0). The resulting speed and torque depends on the current state of the battery connected to the TFC shield.

During simulations without the hardware, this block does nothing.


DC motor

Select the DC Motor A or DC Motor B.

When you select DC Motor B, make sure that you do not use the RGB LED block in the same model.

The PTC2 pin, used in DC Motor B, and the LED_BLUE (PTD1) pin, used in the RGB LED block for the blue LED, belong to Timer 0 Channel 1. In a Simulink® model, using pins that belong to the same timer channel combination results in a pin conflict error. Hence, when you build a model using DC Motor B and the RGB LED block, you receive the pin conflict error message. As a result, you are restricted even from using the LED_RED pin and the LED_GREEN pin from the RGB LED block. As an alternative to the RGB LED block, you can use two PWM Output blocks and set their output pins to LED_RED and LED_GREEN respectively.

See Also