Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

SoftMotion Servo Example

rools94
2017-08-08
2017-08-10
  • rools94 - 2017-08-08

    Hi everybody,

    I'm actually trying to control several servo motors, using the example provided by Codesys as basis program.
    Even though I've followed all the steps as described in the manual, the motor won't be activated in any case.
    Despite the program marks all the components as connected and the visualization shows a movement , the motors remain completely still and silent.

    The several parameters of the are set as defaultand also the address and frequancy of the Adafruit_PWM_SoftMotion are still respectively 0 and 50 Hz.

    I've left the I2C_master unchanged as the latter.

    It seems like the entire program remains entirely virtual.
    Thus my question would be: what should I modify in the program in orer to connect the virtual dirve ("SM_Drive_Servo") to the solid drive?
    In other words, I need to find a way to connect the variable SM_Drive_Servo of type AXIS_REF_SERVO to the adress of the real drive.
    Though the only adresses that the RaspberryPi can detect are the ones of the Adafruit_PWM_SoftMotion hats.
    Indeed normally the drives are controlled directly executing the command of the Adafruit_PWM_SoftMotion library (alrPWM[Pin_Nr]), which feeds the pwm signal directly into the pin.
    Therefore I instinctively tried to do approximatively the same with the SM_Drive_Servo, finding in the library the property "connector" of typ POINTER TO IoConfigConnector.
    Am I on the right way to address the motor correctly? If yes, how can I instert the pin number in this particular data type?

    Thanks in advance for your help,

    Francesco Paris

    P.S. I'm working on the program available among the examples, hence I did not attach the complete program.

    IMG: Servo1.JPG

    IMG: ServoParameters.JPG

    IMG: PWMadresses.JPG

    IMG: AdafruitLibrary.JPG

    IMG: ServoConnectorProperty.JPG

     
  • LukaszBien - 2017-08-10

    hi,
    Recently I was playing with this and it has worked straight away. I was using Adafruit softmotion example.
    All I needed to do was to set I2C Address of Adafruit PWM device and download the program.
    PS
    The common mistake is to set address in decimal instead of hex (e.g. 16#40)..
    Regards
    Lukasz.

     

Log in to post a comment.