PeterFukt Posted January 17, 2017 Report Share Posted January 17, 2017 Hello, I just got informed about an issue with the program I have made for a Samba SM35 regarding Modbus settings. I use a Com Init block directly after a power-up bit that initializes factory com settings. If I enter Information Mode and change the serial settings for RS485 there, everything is fine until a power loss. The settings are overwritten at power-up. Is there a way to prevent the settings from getting restored to Com init settings after a power-loss or unit shut down? Link to comment Share on other sites More sharing options...
MVP 2023 Joe Tauser Posted January 17, 2017 MVP 2023 Report Share Posted January 17, 2017 You should not be using Information Mode to make changes you want to keep. The PLC is just doing what you told it to. It's OK to have multiple Com Init blocks. Each time you call one from the program the port will immediately take on the personality of the last Com Init called. Joe T. Link to comment Share on other sites More sharing options...
PeterFukt Posted January 19, 2017 Author Report Share Posted January 19, 2017 I see. But if the Modbus master communicate with other baud rates, it can still communicate with the PLC right? What does the Unit ID that you can set in information mode do? The RS-485 documentation say that a Unit ID must be set to communicate with the PLC but when I try it with a Modbus master program, it seems to only use the Modbus ID. Can Unit ID be disregarded and kept on 1(Canbus) when using RS-485? Link to comment Share on other sites More sharing options...
PeterFukt Posted January 19, 2017 Author Report Share Posted January 19, 2017 Another question on the RS-485 matter. A customer is getting very upset that they do not get communication to work properly. In the com init block, my program set 57600,8,n,1. If the customer use these settings, everything works. But their system use 9600,8,e,1 and when they change the PLC settings in info mode to their settings, the communication only works partly, all commands are not working for them. Any idea why this is? Also, must I make a com init block for each possible combination and a HMI page where the customer can choose one combination of RS-485 settings or how else is the problem with different com settings at the customers taken care of since info mode changes gets overwritten at power up? Maybe make the change in info mode and after that activate a button that prevents the com init block from running again? Link to comment Share on other sites More sharing options...
MVP 2023 Ausman Posted January 19, 2017 MVP 2023 Report Share Posted January 19, 2017 8 hours ago, PeterFukt said: If the customer use these settings, everything works. Do you mean the entire 485 network works ok? If so, why are they then changing things to 9600 8 E 1? And if they have all commands not working ok once that is done, are they sure that everything in their entire network has that setting? 8 hours ago, PeterFukt said: Also, must I make a com init block for each possible combination and a HMI page where the customer can choose one combination of RS-485 settings etc etc Yes. Unless you have some means within the program to cycle to a new com init, the PLC will always be the last called during that powered up period, as Joe says. A button "preventing it running again" will not work as the program is only doing what you tell it....you want it to go to the settings you are specifying in your com init that runs on every startup. But as I am typing this I maybe understand your question better. Are you asking if you put an appropriate MB in front of your power up init that then changes state from an HMI instruction, will this stop it running and resetting the customer setting during power up? I don't think so. You'll just end up with no 485 as there is no init at all. Essentially what you are wanting is for the init settings to be matched to MIs, and I think you've got no chance of that happening. cheers, Aus Link to comment Share on other sites More sharing options...
PeterFukt Posted January 20, 2017 Author Report Share Posted January 20, 2017 11 hours ago, Ausman said: Do you mean the entire 485 network works ok? If so, why are they then changing things to 9600 8 E 1? And if they have all commands not working ok once that is done, are they sure that everything in their entire network has that setting? The customer use 9600,8,E,1 in their network. After setting the PLC to those settings using Info mode, serial menu, the communication only works partly. Everything else in their network works. Also very strange, when they connect the Modbus, they can no longer push a button on the HMI to start the unit. It is being locked. It calls MB2 to start the unit. The customer also say that they can't trigger this function with modbus. When I tested it, I got it to read and write coils on address 2. 11 hours ago, Ausman said: Yes. Unless you have some means within the program to cycle to a new com init, the PLC will always be the last called during that powered up period, as Joe says. A button "preventing it running again" will not work as the program is only doing what you tell it....you want it to go to the settings you are specifying in your com init that runs on every startup. But as I am typing this I maybe understand your question better. Are you asking if you put an appropriate MB in front of your power up init that then changes state from an HMI instruction, will this stop it running and resetting the customer setting during power up? I don't think so. You'll just end up with no 485 as there is no init at all. Essentially what you are wanting is for the init settings to be matched to MIs, and I think you've got no chance of that happening. cheers, Aus With Modbus TCP I can use MIs to change TCP IP card settings. That is not possible with the com init. Our PLC program is supposed to be universal meaning we don't customize the program with specific com settings. It's also a PLC memory issue, I can't add much more to my HMI. What settings are essential for a master to communicate with a PLC slave? I need the least amount of possible com init combinations to select from a HMI page. If slave has 57600 and master 9600 or the other way around, does it still work? Is it more important that data bits, stop bits or parity is the same? Sorry for all the questions, but all of a sudden, I'm getting lots of messages from annoyed customers that do not use 57600,8,1,n. Link to comment Share on other sites More sharing options...
MVP 2023 Joe Tauser Posted January 21, 2017 MVP 2023 Report Share Posted January 21, 2017 I'm guessing you can't post your code. All serial settings must match or it won't work. I personally use 9600 8,N,1, as setting the parity to even adds an extra level of complication. Is there any way to try this? Yes, 9600, 8E1 should work but it doesn't. You have to start trying other settings. Joe T. Link to comment Share on other sites More sharing options...
MVP 2023 Ausman Posted January 21, 2017 MVP 2023 Report Share Posted January 21, 2017 +1 to Joe's comments on the No parity. I didn't mention this before but I did find your mentioning Even a bit strange. Nearly all the stuff I use comes with either 19200 or 9600 as default, but always 8,N,1. A lot of it you can't even change the parity from none. The exception is the fans I use from EBM, which arrive as Even. I have been told by them that "Ve are German und knowen besten und this ist the axcepted standarden und I should not changen things and commiten fingerpoken", but like Joe, I always change everything to 9600 8 N 1 and things are stable and work correctly. I can't definitely answer your questions about combinations, but I think you are faced with needing all of them in your coding. Happy to be told otherwise. cheers, Aus Link to comment Share on other sites More sharing options...
MVP 2023 Ausman Posted January 22, 2017 MVP 2023 Report Share Posted January 22, 2017 On 20/01/2017 at 8:04 PM, PeterFukt said: they can no longer push a button on the HMI to start the unit. It is being locked. Also wondering that there isn't another master on the network somewhere without realising it? Aus Link to comment Share on other sites More sharing options...
PeterFukt Posted January 23, 2017 Author Report Share Posted January 23, 2017 On 2017-01-21 at 11:49 AM, Ausman said: "Ve are German und knowen besten und this ist the axcepted standarden und I should not changen things and commiten fingerpoken", Spot on, it is a German company that use the 9600,8,e,1 setting so it is "not acceptable" that we have other default settings that cannot be changed so that the change is saved at power loss. If the settings could be stored as MI's everything would be fine. I read somewhere that if the master has a lower baud rate setting than the slave, it still works, that the slave will communicate with this lower baud rate. Is that so? In that case, I could make a couple of com inits that have 8,n,1 and 8,e,1. 8 to choose from. 8 and 1 seem to be most common bit setting. Link to comment Share on other sites More sharing options...
MVP 2023 Ausman Posted January 24, 2017 MVP 2023 Report Share Posted January 24, 2017 I'd still be looking at changing the network to no parity. On the EBMs it is a case of using their dedicated program with higher permissions than are available to the general user. My understanding is that it sequentially applies "unlock" numbers to certain registers, that then let the parity be changed, then locks it again. This may well be available on the stuff you are using. As Joe says: On 21/01/2017 at 4:29 PM, Joe Tauser said: Yes, 9600, 8E1 should work but it doesn't. cheers, Aus Link to comment Share on other sites More sharing options...
PeterFukt Posted January 24, 2017 Author Report Share Posted January 24, 2017 The customer won't change their network so we must unfortunately make the PLC work for them. I make a few com inits and some buttons with a toggle function in the HMI to choose preset settings. One question remain: is Unit ID needed? When I tried the program, I could communicate with RS485 using the Modbus TCP/IP ID number. The Unit ID has always been the default 1. I tried to set Unit ID to 64, and use that in my Modbus master program but that did not work. When I used the Modbus ID number, it worked well. So I'm wondering since the 485 help file tells me I must set the Unit ID. Is it not needed on the Samba? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now