MSPM0_ValvanoWare  1.0
ECE445L starter code
Macros | Functions
MotorControl.h File Reference

RSLK PI motor controller. More...

#include <stdio.h>
#include <stdint.h>

Go to the source code of this file.

Macros

#define DUMPSIZE   200
 DUMPSIZE is the size of the dump buffer.
 

Functions

void MC_Init (void)
 Initialize tach input and motor outputs. More...
 
void MC_PIControlLoop (void)
 PI controller. More...
 
void MC_SetDesiredSpeed (uint32_t newSpeed)
 Set desired speed. More...
 
uint32_t MC_GetDesiredSpeed (void)
 Get desired speed. More...
 
void MC_SetKp1 (int32_t kp1)
 Set numerator for proportial control. More...
 
void MC_SetKp2 (int32_t kp2)
 Set denominator for proportial control. More...
 
void MC_SetKi1 (int32_t ki1)
 Set numerator for integral control. More...
 
void MC_SetKi2 (int32_t ki2)
 Set denominator for integral control. More...
 
int32_t MC_GetKp1 (void)
 Get numerator for proportial control. More...
 
int32_t MC_GetKp2 (void)
 Get denominator for proportial control. More...
 
int32_t MC_GetKi1 (void)
 Get numerator for integral control. More...
 
int32_t MC_GetKi2 (void)
 Get denominator for integral control. More...
 
int32_t MC_GetLeftE (void)
 Get controller error on left. More...
 
int32_t MC_GetRightE (void)
 Get controller error on right. More...
 
int32_t MC_GetLeftU (void)
 Get controller actuator output on left. More...
 
int32_t MC_GetRightU (void)
 Get controller actuator output on right. More...
 
uint32_t MC_Time (void)
 Get controller time. More...
 
uint32_t * MC_DumpRight (void)
 Get right speed log. More...
 
uint32_t * MC_DumpLeft (void)
 Get left speed log. More...
 

Detailed Description

RSLK PI motor controller.

Using input capture input and PWM output to control motor speed

Version
RSLK v2.03
Author
Daniel Valvano and Jonathan Valvano
Warning
AS-IS
Note
For more information see http://users.ece.utexas.edu/~valvano/
Date
July 5, 2026
RSLK RSLK motor pins
TM4C MSPM0 Description
PB7 PB8 ELA TA0_C0
PB2 PB12 ERA TA0_C1
ERB GPIO input (not connected)
ELB GPIO input (not connected)
RSLK motor pins
TM4C MSPM0 Description
PF2 PB4 Motor_PWML, ML+, IN3, PB.4/TIMA1_C0;
PF3 PB1 Motor_PWMR, MR+, IN1, PB.1/TIMA1_C1;
PA3 PB0 Motor_DIR_L,ML-, IN4, 1 means forward, 0 means backward
PA2 PB16 Motor_DIR_R,MR-, IN2