Beispiel #1
0
The connection to a Landungsbrücke is established over USB. TMCL commands are
used for communicating with the IC.

Created on 04.11.2019

@author: JM
'''
import PyTrinamic
from PyTrinamic.connections.ConnectionManager import ConnectionManager
from PyTrinamic.evalboards.TMC4671_eval import TMC4671_eval

PyTrinamic.showInfo()

connectionManager = ConnectionManager()
myInterface = connectionManager.connect()
TMC4671 = TMC4671_eval(myInterface)

print("CHIPINFO_DATA:                     0x{0:08X}".format(
    TMC4671.readRegister(TMC4671.registers.CHIPINFO_DATA)))
print("CHIPINFO_ADDR:                     0x{0:08X}".format(
    TMC4671.readRegister(TMC4671.registers.CHIPINFO_ADDR)))
print("ADC_RAW_DATA:                      0x{0:08X}".format(
    TMC4671.readRegister(TMC4671.registers.ADC_RAW_DATA)))
print("ADC_RAW_ADDR:                      0x{0:08X}".format(
    TMC4671.readRegister(TMC4671.registers.ADC_RAW_ADDR)))
print("dsADC_MCFG_B_MCFG_A:               0x{0:08X}".format(
    TMC4671.readRegister(TMC4671.registers.dsADC_MCFG_B_MCFG_A)))
print("dsADC_MCLK_A:                      0x{0:08X}".format(
    TMC4671.readRegister(TMC4671.registers.dsADC_MCLK_A)))
print("dsADC_MCLK_B:                      0x{0:08X}".format(
Beispiel #2
0
if __name__ == '__main__':
    pass

import PyTrinamic
from PyTrinamic.connections.ConnectionManager import ConnectionManager
from PyTrinamic.modules.TMCM1636.TMCM_1636 import TMCM_1636
import time

PyTrinamic.showInfo()

" choose the right bustype before starting the script "
#connectionManager = ConnectionManager(" --interface pcan_CANopen", connectionType = "CANopen")
connectionManager = ConnectionManager(" --interface kvaser_CANopen",
                                      connectionType="CANopen")
network = connectionManager.connect()

node = network.addDs402Node(TMCM_1636.getEdsFile(), 1)
module = node

" this function initializes the DS402 state machine "
node.setup_402_state_machine()

" communication area "
objManufacturerDeviceName = module.sdo[0x1008]
objManufacturerHardwareVersion = module.sdo[0x1009]

print("\nModule name:      %s" % objManufacturerDeviceName.raw)
print("Hardware version: %s" % objManufacturerHardwareVersion.raw)

" manufacturer specific area "