CIP read/write using class,instance,attribute

1,069 views
Skip to first unread message

Juha Backman

unread,
Jan 14, 2021, 4:25:18 AM1/14/21
to libplctag
Hi

I have SMC JXC91 stepper motor controller. It communicates with PLC using Ethernet/IP and CIP protocol. In the EDS file, there is only class, instance and attribute numbers wich are used to read and write values from the controller. I tried to use Python library cpppo, which worked and I get correct values from the controller. However, I need to use C++ library, because the code will be in realtime embedded controller.

How to create Tags using the values found from eds file?
In the API there are said anything about creating tag using class, instance and attribute numbers.


Assmbly:
 - Assem100
   * Path:  20 04 24 64 30 03
   * Class: 4
   * Instance: 100
   * Attribute 3
   * Members: 16
  
Param11 - STEP NUMBER REF (8)
Param12 - STATUS SIGNAL (8)
Param13 - STATUS FLAGS (16)
Param14 - CURRENT POSITION (32)
Param15 - CURRENT SPEED (16)
Param16 - CURRENT FORCE (16)
Param17 - TARGET POSITION (32)
Param18 - ALARM1 (8)
Param19 - ALARM2 (8)
Param20 - ALARM3 (8)
Param21 - ALARM4 (8)
Param22 - RESERVED1 (16)
Param23 - RESERVED2 (16)
Param24 -  RESERVED3 (32)
Param25 - RESERVED4 (32)
Param26 -  RESERVED5 (32)

Assmbly:
 - Assem150
   * Path:  20 04 24 96 30 03
   * Class: 4
   * Instance: 150
   * Attribute 3
   * Members: 16
  
Param300 - STEP NUMBER CHOICE (size 8)
Param301 - CONTROL FLAGS (8)
Param302 - ACT FLAGS (16)
Param303 - EXECUTION FLAG (8)
Param304 - OP METHOD (8)
Param305 - SPEED (16)
Param306 - TARGET POSITION (32)
Param307 - ACCELATION (16)
Param308 - DEACCELATION (16)
Param309 - PUSHUING FORCE (16)
Param310 - THRESHOLD (16)
Param311 - PUSHING SPEED (16)
Param312 - POSITIONING FORCE (16)
Param313 - AREA POINT 1 (32)
Param314 - AREA POINT 2 (32)
Param315 - FIXED WIDTH (32)



Kyle

unread,
Jan 14, 2021, 12:00:16 PM1/14/21
to libplctag
Hi Juha,

Thanks for looking at the library.  At this time it does not support raw CIP access.   That probably would not be too difficult to add, but I have no equipment on which to test this.   It is a feature I would like to add, but I am in the middle of building a parallel set of internal logic to lower the CPU and memory usage for embedded use (the goal is to keep performance at least as good as it is now).

Would it be possible to capture a few packet exchanges when you use cpppo (good library by the way)?   A tool like Wireshark does a good job.

When you read/write these assemblies do you read all params at once or just one at a time?  That's a lot of data if you need to write it back.

Best,
Kyle

Juha Backman

unread,
Jan 14, 2021, 12:36:10 PM1/14/21
to libplctag

Hi

Thank you for your answer.
I didn't go far with cpppo yet, because c/c++ is preferred language. I have just read  assem100. At least with cpppo it returns all params at once. According to manual also assem150 have to write similarly with all params.
JXC91 is "simple CIP device".  So path values are not used in cpppo.

I can try to capture some packets. Should I send those to here or where I put the files?
Can you estimate when you would have time to implement the feature?

I quess I have to continue with cpppo at this point because I haven't found any other c/c++ library that could be used.


Best regards

Juha

Kyle

unread,
Jan 15, 2021, 10:17:54 AM1/15/21
to libplctag
Unfortunately, my time is very packed right now.   All my spare time is going to making the library work better for small embedded systems and the core logic changes that those changes require.   That is going to take a while.   That said, the "direct CIP" features might be an interesting test for the new logic core.  I am doing PCCC over CIP over EIP first as that path is fairly ugly and will cause me to consider many different edge cases.  But it is likely to be weeks before I can really focus on other features :-(

Best,
Kyle

Juha Backman

unread,
Jan 20, 2021, 3:59:17 AM1/20/21
to libplctag
Hi

I'm interested in helping  if I have SMC actuators still in use then.
I continued to use the cpppo library and implemented the writing (controlling) part.
However, I didn't succeed with that. The controller doesn't listen to the command.

Kyle

unread,
Jan 21, 2021, 4:52:03 AM1/21/21
to libplctag
Hi Juha,

Yeah, I am tracking your progress with cpppo.   It is weird that the single attribute call did not work.   I will need to see if I can do some sort of "raw CIP" type of tag in libplctag.   I am starting to see how to do it fairly clearly on the new core logic, but it would be painful on the old logic.

The tag listing code is actually a bit similar, by using direct CIP commands like that.

I got the new core logic to read a PLC-5 data file (N) that is larger than a single packet.  That is more than the old logic does.   Still need to work on writes though.   Part of the challenge is not timing out.   PLC-5 networking is so sloooooooooowwwwwww!

Best,
Kyle
Reply all
Reply to author
Forward
0 new messages