from PyTrinamicMicro.platforms.motionpy1.connections.rs485_tmcl_interface import rs485_tmcl_interface from PyTrinamic.modules.TMCM1640.TMCM_1640 import TMCM_1640 import logging MODULE_ID = 1 GP_BANK = 0 AP_AXIS = 0 logger = logging.getLogger(__name__) logger.info("Test module TMCM1640 parameters via RS485") logger.info("Initializing interface.") interface = rs485_tmcl_interface(module_id=MODULE_ID) logger.info("Initializing module.") module = TMCM_1640(interface) logger.info("Testing global parameter access.") logger.info("Getting global parameter ({}, {}) ...".format( "serialBaudRate", module.GPs.serialBaudRate)) logger.info("{}".format( module.getGlobalParameter(module.GPs.serialBaudRate, GP_BANK))) logger.info("Getting global parameter ({}, {}) ...".format( "serialAddress", module.GPs.serialAddress)) logger.info("{}".format( module.getGlobalParameter(module.GPs.serialAddress, GP_BANK))) logger.info("Getting global parameter ({}, {}) ...".format( "CANBitRate", module.GPs.CANBitRate)) logger.info("{}".format( module.getGlobalParameter(module.GPs.CANBitRate, GP_BANK)))
Created on 30.12.2018 @author: ED ''' if __name__ == '__main__': pass import PyTrinamic, time from PyTrinamic.connections.ConnectionManager import ConnectionManager from PyTrinamic.modules.TMCM1640.TMCM_1640 import TMCM_1640 PyTrinamic.showInfo() myInterface = ConnectionManager().connect() module = TMCM_1640(myInterface) module.showModuleInfo() motor = module.motor(0) """ Define motor configuration for the TMCM-1640. The configuration is based on our standard BLDC motor (QBL4208-61-04-013-1024-AT). If you use a different motor be sure you have the right configuration setup otherwise the script may not work. """ " motor configuration " motor.setMotorPolePairs(4) motor.setMaxTorque(2000) motor.showConfiguration()