This paper presents how to build an all-digital co-simulation platform of a mechtronic system so as to reduce the burden and error of system modeling. In the construction of a platform, a driving system, including a motor, a pulse-width modulation (PWM) and a controller, is simulated using Matlab/Simulink. The behavior of the mechanism is analyzed using the ADAMS software. By the proper interface function for the real-time communication between two parts of the models, a virtual working environment is established. Finally, a proportional integral derivative (PID) controller verifies the validity of the digital platform.