Command not working

2 months 3 days ago #29536234 by nightline
I've a SDC2160 with an electic cylinder connected. This cylinder has a brushed motor and a hall type encoder. I can jog the cylinder back and forward in open loop, and see de counter 1 going up and down, and feedback 1 is showing the speed while moving.
This way I send the cylinder complete out, stop the motion command, home the counter with: setcommand(_Home, 1). Then is switch to closed loop with: setcommand(_MMOD, 1, 3) for example. If I now read the operation mode of motor 1, it always shows a "0", doesn't matter which operating mode I set.
And when I give a positioning command there is no motion. I tried the following commands: setcommand(_PR, cc, nn) , setcommand(_MPOSREL, cc, nn) and setcommand(_MOTPOS, cc, nn). 
None of these commands gives a reaction of the controller.
I've set all P gains to 10.
What can be wrong?
Thanks in advance!
Jack

Please Log in or Create an account to join the conversation.

1 month 4 weeks ago - 1 month 4 weeks ago #29536240 by nightline
Replied by nightline on topic Command not working
Well I found what was wrong, I gave a setcommand for MMOD while this should be a setconfig. 
So this is solved, but now I'm facing another issue:
See the code below:
print("starting ... \r")
iSeq = 0
wait(1000)
print("iSeq= ", iSeq," \n")
wait(1000)
if iSeq = 0 then
    iseq = iSeq +1
    print("iSeq= ", iSeq," \n")
end if

Top:
Speed = abs(getvalue(_S, 1)) ' Read motor speed from Encoders

if iSeq = 1 then
    if Speed < 5 then
        print("Speed=", Speed," \n")
        setconfig(_MMOD, 1, 0) ' Configure channel 1 in open loop mode
        wait(10)
        OperetingMode = getvalue(_MMOD, 1)        
        setcommand(_GO, 1, 500) ' Apply 10% reverse command to motor 1
        wait(10)
        MotorCommand = getvalue(_M, 1)    
        wait(500)
        print("OperetingMode=", OperetingMode," \n")
        print("MotorCommand=", MotorCommand," \n")
        goto Top
    else
        iseq = iSeq +1
        print("iSeq= ", iSeq," \n")
    end if    
end if

if iSeq = 2 and Speed = 0 THEN
     iseq = iSeq +1
    print("iSeq= ", iSeq," \n")
end if

I would expect that my motor starts spinning in the forward direction. With the print commands I can see that the operating mode is 0 ( open loop ) and the speed command is 500, like it should be. But the motor isn't spinning at all....

What can be wrong here?

Please Log in or Create an account to join the conversation.

Time to create page: 0.054 seconds