Announcement

Collapse
No announcement yet.

P2000 Serial RS-232 to Animatics Smartmotor

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • P2000 Serial RS-232 to Animatics Smartmotor

    Hello all.
    I am trying to setup a P2000 to control a Smartmotor Animatics servo through RS-232.
    I found 2 treads on the forum but I'm still quite stuck.

    So far, I am able to command the servo nicely through their windows software SMI.
    Laptop is connected to the motor via serial to USB to Animatics Demo cable (provides power and RS-232).
    Com is established and using their terminal I can change the speed and start a velocity command
    VT=200000
    G
    start the motor fine.
    VT=0
    G
    stops the motor.

    Now I'm trying to do the same thing in parallel from the PLC.
    Just trying to get the PLC to trigger the G command and extrapolate all needs and control from there.
    I setup the motor through the SMI, change the VT value and next thing the motor needs to start is the G command (Go)

    P2000 is connected with RJ12 serial port to DB15 on motor as follow:
    DB15_10 RS232 Tx ------ RJ12 pin 3 Rxd
    DB15_11 RS232 Rx ------ RJ12 pin 4 Txd
    DB15_13 RS232 SIG GND ----- RJ12 pin 1 Logic Gnd
    I checked few times, everything seems fine there.

    I probably have something off on the PLC side.
    RS232 com is setup as needed I think:
    -Read/Write
    -ASCII/Custom protocol
    -9600 baud
    -Parity none
    -Data bits 8
    -Stop bits 1
    -RTS mode OFF

    I don't have a lot of experience with the Serial communication. here is what I tried:
    I have setup my ASCII OUT command
    Serial Port RS232
    STRING: "$80G " I am not using a string variable and putting my command in " ". $80 should call for all motors (only 1 present) G is my GO command and the space is from my understanding one of the needed command terminator
    no termination
    no byte swap

    I tried $81, tried the space in the termination filed as well. I can't get the motor to GO once it's setup with SMI.

    Thank you for your help!
    Stay safe,
    Best Regards,
    Sylvain.


  • #2
    It looks like you're trying to send out a control character $80 (128) when in fact you're actually sending out three separate ASCII characters "$80". Productivity dropped the ball on this because it's not as easy to send out a control character like it is in the Do-More line.

    I had the same issue. Here's a response from a thread I made a while back:

    Originally posted by z28z34man View Post
    see view marq manual starting at 7-31. it uses a cpd instruction to copy 0x0D to a Unsigned Int 8 bit

    Adding Termination Codes
    You will need to add a termination character (“$0d”) to the end of the message string. In Productivity3000, non-printable characters cannot be directly inserted into a string tag. Here are the steps to insert the characters at the end of the string:
    1) Create an Unsigned Int 8 array and use a CPD instruction copy 0x0D to this array.
    2) Use the CPC (Copy Character) instruction to create a string of 1 character to move 1 byte into.
    3) Combine the two strings together into a string ready to send out the port using the PKS (Pack String) instruction.
    I was adding control codes at the end where as you'll be sending out one in the beginning.

    P.S. You probably already know this but the Animatics SMI terminal actually sends out the code ahead of whatever you send out of that terminal. It just doesn't show it. Your cable pinout also looks fine.
    Last edited by Adisharr; 03-29-2020, 01:03 AM.

    Comment


    • #3
      Adisharr,
      Thank you so much for your input.
      I spent the afternoon on this and I'm still stuck... I'm getting confused I think between the codes that the motor expects and the data I need to send.
      Animatics manual shows the following: <80>G<CR>
      this should tell all motors (I have only 1 in my case, probably called 81) to start moving.

      this means the following correct? hex 80, ASCII G, hex CR.
      When you are saying to add the termination character ("$0d") it's the same as saying 0x0d... right?
      so lost between the <>, $ and 0x terminology right now.
      would you have an example please on how to assemble these together. I have been trying with the copy character, copy data and it doesn't seem I'm going anywhere; brain is fried.

      Thank you!!!
      Best Regards,
      Sylvain.

      Comment


      • #4
        No problem Sylvain, generally when you see a string and they have something in "<>" that's a non-printable character or control code like carriage return, line feed, etc.. It just differentiates it from a printable part of the string.

        Animatic's 0x80 (Hex 80 or decimal 128) is a motor address number that sends data to all motors in a daisy-chain. I woulds always use that unless you have multiple motors. I believe by default they are addressed to 1 but that doesn't matter in your case.

        * Create a variable in the tag database named "INTA_ALL_MOTORS" of type integer, 8 bit unsigned array (1 column).

        * Create a variable in the tag database named "STR_ALL_MOTORS" of type string, length 15 (just the default)

        * Use the CPD command (copy data) to move 0x80 (source) into "INTA_ALL_MOTORS(1)" (destination)

        * Use the CPC command (copy character):
        copy type: integer array to string
        source: INTA_ALL_MOTORS
        destination: STR_ALL_MOTORS

        You now have a 1 character string with that 0x80 character <whew>

        Now take that tiny string and combine it with the other characters you need:

        * Use the PKS (Pack string) command:
        source: first line... STR_ALL_MOTORS length of 1
        source: second line... "G " length of 1 (include space after the G)
        destination: STR_MOTOR_GO_COMMAND

        * Use the AOUT command:
        serial port RS232
        string: STR_MOTOR_GO_COMMAND
        No termination
        In progress: MOTOR_CMD_BUSY
        Complete: MOTOR_CMD_DONE

        Try that and let me know if that works.

        What Smartmotor model, version are you using btw?

        Comment


        • #5
          Thanks for following up on this and the lengthy explanation.
          I believe I did everything you mentioned. still no luck.
          motor is NN2315D version 440C
          you mentioned on the PKS to use length of 1 on second line. it should be 2, correct? G + space "G ". (I tried both)
          copy data. Source 0x80 sent to INTA_ALL_MOTORS as 0x80
          copy Character. INTA_ALL_MOTORS is [128] goes to STR_ALL_MOTORS shows the Euro sign. looked up the ASCII table and Dec 128= 0x80= Euro symbol.
          PKS.
          Source Value Length Value
          STR_ALL_MOTORS Euro sign 1 1
          "G " G 2 2
          Destination STR_MOTOR_COMMAND = AC 47 20
          I don't get it, shouldn't we see 80 instead of AC? AC is Dec 172...
          ASCII OUT shows same AC 47 20

          I tried several times and it's not triggering the GO command on motor.
          When I send the command, I see a green blip on the Tx of RJ12 and that's it. ASCII out just shows MOTOR-CMD_Done.

          Thank you Adisharr.
          Best Regards,
          Sylvain.

          Comment


          • #6
            Originally posted by SylvainP View Post
            Thanks for following up on this and the lengthy explanation.
            I believe I did everything you mentioned. still no luck.
            motor is NN2315D version 440C
            you mentioned on the PKS to use length of 1 on second line. it should be 2, correct? G + space "G ". (I tried both)
            copy data. Source 0x80 sent to INTA_ALL_MOTORS as 0x80
            copy Character. INTA_ALL_MOTORS is [128] goes to STR_ALL_MOTORS shows the Euro sign. looked up the ASCII table and Dec 128= 0x80= Euro symbol.
            PKS.
            Source Value Length Value
            STR_ALL_MOTORS Euro sign 1 1
            "G " G 2 2
            Destination STR_MOTOR_COMMAND = AC 47 20
            I don't get it, shouldn't we see 80 instead of AC? AC is Dec 172...
            ASCII OUT shows same AC 47 20

            I tried several times and it's not triggering the GO command on motor.
            When I send the command, I see a green blip on the Tx of RJ12 and that's it. ASCII out just shows MOTOR-CMD_Done.

            Thank you Adisharr.
            Best Regards,
            Sylvain.
            Whoops yes length of 2 for the "G "

            Any chance you could post a screen shot or the project file?

            Comment


            • #7
              Please find the ladder attached.

              Thank you.
              Attached Files

              Comment


              • #8
                Thanks for attaching that, it looks fine. I just ran it on a P1-540 I have here and monitored the serial output into a terminal program. It's showing "<euro>G " like you said which is odd since <euro> is AC (172)

                Seems something is not working right, decimal 127 works fine. Anything in the extended ASCII range (128+) is not.

                127 = fine 0111 1111
                128 = AC 1010 1100
                129 = FD 1111 1101
                130 = 1A 0001 1010

                Can any of the support people chime in on this?

                Comment


                • #9
                  From the ASCII table I have:

                  character Decimal Hex Binary
                  <euro> 128 80 10000000
                  <not sign> 172 AC 10101100

                  Comment


                  • #10
                    Looks like their using another type of extended ASCII. The ones I've always referenced are here:

                    https://www.commfront.com/pages/ascii-chart

                    That still doesn't explain why 128 gets converted to 172 in the string unless I'm missing something (wouldn't be the first time)

                    I also tried this in Do-More Designer and it converts $80 to <euro> as well.

                    Comment


                    • #11
                      Hey Sylvain, I just installed SMI again and was looking at the output from the terminal program. It looks like it's just sending out a G<space>

                      If I try and send out a 1G it will then send out <$FD>G<space>

                      Have you tried just send a G<space>?

                      P.S. I just opened the port in the SMI terminal and did not address an actual motor.

                      Comment


                      • #12
                        Are we supposed to use ASCII Out or maybe Custom protocol out?
                        I just talked to tech support at AD. They mentioned that the address we need to send is probably not a character.
                        My understanding is that we need to send 80 47 20 through the serial, correct?
                        80 (all motors)
                        47 (G)
                        20 ( ) space

                        Comment


                        • #13
                          I thought the addressing of the motor was not expressed on the SMI terminal. Let me try.

                          Comment


                          • #14
                            I tried to send 47 20 (G and space). no it doesn't work.

                            Comment


                            • #15
                              Issue is now solved.
                              The communication issues I had were due to the following:
                              -The second RS-232 cannot be used at the same time as the first one (used on with Demo cable in my case).
                              -Motor was a bare bone OEM version, from back in the days. RS-485 hardware is not installed.

                              PLC is now connected to RS232 ports via Demo Cable. Working good.
                              Thank you for the help,
                              Best Regards,
                              Sylvain.

                              Comment

                              Working...
                              X