Please enable JavaScript to view this site.

MovingCap Ethernet Drives - Software Manual

Navigation: MovingCap CODE - Python Programming

Examples and Documentation for MovingCap Commands

Scroll Prev Top Next More

TIP: All documentation files(.pyi files) and example programs (.py file) can be found in the www.movingcap.com Service Portal, search for CODE there.

MicroPython basic examples for MovingCap ETH

Example program

Description

mcdriveModuleOverview.py

Demonstrates every single command of the mcdrive module in a functional test program for the MovingCap drive

driveSimplePosTest.py

A simple positioning application

Python modules for MovingCap

Various Python modules/libraries are available in MovingCap CODE to use the MovingCap-specific drive and communication functions. These must be integrated at the start of your Python program using the import command.

Python module / import command

.pyi documentation file *1)

Description

import mcdrive.py

 

or abbreviate the name as:
import mcdrive.py as mc

mcdrive.pyi

 

Alternatives in other languages:
en/mcdrive.pyi
fr/mcdrive.pyi
it/mcdrive.pyi
es/mcdrive.pyi

MovingCap drive functions for setup and movement, as well as writing and reading CiA 402 objects.

The associated .pyi file shows definitions and descriptions of all available commands.

TIP: To obtain the documentation in a language other than English, copy the mcdrive.pyi version from the appropriate subdirectory.

import sys

sys.pyi

System-specific functions for program flow, time control and version detection, in particular sys.cycle_time_ms(x)

NOTE: The following functions are supported for compatibility with older versions and MovingCap CAN bus motors with Pymite/Python-on-a-chip:
sys.time
sys.wait
For new applications, use sys.cycle_time_ms or the functions of the time module.

import time

time.pyi

Time functions, part of the Micropython utime/time module. Common functions:

time.sleep_ms(x) - waits x milliseconds, replaces sys.time from older examples, see above.

 

start = time.ticks_ms()
elapsed = time.ticks_diff(time.ticks_ms(), start)

import mcnet

mcnet.py

MovingCap communication functions for network.

Allows you to manage application-specific socket connections - open/close/read/write. TCP server, TCP client, UDP server and UDP peer/client connections are possible.

import refgo

refgo.pyi

1) Accepts RefGo commands in text form, as an alternative to the mcdrive module.
 
Example: You can use refgo.cmd("TS") to query the drive status.

TIP: Example in the movingcap.de service portal, search there for UsingRefGoCommandsFromPythonScript.

2) Allows you to extend the RefGo protocol / TCP port 10001 with additional/your own commands or to execute additional reactions for existing RefGo commands.
 
TIP: Examples in the movingcap.de service portal, search there for refGoExtension.

*1) .pyi file(Python Interface Definition) to support program creation with an intelligent editor on the PC.

TIP: Use Visual Studio Code on your PC to edit the Python program. Copy the desired language variant of the mcdrive.pyi file into the same folder in which you create your .py program. Visual Studio Code (or another clever editor) recognizes the import mcdrive command in your program, evaluates the corresponding mcdrive.pyi file and now displays the associated documentation for each mcdrive... command:

movingcap_code_editing