DC Motor

Represent connected DC motor and set motor speed

  • Library:
  • Simulink Coder Support Package for ARM Cortex-based Microcontroller / Actuators

Description

The DC Motor block represents a DC motor connected to a specified motor channel on an ARM® Cortex®-based VEX® Microcontroller. The input signal sets the speed of the motor. There are 10 motor channels, or pins, on the VEX microcontroller that you can connect to DC motors. For information on the pin layout of the microcontroller, see the VEX Cortex Pin-Out diagram from VEX Robotics.

Ports

Input

expand all

The block input value can range from –128 to 127. The sign determines the direction of rotation of the motor, and the amplitude determines the speed. A block input value of 0 stops the motor.

The input analog signal for the DC Motor block can be derived from the output of other blocks in the model (for example, from a Gamepad Joystick block).

During simulations without the hardware, the DC Motor block emits zeroes if there is no block connected to the input port (see Block Produces Zeros or Does Nothing in Simulation (Simulink)). If the input value to DC Motor is beyond the range of –128 to 127, you receive an error message during simulation.

Data Types: double

Output

expand all

The output is the speed of the motor, calculated by multiplying the value from the input port by the value of the Gearing Ratio parameter and rounding the product to the nearest integer. Connect a Sink block, such as a Display block or Scope block, to the output port to view the simulation output. The Sink blocks are available in the Utilities library in Simulink® Support Package for ARM Cortex-based VEX Microcontroller.

Dependencies

This port appears only when you select the Add output port to measure speed during simulation parameter.

Data Types: double

Parameters

expand all

Select the motor channel or pin on the ARM Cortex-based VEX Microcontroller that is connected to the DC motor.

Do not assign the same channel number to more than one DC Motor block within the same model.

This parameter is applicable for simulation behavior only. The gear ratio value is a scaling factor that scales the input value of the block (–128 to 127) to an approximate motor RPM. Adjust it accordingly to match the simulated motor speed with the motor speed in the actual installation.

Select this check box to add the output port to emit the speed of the DC motor during simulation.

Extended Capabilities

Introduced in R2016a