Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Microcontroller with GPIO, ADC and DAC Connections

This example shows how to model the interface between a microcontroller unit (MCU) and a physical system. Here the microcontroller's GPIO, ADC and DAC connections are used to control a DC motor and connected load with limited angle travel. Load angle measurement is via a potentiometer sensor. This measurement is calibrated by initially ramping the rotor position until the photodiode detects the zero-angle light pulse from the LED. Once calibrated the MCU commands a 0.1Hz 45 degree amplitude sinusoid.

Model

Controller Subsystem

GPIO 1 Subsystem

Motor Driver Subsystem

Photodiode Subsystem

Potentiometer Subsystem

Simulation Results from Simscape Logging

The plot below shows the performance of the motor control system. At the start of simulation, the controller spins the motor until it finds a known position of the motor shaft (0 degrees). After that, the controller tracks the reference signal.

Was this topic helpful?