RSLinx DDE to VB 6.0

P

Thread Starter

Pedro M. Carrion

i m using the of RSLinx DDE in order to get data from an AB PLC an save the data in a database using Visual Basic 6.0. It's very slow. My question is if there are another method in order to get data with better performance than DDE using RSLinx ?
 
R

Rafael Becerra

You can try using OPC. First you need the OPC dll (look at www.opcfoundation.org) or ask Allen Bradley representative about using the RSLinx OPC automation interface (dll).

Then in visual:
1. Create a reference to the OPC interface
2. Declare an OPCServer
Private ServidorLocal As OPCServer

3. Declare OPC groups
Private WithEvents NumReservaGrupo As OPCGroup ' Numeros de reserva
Private WithEvents AckBitsGrupo As OPCGroup ' Bits de Ack de la dtam

4. Define OPC constants
Const OPC_DS_CACHE As Long = 1
Const OPC_DS_DEVICE As Long = 2

5. Create the opc server
Set ServidorLocal = New OPCServer
'Validate object creation
If ServidorLocal Is Nothing Then
MsgBox "Failed to create reference to RSLinx OPC Automation interface.", vbInformation
Unload Me
Exit Sub
End If

6. Declare strings to store the items names you want to read
Dim ReservaElem(1 To 4) As String
Dim AckBitsElem(1 To 2) As String

' Declarar los elementos para el grupo de numeros de reserva
ReservaElem(1) = "[slc500]N11:6" ' RESERVA_2H_DEC
ReservaElem(2) = "[slc500]N11:5" ' RESERVA_2L_DEC
ReservaElem(3) = "[slc500]N11:8" ' RESERVA_1H_DEC
ReservaElem(4) = "[slc500]N11:7" ' RESERVA_1L_DEC

' Declarar los elementos para el grupo de bits de ACK
AckBitsElem(1) = "[slc500]N11:10" ' DT_RES_IND
AckBitsElem(2) = "[slc500]N11:11" ' DT_RES_MUL

7. Create the OPC groups
Set NumReservaGrupo = ServidorLocal.OPCGroups.Add("Reserva")
Set AckBitsGrupo = ServidorLocal.OPCGroups.Add("AckBits")

8. Set some parameters
NumReservaGrupo.IsSubscribed = True
AckBitsGrupo.IsSubscribed = True
NumReservaGrupo.IsActive = False
AckBitsGrupo.IsActive = True
AckBitsGrupo.UpdateRate = 50 'milliseconds

9. Add the items to the groups
AddOPCItems NumReservaGrupo, ReservaElem
AddOPCItems AckBitsGrupo, AckBitsElem

10. Start reading and writing values

For space considerations I cannot put all the code here, if you are interested in the code post a message with your email address, and I'll send you the code I used.

Best Regards
Rafael Becerra
 
I think that you need use a opc server, RSLink gateway have a opc sever, then you can use vb to read that data.
 
If you really want speed, look at a package called RSSql (Rockwell Software Product) which is a transaction manager that talks from any AB PLC/SLC to any ODBC compliant database. It can either run on the same PC as the database or for even better performance run it on it's own machine. Call your local Rockwell rep for pricing and info
 
S
Hi,
What DDE method are you using in VB to collect data?
If you use the standard method, i.e. with a control of VB by means of the properties
LinkMode, LinkTopic etc, is normal that this happens to you.
In Internet you will be able to find clients DDE Active X (ocx) that you will be able to use from your application and which they are possibly the solution to your problem.

Saludos
 
R

Rafael Becerra

Alejandro:
Te acabo de enviar un mensaje, pero este reboto. Copiaste bien tu direccion?
 
M

Murphy, Kieran

You could use the RSLINX API interface,
When you install RSLINX OEM version (I think), dtl.bas gets installed on your PC. this defines the RSLINX API interface. This takes a lot more coding then DDE but it is a lot faster
 
A

Armando Abraham

If you are using rslinx 2.0, you could get data by means of OPC technology, because this release is OPC compalible. This type of communication has a very good performance.

I hope that this helps you.
Armando Abraham
 
Rafael,

Were you using the Rockwell Software OPC Automation (RsiOPCAuto.dll)?

I would appreciate if you could send me source code.

Send to alberto.gilli(AT)cox.net

Thanx,

Alberto
 
Top