ADI Trinamic Blog

We transform digital information into physical motion.

 
  • Newsletter
  • Blog Ethics
  • Legal/Impressum
  • Main Website
Menu
  • Newsletter
  • Blog Ethics
  • Legal/Impressum
  • Main Website
  • TMCL: Door Contact with Position Mode

    TMCL is the simple way to implement your motion control application. With this series of simple coding examples we want to provide you an easy start.

    This programs demontrates how to implement an application containing one or more parallel door contacts, e.g. automatic rolling window shade. The movement of the rolling window shade stops as soons as the door contact is closed (window is open). The movement continues right after the windows is closed again. This implementation uses the position mode as operation mode as operation mode.

    Before use: Restore Factory Defaults

    // *** Values that have to be adapted *** //
    vmax = 2000						//max. speed (0 ... 2047)
    amax = 1000						//max. acceleration (0 ... 2047)
    cmax = 100						//max. current (0 ... 255)
    doorContact = 0 				//define input number for door contact
    
    // *** Initialization / Set up axis parameter *** //
    SAP 1, 0, 0    					//set actual position to 0
    SAP 4, 0, vmax   				//set max. positioning speed
    SAP 5, 0, amax					//set max. acceleration
    SAP 6, 0, cmax    				//set max. current (0 ... 255)
    
    // *** Configure interrupt *** //
    VECT 39, Inp0change 			//define the interrupt vector
    SGP 39, 3, 3   					//configure interrupt to trigger on both edges of input 0
    EI 39 							//enable this interrupt
    EI 255 							//globally switch on interrupt processing
    
    
    // *** Initial check *** //
    startCheck: 					//before starting any movements check if door is open
       	GIO doorContact, 0 			//read input 0
       	JC ZE, startCheck 			//check again
    
    // *** Main Loop *** //
    loop:    
       	MVP ABS, 0, 512000			//turn motor to absoslute position 512000
       	WAIT POS, 0, 0				//wait until position reached
    	MVP ABS, 0, 0				//turn motor to absoslute position 0
    	WAIT POS, 0, 0				//wait until position reached
    	JA loop						//jump to loop
    
    // *** Interrupt routine *** //
    Inp0change:  
       	GIO doorContact, 0 			//read input 0
    	JC NZ, end 					//jump to end if not zero
        MST 0              			//else stop motor 0         
    wait:  							//wait for the door to be closed
        GIO doorContact, 0 			//read out input 0
        JC ZE, wait 				//jump to enable if not zero         
    enable:    						//start motors after door is closed
        SAP 138, 0, 0 				//motor 0 positioning mode
    end:   
       	RETI     					//END of interrupt  
    

    This sample is tested with TMCM-1140, TMCM-1161, TMCM-6110. For more details look at the corresponding firmware manual.

    Share this:

    • Twitter
    • Facebook
    • LinkedIn
    • Pinterest
    • Print
    • Email

    Related

    December 2, 2015 / Jonas P. Proeger / 0

    Categories: Code Snippet, Tutorial

    Tags: door contact, shade, switch, TMCL

    TMCL: Timer Interrupts TMCL: Using the stallGuard Interrupt

    Comments are currently closed.

Recent Posts

  • Guest Blog: UBC Thunderbots
  • Guest Blog: TURAG
  • Guest Blog: School of Engineering Telecom Physics University of Strasbourg
  • Guest Blog: STAR Dresden
  • Pushing the Limits of Stepper Motor Control in 3D Printing

Social

  • View trinamic.mc’s profile on Facebook
  • View Trinamic_MC’s profile on Twitter
  • View trinamic’s profile on GitHub
  • View UC4SHA5_GAw1Wbm2T2NWpWbA’s profile on YouTube

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

Newsletter

 

Info

Waterloohain 5
22769 Hamburg
+49 40 514 806 40

Tags

3D printer 3d printing arduino BLDC cDriver code code snippet coolStep drive Driver ease of use ethercat eval kit evaluation kit Field Oriented Control FOC GUI guide heliostat How-To IC linear stage motion controller motor driver open source hardware programming rtmi servo servo controller IC setup silentstepstick stealthChop stepper stepper motor stepper motor driver stepper motor driver ic stepper motors technology TMC4671 tmc5130 TMCL TMCL-IDE TRINAMIC TRINAMIC Motion Control tuning

Tag Cloud

    3D printer 3d printing arduino BLDC cDriver code code snippet coolStep drive Driver ease of use ethercat eval kit evaluation kit Field Oriented Control FOC GUI guide heliostat How-To IC linear stage motion controller motor driver open source hardware programming rtmi servo servo controller IC setup silentstepstick stealthChop stepper stepper motor stepper motor driver stepper motor driver ic stepper motors technology TMC4671 tmc5130 TMCL TMCL-IDE TRINAMIC TRINAMIC Motion Control tuning

Pages

  • Blog Ethics
  • Newsletter
  • Player Embed
  • Search Videos
  • User Videos
  • Video Category
  • Video Tag

Categories

  • Competition
  • Guest blog
  • Industry News
  • Jobs
  • Myths about Motors
  • Open Source Hardware
  • Products
  • Projects
    • DIY
    • University Projects
  • Research
  • Social
  • Software
  • technology
  • Trade Shows
  • Tutorial
    • Code Snippet
  • Uncategorized

Copyright © 2015 TRINAMIC BlogTheme created by PWT. Powered by WordPress.org

loading Cancel
Post was not sent - check your email addresses!
Email check failed, please try again
Sorry, your blog cannot share posts by email.