Jump to content

UnCmDrv1.dll


Benja

Recommended Posts

Hi there,

I'm working with V130 and ethernet card, i want to make a SCADA in VB6 with ethernet communication. I tried direct comm and it works, but i'm lost with the ethernet communication ¿What FBs i need to set in the ladder program? ¿I must set the PLC as Modbus IP slave?

Would greatly appreciate your help.

Best regards.

Link to comment
Share on other sites

The function calls for this driver are not very well documented. They usually try to push everyone off on the .NET version.

On the ladder end, all you need is PLC Name FB, a TCP/IP CARD INIT FB, and a TCP/IP Sock INIT FB.

I am going to give you some good values you start with. I should stress that you don't necessarily NEED to do it exactly as I have, but it will match well with the example I am giving below.

Name the PLC "V130"

Init the card to whatever IP address you want.

My example used

IP: 192.168.1.10

Subn: 255.255.255.0

GTWY: 192.168.1.254

Initialize socket #3 to

TCP

Port D# 20257

Slave

Put all three of these FBs in the first network of you main ladder all in series and triggered by the SB2 contact.

That is all you should need to do on the ladder end for base communication.

If you leave socket#2 at default, you will be able to also continue to use Visilogic on port 20256 so that you can do both simultaneously.

Downloading programs over Ethernet is much faster than RS232, so since you will have an Enet card on this anyway you might as well take full advantage of it.

Anyhow, with that being said, here is a sample function in VB to invoke an Ethernet connection.

You can ignore the parts that are related to serial comms.

Private Function prvOpenPort() As Boolean

Dim eComParam As tPC_CommSettings

Set mComDriver = New UnCmDrv1.clsCommDriver 'Create a new instance of Unitronics CommDrive DLL

'Configure the connection parameters.

With eComParam

.Baudrate = eBR_38400 'baud rate

.DataBits = eDB_8 'data bits

.Parity = eP_None 'parity

.StopBits = eSB_1 'stop bits

.TimeOut = 500 'communcations timeout

.Retries = 3 'number of retries

End With

With mComDriver

.Comm_Autodetect = True

.ShowCommMessages = True

.Comm_TimeOut = 10000

.Comm_Retries = 3

.Ethernet_Protocol = UnCmDrv1.enEthernetProtocol.eEP_TCP

.Ethernet_RemotePort = 20257

.Ethernet_RemoteIP = "192.168.1.10"

If Not .Ethernet_Connect Then

MsgBox ("Com Open = False")

End If

End With

mComDriver.Comm_Autodetect = True

mComDriver.ShowCommMessages = True

prvOpenPort = mComDriver.Ethernet_Active

End Function

Link to comment
Share on other sites

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.