SmartMotor to Unity
 
Notifications
Clear all

SmartMotor to Unity

14 Posts
1 Users
0 Reactions
13.3 K Views
(@Rassel30)
Posts: 7
Active Member Guest
Topic starter
 

Hello,
I'm wondering if anyone has setup serial communications to a Modicon M340 PLC in Unity software?

I want to be able to command subroutines as well as receive status's back from the smart motor.

Any help would be greatly appreciated!

 
Posted : 21/08/2015 6:06 am
(@csearcy)
Posts: 66
Trusted Member Guest
 

We can do some simple Modbus communications that lets you call subroutines, read motor status, and read/write variables . It only works on the Class5 motors (firmware version 5.x.x.x.

 
Posted : 21/08/2015 1:40 pm
(@Rassel30)
Posts: 7
Active Member Guest
Topic starter
 

That would be great! Do you have any sample code to get me started. It is on a class 5 motor.

Thanks!

 
Posted : 21/08/2015 2:33 pm
(@csearcy)
Posts: 0
New Member Guest
 

I didn't think it would let me attach the file... but it did. Please let me know if you got it.

 
Posted : 21/08/2015 2:47 pm
(@Rassel30)
Posts: 7
Active Member Guest
Topic starter
 

Got the word document! Thanks a bunch I will look it over and test this on Monday once I get back to the office. If I have any more questions I will be sure to ask. Thanks again.

 
Posted : 21/08/2015 3:00 pm
(@Rassel30)
Posts: 7
Active Member Guest
Topic starter
 

csearcy, Do you know of anyone that has used the Modbus communication with a PLC? I think I understand the mapping but I'm not getting any responses back to the PLC. Was hoping someone else has done this to maybe step me in the right direction.

Thanks!

 
Posted : 26/08/2015 7:24 am
(@csearcy)
Posts: 66
Trusted Member Guest
 

I don't know of anyone here who has done it. If might be helpful to set up a sniffer to make sure the response is actually occurring.

 
Posted : 26/08/2015 12:01 pm
(@Rassel30)
Posts: 7
Active Member Guest
Topic starter
 

I was finally able to write to the user variables but what I'm unsure of is how to call subroutines. The document you posted just describes the "GOSUB(value)" command but it doesn't explain much more than that. Does this have to be a string command in my PLC that writes out the command?

 
Posted : 26/08/2015 12:15 pm
(@csearcy)
Posts: 66
Trusted Member Guest
 

I don't think you have to use any strings. I think you just have to write the value of the subroutine (ex. 123 would call C123 in your user program) into 0x8004 ...but I remember something about registers being indexed from 0 or 1... so that may need to be 0x8003 or ox8005 😉
Also... what firmware did you say you had on the motor? There was a bug in one of the earlier versions.

 
Posted : 26/08/2015 12:33 pm
(@Rassel30)
Posts: 7
Active Member Guest
Topic starter
 

Ok I'll try that. So basically if I have a subroutine of C50, I should be able to write 50 to the 0x8004 address and it should call C50. The firmware I have is 5.0.4.8.

Again thanks for the help!

 
Posted : 26/08/2015 12:40 pm
(@csearcy)
Posts: 66
Trusted Member Guest
 

That sounds correct... and that firmware should be good. Please let me know if you get it working.

 
Posted : 26/08/2015 12:48 pm
(@csearcy)
Posts: 66
Trusted Member Guest
 

Oops... I just got an email from one of our firmware guys. There is still a bug in 5.0.4.8 that keeps the GOSUB from working... and that's the latest release. I "might" be able to get a beta release to send to you ...but you'll have to treat it as such... and not distribute it.

 
Posted : 26/08/2015 12:54 pm
(@csearcy)
Posts: 66
Trusted Member Guest
 

Send me an email at csearcy@moog.animatics.com ...and I'll send you the beta... then I'll delete this post with my email address. 😉

 
Posted : 26/08/2015 12:56 pm
(@Rassel30)
Posts: 7
Active Member Guest
Topic starter
 

Just sent you an email csearcy.

 
Posted : 26/08/2015 1:00 pm
Share: