Jump to content

New to PLCs and need guidance


Recommended Posts

Hi all. I am brand new to all this, so please don't savage me too badly.

I have a Vision 350 here, and I want to get it talking to two different Modbus machines - a heat pump and a variable speed motor drive. Initially I just want to poll the units from my Vision to find out stuff like speed of drive, or heat pump temp. I have modbus "maps" for both units so that helps! Eventually I'd like to use the Vision to control our entire pool set-up - I work for a swimming pool equipment wholesaler. This is really just me trying to teach myself something new, but getting more control over the VSD would be great (eventually).

I've started off following the videos on Modbus and on PLC basics but I'm struggling with some things, just because I'm no programmer and this is all new to me.  Could anyone please suggest some good starting points - tutorials, videos, further reading - that might help? For example I don't know why, as the first step in the Modbus vids, a system bit is used in the first net. I must have missed what this is/does somewhere - I feel like I have missed a set of videos inbetween the "What is a PLC/HMI" and "How to work Modbus" ones!!

Thus far my understanding is that you make a pretty interface screen, tie the things you're doing on that screen to "nets" (which are basically steps in a program) and the Vision will follow the structure of the ladder from top to bottom.  I *think* that the Vision (as Master) polls the Slave units, gets data from them from whichever modbus address I point it at, loads that data into its own memory and uses the data as variables that I've defined, then keeps on repeating that process. Am I anywhere near right, here?

Thanks

 

Alison

Link to comment
Share on other sites

  • MVP 2023

Your initial investigation is a good start.

If you haven't already, download and install Visilogic.  Then under the Help menu choose "Examples" and start digging through the folders to see what's available.  Eventually you'll find Modbus examples under the Project-> Communications folder.

Do your heat pump and VFD use serial or Ethernet communications?

 

Joe T.

Link to comment
Share on other sites

  • MVP 2023

Unitronics presents training webinars regularly which get posted to their YouTube channel. Browse those videos to get basic training on VisiLogic. Here's a link to one to get you started:

I'll also suggest that you browse the Help file in VisiLogic in addition to the example projects, as Joe mentioned.

Link to comment
Share on other sites

On 3/3/2023 at 6:53 AM, Alison said:

Hi all. I am brand new to all this, so please don't savage me too badly.

I have a Vision 350 here, and I want to get it talking to two different Modbus machines - a heat pump and a variable speed motor drive. Initially I just want to poll the units from my Vision to find out stuff like speed of drive, or heat pump temp. I have modbus "maps" for both units so that helps! Eventually I'd like to use the Vision to control our entire pool set-up - I work for a swimming pool equipment wholesaler. This is really just me trying to teach myself something new, but getting more control over the VSD would be great (eventually).

I've started off following the videos on Modbus and on PLC basics but I'm struggling with some things, just because I'm no programmer and this is all new to me.  Could anyone please suggest some good starting points - tutorials, videos, further reading - that might help? For example I don't know why, as the first step in the Modbus vids, a system bit is used in the first net. I must have missed what this is/does somewhere - I feel like I have missed a set of videos inbetween the "What is a PLC/HMI" and "How to work Modbus" ones!!

Thus far my understanding is that you make a pretty interface screen, tie the things you're doing on that screen to "nets" (which are basically steps in a program) and the Vision will follow the structure of the ladder from top to bottom.  I *think* that the Vision (as Master) polls the Slave units, gets data from them from whichever modbus address I point it at, loads that data into its own memory and uses the data as variables that I've defined, then keeps on repeating that process. Am I anywhere near right, here?

Thanks

 

Alison

it uses SB because yo just need to run it once at the beginning, there are some notes about that on the documentation..

 

image.thumb.png.9430fba1ca614adca26db980538c64b7.png

 

I would start reading, reading the documentation regarding the Modbus protocol in general.

 

Link to comment
Share on other sites

2 hours ago, Alison said:

Both units use Modbus RTU over serial which is a relief, I don't want to have to learn networking too!!

the protocol works pretty much the same over TCP/IP or serial

the main point to understand in the protocol is that Modbus works with memory registers and that there is a table and "register codes" depending on the type of each variable.

also, some devices start counting from 0 others from 1 so it depends really on the implementation of the protocol on each device, for example in the Unitronics documentation there is a "formula" on how to calculate the Modbus addressess based on the type of operand. Wich, I think is different based if its "Enhanced" version or "standard" version.  having said that, that doesn't mean anything without understanding how the Modbus addresses works.

Link to comment
Share on other sites

  • MVP 2023

Is your V1040 new, or does it already have a program in it? If there's already a program, it may have initialized COM1 as something incompatible with VisiLogic. Go into INFO Mode and check it. Also, screenshot your Connection window so we can see if that is set up properly.

Link to comment
Share on other sites

Okay, bear with me here.

 

I have a Vision 350 J T38. This has a USB micro port for programming (great, that works, yay, and I am happily plugging away through the basics of ladder logic, thank you for that!)

It also has an RJ11 port, and RJ45 which is labelled EXP PORT.

The VFD I want to talk to has a USB port(s).

I have also got a USB/RS485 adaptor cable, which has 6 wires on - red, green, brown and black, plus orange and yellow.

How do I get from the USB port on the VFD, to the RJ11 port on the PLC? I have some RJ11 phone cable but that only has four wires in.  I am assuming the RJ45 port on the PLC is for extra I/O units only, or am I making an error here?

 

Link to comment
Share on other sites

  • MVP 2023
2 hours ago, Alison said:

How do I get from the USB port on the VFD, to the RJ11 port on the PLC? I have some RJ11 phone cable but that only has four wires in.  I am assuming the RJ45 port on the PLC is for extra I/O units only, or am I making an error here?

The RJ11 port on the PLC is a standard serial port. Converting from USB to serial is fairly straightforward (I think), but I'm not a wiring guy. I have seen USB-to-RJ11 cables on the market.

Yes, the RJ45 port is for connecting external I/O modules.

Unitronics has a lot of documentation available online. I recommend reviewing it. Here is the User Guide for the V350-JT38:  

https://unitronicsplc.com/Documents/Vision/PLC/UG_V130_350_430-T38.pdf

 

Link to comment
Share on other sites

5 hours ago, Alison said:

Okay, bear with me here.

 

I have a Vision 350 J T38. This has a USB micro port for programming (great, that works, yay, and I am happily plugging away through the basics of ladder logic, thank you for that!)

It also has an RJ11 port, and RJ45 which is labelled EXP PORT.

The VFD I want to talk to has a USB port(s).

I have also got a USB/RS485 adaptor cable, which has 6 wires on - red, green, brown and black, plus orange and yellow.

How do I get from the USB port on the VFD, to the RJ11 port on the PLC? I have some RJ11 phone cable but that only has four wires in.  I am assuming the RJ45 port on the PLC is for extra I/O units only, or am I making an error here?

 

Do you have the VFD model? its odd to me that it has an USB port, I haven't seen any RS4-85 port using USB (I may be wrong), but I have seen RS485-To USB converters embedded (Like Unitronics do with the serial port and mini USB, which is the same com port).

If its RS485 you just need 2 wires (and  Ground).  check that the hardware configuration on the PLC is set to RS-485.

Link to comment
Share on other sites

  • 4 weeks later...

Hi guys. First up, I have gone through all the MODBUS vids (thanks) and used the examples, but there are a few things I don't understand. I'm really sorry to ask, because I know these are simple things for you all, but I don't know where else to find this info... there is no one else I can ask.

 I have this V350 which is my "master" and a heat pump which is Modbus enabled, that I am trying to read data from, which would be the Slave. I have no means of programming anything on this heat pump; I cannot download a program to it, so I cannot put the Modbus Slave demo program on it (do I have to do this?! I mean how do you handle that, with stuff that isn't a PLC? Do they default to being "Slave" anyway?). I have some info for it that tells me the default address for the heat pump is  9, and that the COM setup is defaulted to 9600, 8, E, 1 (although I may be able to change this if I have to). I can upload the modbus "map" I have for the heatpump if it helps?

 

So I used the example Modbus Master program given in the videos and I have changed the settings in the COM INIT function block accordingly.

I would like to read the heat pump's setpoint temperature, then display it on the HMI.  According to the info I have the heat pump uses holding register 0x24 for this value. I'm assuming this is a hex value and I have to covert to decimal, which is (I think) 36? so I have entered "36" as the value for the start vector in the MODBUS RHR fb. The length of that vector is (for now) just 1, as I am only reading this one register. I have also set the slave ID to 9 here too. The demo program takes the value from that register, and plonks it into MI5 on the Master.  Well, nope. I can't get it to work. 

I am using the V350's RJ11 connection. It's only 2 wires for  MODBUS  although the connection on the heat pump has 3: A+, B-, and GND. I was just using A and B.

If I can crack this little bit, I am pretty happy that I can do whatever else I need, it's just getting the basics - and teaching yourself something is never easy! What am I missing here? Is it that  my physical connections are wrong, or is it programming..? Any advice is so welcome. I feel very stupid.

 

Alison

 

 

Link to comment
Share on other sites

  • MVP 2023

First contact with serial communication is always black magic.  Don't feel bad.

Ancient Chinese Secret - if you're plugged into the USB port and logged in then the COM1 RJ11 port is disabled.  They use the same interrupt.  You'll need to put some more registers on the display or use Info Mode to watch the Modbus communication in action unless you've installed a second com board in the PLC.

I'm assuming you've set the internal jumpers to RS485.  RS485 can be very finicky.  Leave termination off for now.  I've found that sometimes you have to terminate one end or the other but not both for it to work.  On a short run, the 130 ohm termination resistors effectively in parallel can overload the drivers and suck the life out of the signal.  Put a scope on them if you really want to see what's going on.

The GND connection in RS485 is often not used, so I wouldn't worry about that.  It is totally possible that you have A and B connected backwards, as different manufacturers will assign the + and - polarity arbitrarily.  In the original RS485 specification the B terminal is positive.

I always have to chase down the port wiring in the Help and it's not easy to find.  For reference, here it is:

image.png.ac10c4d65e4ddb442a4efdda974660ac.png

Can you upload a sketch of how you have it wired?

Can you upload your PLC program so we can see how you've configured Modbus and how you're calling it?

Can you post a link to the heat pump manual detailing the communication? 

Joe T.

Link to comment
Share on other sites

22 hours ago, Alison said:

Hi guys. First up, I have gone through all the MODBUS vids (thanks) and used the examples, but there are a few things I don't understand. I'm really sorry to ask, because I know these are simple things for you all, but I don't know where else to find this info... there is no one else I can ask.

 I have this V350 which is my "master" and a heat pump which is Modbus enabled, that I am trying to read data from, which would be the Slave. I have no means of programming anything on this heat pump; I cannot download a program to it, so I cannot put the Modbus Slave demo program on it (do I have to do this?! I mean how do you handle that, with stuff that isn't a PLC? Do they default to being "Slave" anyway?). I have some info for it that tells me the default address for the heat pump is  9, and that the COM setup is defaulted to 9600, 8, E, 1 (although I may be able to change this if I have to). I can upload the modbus "map" I have for the heatpump if it helps?

 

So I used the example Modbus Master program given in the videos and I have changed the settings in the COM INIT function block accordingly.

I would like to read the heat pump's setpoint temperature, then display it on the HMI.  According to the info I have the heat pump uses holding register 0x24 for this value. I'm assuming this is a hex value and I have to covert to decimal, which is (I think) 36? so I have entered "36" as the value for the start vector in the MODBUS RHR fb. The length of that vector is (for now) just 1, as I am only reading this one register. I have also set the slave ID to 9 here too. The demo program takes the value from that register, and plonks it into MI5 on the Master.  Well, nope. I can't get it to work. 

I am using the V350's RJ11 connection. It's only 2 wires for  MODBUS  although the connection on the heat pump has 3: A+, B-, and GND. I was just using A and B.

If I can crack this little bit, I am pretty happy that I can do whatever else I need, it's just getting the basics - and teaching yourself something is never easy! What am I missing here? Is it that  my physical connections are wrong, or is it programming..? Any advice is so welcome. I feel very stupid.

 

Alison

 

 

you just need the master program; those examples are to demonstrate how to use the PLC as master or as Slave. devices that are slaves and non-programable like your VFD should have the configuration in the documentation along with a table with address table that they use to transmit the data.

I'll suggest getting an USB to RS485 adapter (always a handy tool to have) and use a Modbus program on the computer to test first. 

Amazon.com: Teyleten Robot USB to RS485 485 Converter Adapter CH340T Chip 64-bit Suitable for Windows 7/8 MacOS WinCE5.0 XP(Pack of 3) : Electronics

Modbus Master Simulator - free software utility for testing Modbus slave devices (dxp.pl)

as I mentioned before you need to check that your hardware part is OK, then once you are sure it works you can start with the PLC side.

12 hours ago, Joe Tauser said:

you're plugged into the USB port and logged in then the COM1 RJ11 port is disabled.

the problem is that on the PLC it will be difficult to debug if you are using USB port to communicate as Joe mentions. I prefer to use the ethernet port for programing the PLC/ and debugging using online mode.

22 hours ago, Alison said:

.  According to the info I have the heat pump uses holding register 0x24 for this value. I'm assuming this is a hex value and I have to covert to decimal, which is (I think) 36? so I have entered "36" as the value for the start vector in the MODBUS RHR fb

This is correct; however, some vendors start counting at 0 some others on 1, also if you need values that are stored in more than one register (32 bits 2x16) bytes may be in the wrong order some brands use different "endianness".

Link to comment
Share on other sites

  • MVP 2023

In case you don't know, left click on DEC in the operand display changes the read to HEX, on both powerup and actual values whilst online.  There is also the choice to have DEC or HEX in the popup that appears when working on them in the ladder directly....middle bottom.

cheers, Aus

DecHex.jpg.b1a6612eb31a6a26af23086ae167bfdf.jpg

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...