Jump to content

Isakovic

Privileged Member
  • Content Count

    152
  • Joined

  • Last visited

  • Days Won

    9

Isakovic last won the day on June 14

Isakovic had the most liked content!

Community Reputation

27 Excellent

1 Follower

About Isakovic

  • Rank
    UniGuru

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

1,716 profile views
  1. I'm not sure about reinitializing Configuration FB. It does have addresses for only 15 slaves, but if I remember right when you execute read command it will read from whichever slave the PLC is connected to, disregarding the "Slave ID number" that is in the read command. Maybe this was an issue from some older VisiLogic version when I encountered this for the first time. I've wanted to test this for some time now, but don't have the will. So, I tested this. One master reading 3 slaves one after another from the same Socket. No slaves were defined, every read command had Slave 0 and it worked. Turns out you don't need to have defined slave addresses in Modbus Configuration FB. Modbus commands are sent to device which is connected at the moment of execution, no matter what is in the Slave ID field. Should we add slave addresses in Configuration FB or not (I don't see the point since connection has to be made manualy), what is a good practice here? Is it OK to communicate with more than 15 devices without reinitializing Configuration FB, like in newbie88's case?
  2. I'll tell what worked for me regarding your questions, newbie88. Steps go as you described. Connect to 1-Read-Disconnect; Connect to 2-Read-Disconnect... You are using TCP so connection is required. Delay of 0.4 seconds after disconnecting from one client before connecting to second one, and another 0.4 seconds before sending Modbus commands, maybe this can be shorter (probably, you should experiment). For 4 clients this cycle takes 3.9 seconds, if time is critical you may need to use more sockets or go to UniStream. For any slave that drops number of retries and timeout will add extra delay. I'm not sure about reinitializing Configuration FB. It does have addresses for only 15 slaves, but if I remember right when you execute read command it will read from whichever slave the PLC is connected to, disregarding the "Slave ID number" that is in the read command. Maybe this was an issue from some older VisiLogic version when I encountered this for the first time. I've wanted to test this for some time now, but don't have the will. This depends on how you make your logic. If you use that standard form from Examples You can go to next step after all read bits are low for how many read commands you have. I found it works without putting delays between commands, just using "Function in Progress" bit to stop multiple read commands from interfering one with another. Don't forget that system bit that shows if socket is connected should be a condition before blasting Modbus commands. Hope it helps, tell us how it goes.
  3. Great topic. I have a question for eminent wizard kratmel. Is it recommended or not to use different power supplies for main power and output power? If both are referenced to ground I guess not, but what if they are floating? I remember a case when I had safety circuit cut +VO line as a bonus security on Jazz unit. This rebooted PLC when activated so I don't use it anymore. Why was this happening? It was the same supply for PLC and outputs.
  4. Yea, this last version is a little messy. Status 19 means that the socket is initialized properly, when it connects it changes value to 23. Change those port numbers and separate rungs as Flx said and tell us how it goes. If you need to connect from a PC over Ethernet just initialize one socket as TCP slave.
  5. Your best option is to contact the company/person that made the original program. If that is not an option contact Unitronics support directly. Or write program from scratch. If you can't get your hands on the program this is probably what has to be done.
  6. 1. You have correctly initialized Socket 3. What is the purpose of MB11? Looks to me like it has to be switched on manually. Also it is better to call "Socket Connect" block over transition contact. Maybe something like this: It will reconnect after losing connection. In rung 3 you are closing socket after Modbus command, you don't need to do that. Maybe socket status changes to other value than 23 while sending Modbus command and may trigger connect block if it stays like that for more than 5 seconds in this example. You may have to investigate this. Also look into "Keep alive" values for sockets if they suit your application. Generally it is wise to have logic that will recognize connection problems in situations like this and try to automatically clean up what needs cleaning up and connect what needs connecting. 2. 🤷‍♂️ 3. Initialize 2 more sockets. You have 8 sockets available in V700. Manage them the same way like the first one. They can work independently. If you ever need to communicate with more devices than you have sockets you need to make logic to connect and disconnect from various slaves, but that's not the case here. Leave one socket for your PC connection.
  7. Will reusing the same operands (system or standard) in several places in program be a problem? I often use the same memory place as auxiliary variable for several calculations in the same scan.
  8. You can linearise as many analog inputs as PLC has them. You can linearise other numeric values, I don't think there's any limit.
  9. What kind of motor are you using? I don't think it's an encoder issue. From your explanation it seems the inertia is causing inconsistency in positioning. It's hard to drive the system precisely with start/stop motion with relatively fast motor. If steppers and servos are out of question maybe you can try with VFD. To have a significantly slower speed when you approach desired position. Or add a gearbox, if there is space and speed reduction isn't much of an issue for machine performance. Since you mentioned motor with brakes. I had one project where I had control done just as you did here but with braking motor. Precision was 1-2mm (within tolerance for the project), even when carrying heavy load. Brakes wear off fast though.
  10. 1. I don't think you need to have port 502 on your side on any socket for Modbus to work as master. Try it out. 2. In rung 5, MB4 should be set, not reset. It should be reset after Modbus block in rung 6.
  11. Alternative to this is using "Struct" function. This is how I see it, someone correct me if I'm wrong. Vector length is number of 16 bit registers that is taken in memory, MI is 16 bits long. So length 4 means 4 MIs will be written into. In your case you write into ML which is 32 bits, so you are overwriting 2 consecutive MLs. I guess that is happening, because when I do it I read all needed into MIs and use "Struct" function to pack read registers and form what I need. This way is maybe better in some cases because you have control over the data you read. ML register are signed, so if you read the number of pulses or whatever from your servo that is always positive you can overflow it and go into negatives for large numbers, in that case you need DW register as your destination ("Master:Start of Vector"). I use this method when reading floats from power meters, because you can't write directly into MF. If your method works and gives you what you need than it is correct and you don't need to change anything and complicate things.
  12. Try to increase "Every Period" time, that helped me in similar situation. I don't know if it is still a thing in UniLogic like in VisiLogic, but also break rung 5 into more rungs. Cramped rungs used to make issues.
  13. In rung 9 try calling connect function over a transition contact. Also looks like you are connecting to 2 slaves simultaneously over the same socket, I think this won't work, you need to connect to first slave, run Modbus commands, disconnect, connect to second one, run Modbus for second one. Or use two sockets. Tell us how it goes.
  14. Do it elegantly as Flex said or: 1000 0000 0000 0000 0000 0000 0000 in decimal is 134217728. If you store this number in DW150 4th bit (or 28th depends how you count) will be zero. I remember working with older ladder software that didn't have bits manipulation. If you needed to make a certain combination of 1s and 0s in register, first you reset register (store 0), than if bit 1 is 1 add 1, if bit 2 is 1 add 2, if bit 3 is 1 add 4, if bit 4 is 1 add 8.... Good times.
×
×
  • Create New...