Jump to content

The latest .Net drivers for using 'Unitronics.ComDriver.Security.dll' download location


Recommended Posts

Posted

Hello,

Where can I find the latest .net drivers (c#) using Unitronics.ComDriver.Security.dll and the latest Unitronics.ComDriver.dll driver?

Thanks,

Eran

 

 

Posted

Hi Saragani,

Can I change the PLC ethernet communication password using the api?

This what  I have  done:

            var pwdStorage = PLCFactory.PasswordStorage;
            pwdStorage.SetPassword("Uni1237@", "168673.....");
            ethernet.Password = "Uni1237@";
            pwdStorage.SavePasswords();
            PLCFactory.SetPasswordStorage(pwdStorage);

I dont know if this is the rigth way to change the plc communication password (It's not work), can it done?

Posted

No, you can't affect the password inside the PLC with the API. It must be done from the Ladder code.

Password Storage is for caching the password. When the password is correct, then it's being automatically saved in the storage for the specific PLC.

The default password storage is RAM storage, which means that it's being deleted when you close your application. The communication driver also supports an SQLite password storage out of the box, so you can use it and it will keep the password encrypted inside the SQLite DB, and will retain it after you close your app.

Posted

Thanks, There is a way to affect (change) the communication password in the PLC memory by sending something using the PLC protocol (using the apl)?

If I know the PLC password and I whant to change it only in the PLC memory for the connection session.. 

Posted

No, you cannot change it only for a session.

The only way to change it is using the Ladder. You can have a code in your ladder that checks for a specific bit, and then the bit is set (Normally open contact), then reset the bit and then call Set PCOM Password ladder element.

The Set PCOM Password ladder element is working on a vector of MIs or XIs, so if you know which MIs (or XIs) you are using as the password, then you can first use the communication driver in order to set them, and only then set the bit that sets the PLC password, then you will be able to change the password.

Please note that once Set PCOM Password is called, then session will become protected again, and it will not communicate with your program until you  either close the socket, or actively call ethernet.CheckPlcPassword();

Since your cached password will now be incorrect, then you will get a ComDriveUnauthorizedAccessException. You should handle it and ask for the new password from the user, or set it (if you know its value) on the ethernet object.

Posted

Thanks,

About SB 314 "Block PC access to PLC. OFF by default. When ON: access via VisiLogic, RA, etc. blocked"

If I set it to 1 then how to revert it to 0 if I cant connect anymore via the VisiLogic or the API?

Another thing, by sending new data to "Ethernet Password Offset" (For example MI 100) it's will efentc somthing?

Posted

Probably only physically with Ladder or using "Info". If you need to access the PLC, then don't block it.

If you are just setting the data to the Ethernet Password Offset without re-calling the Set PCOM Password, then it won't affect. The password is copied from the Ethernet Password Offset to another location in RAM, so it won't be tampered while PLC is doing some manipulations on the operands.

Posted

Thanks Saragani,

How can I re-calling the 'Set PCOM Password' ?

The API support it maybe by sending the rigth operand?

I need to develope  funcunality that can change the password (PCOM), so i need to find a way to do this (using API)

The senario:

1. Connect the plc using known PCOM password

2. Change the PCOM password for the next connection (this what i need to solve)

Thanks

 

Posted

You will need to have a code in your Ladder that will change the password (So you must change the code in your PLC for that), something like:
image.png


The password can be 8 to 16 characters, and since each character takes 1 byte, and MI is Int16 (2 bytes) then 8 MIs should be reserved for the password (max length). I would also take 1 extra MI (for null termination. I'm not sure if it's needed), so in this case, you need to make sure that MIs 100 to 108 are not in use by anything else in your project, but for password.

 

Then you need to write the password to your PLC

var password = "MyPassword"; // Must be english only characters (can also contain numbers). No hebrew or any other language
short[] passwordValues = new short[8];

Buffer.BlockCopy(ASCIIEncoding.ASCII.GetBytes(password), 0, passwordValues, 0, password.Length);

var rw = new ReadWriteRequest[1];
var wo = new WriteOperands()
{
    NumberOfOperands = 8,
    OperandType = OperandTypes.MI,
    StartAddress = 100, // The Ethernet Password Offset
    Values = passwordValues.Cast<object>().ToArray(),
};

rw[0] = wo;

plc.ReadWrite(ref rw);

 

And then, after the Write Operands request succeeds, then you set the Set password bit (MB 0), by:
 

rw = new ReadWriteRequest[1];
wo = new WriteOperands()
{
    NumberOfOperands = 1,
    OperandType = OperandTypes.MB,
    StartAddress = 0, // Set password Bit offset
    Values = new object[] { 1 },
};

rw[0] = wo;

plc.ReadWrite(ref rw);

 

I did not test this code.
 

You should have an accessible screen in your HMI were you can set the password to MI 100 from there, and also set bit MB 0 by pressing a button, so just in case something went wrong and you can't communicate with the PLC (for example, a bug in your code, or unknown password that was set to PLC), then you could restore password and communication.

 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

This site uses cookies. By clicking I accept, you agree to their use.