This paper deals with real time DC motor speed control, using the low-cost new generation TMS320LF2812 digital signal processor (DSP). An optimal control algorithm which can be realized through event manager (EV) module of the DSP is proposed. According to the error signal DSP processor will change the duty cycle of the PWM (which can be named mark-space ratio). The comparison between two signals (reference and actual speed) in addition to the PWM technique are included in a C++ language program. Code composer studio (CCS) is used to load and run the program to achieve real time control. Theoretically Matlab/Simulink software was used for simulation the proposed circuit before implementation. A PID controller is designed using MATLAB to generate a set of coefficients associated with the desired controller characteristics.