//Demo für die SPS Drives 2003
//TMCM-110-42/SG
//

StallValue=3
Velocity=700
Acceleration=50


//Initialisierung
        SAP 6, 0, 800         //Maximaler Motorstrom
        SAP 203, 0, 2048       //Mixed Decay ausschalten
        SAP 5, 0, Acceleration
        SAP 205, 0, StallValue

//Hauptschleife
Loop:   WAIT TICKS, 0, 100
        SIO 0, 2, 0
        ROL 0, Velocity
        CSUB WaitUntilRunning
        CSUB WaitUntilStalled
        SIO 0, 2, 1
        WAIT TICKS, 0, 100
        SIO 0, 2, 0
        ROR 0, Velocity
        CSUB WaitUntilRunning
        CSUB WaitUntilStalled
        SIO 0, 2, 1
        JA Loop

WaitUntilRunning:
        GAP 3, 0
        COMP 0
        JC EQ, WaitUntilRunning
        RSUB

WaitUntilStalled:
        GAP 3, 0
        COMP 0
        JC NE, WaitUntilStalled
        RSUB

