About Serial communication with CompactLogix L32E and its commands?

efel09

Member
Join Date
Jul 2012
Location
Mexico
Posts
9
Hello everyone,

I having some troubles for reading the serial of a L32E. I'm good in php programming and I'm using a serial class for opening and reading the serial port (not the first time, in the past i was able to "talk" to some mcus and other serial devices with any issue). The idea is to make a web application for "real-time" graphing for EOL F-15 40% / 60% and saving the data to MySQL db. My problem is that I'm new to PLC and I do not have any idea about the string format of the data. Header + data + End ? The people that want the program set a dummy program into de PLC with a random value. I was able to use RSLinx to copy the link of the DDE/OPC using the Ethernet Interface to Excel. The url is something like Program:MainProgram.VARIABLE_1.ACC

I tried using the hyperterminal to read the serial port and I get nothing, I read about something ASCII mode but not sure about that.

They gave to me a visualbasic program with any comment in order to figureout and the part of the program have a function ProcessChar that it may be part of the decoding function.

Code:
    Private Function ProcessChar(ByVal c As Byte) As Integer
      If c > 47 And c < 58 Then 'Digit
        token = token & ChrW(c)
        Return 1
      End If
      If c = 46 Then ' Dot
        token = token & ChrW(c)
        Return 3
      End If
      If c = 45 Then ' Minus
        token = token & ChrW(c)
        Return 4
      End If
      If c > 64 And c < 91 Then 'Alpha upper
        currentType = TokenType.Text
        token = token & ChrW(c)
        Return 2
      End If
      If c > 96 And c < 123 Then 'Alpha lower
        currentType = TokenType.Text
        token = token & ChrW(c)
        Return 2
      End If
      Return 0
    End Function

In other words how do I read the variables from the serial?


Does anyone have any suggestion about how to read from the serial or any link for reference?

Thanks in advance
 
Last edited:
I'm confused. If you have an Ethernet based CPU why are you trying to pass data using ASCII over the serial port? If this is a web application that screams "ethernet" to me.
 
Reading data from a CompactLogix is not as simple as parsing some ASCII strings.

There are quite a few commercial products that already do this, both as OPC servers and as standalone drivers.

AvancedHMI is a community project that includes Allen-Bradley serial drivers.

Inductive Automation Ignition is the best OPC-UA server for A-B on the market, and the OPC-UA server is free.

If you still intend to write your own driver using the serial port class, the best resources are on the RA Developer Guide website:

http://www.rockwellautomation.com/sales-partners/technology-licensing/developer-guides.page
 
Thank all of you for your support.

Ken Roach, I really appreciate your suggestion, you rock!!! (my apologies if the phrase in no well used, as you can imagine I'm not an English native speaker). I will check both suggestios prior to intend to write the driver.

The problem was that I was working at the IT department and suddenly they re-assigned my duties to the Control department and they are "so busy" to assist a budy, lol. But they want the job done ASAP. I never used a PLC before, but with your suggestions I hope to solve the issue as fast and good as I can.

Finally, I'm guessing that with the use of those solutions the access to specific variables are "quite" easy, right?

Thanks again
 
Greetings Dmroeder, thanks for the links. Actually, I agree with you about AdvancedHMI. I just downloaded from sourceforge. Since I'm running out of time, this would be the prior solution. And for the moment and because they want a web-based interface I will use VB with AdvancedHMI as interface and a socket for gathering the dato directly to php.

Thanks for your support.

ASAP I have a working solution I will be glad to share my results with the community.
 
Where can I get the PLCaddressValue?

Greetings, As I mentioned before I decided to go with AdvancedHMI. I'am reading the "Quick Starting guide" but I do not know how to set the PLCaddressValue. Where do I find that?

The people of the department of Control, set a dummy program with a random value generator. I was able to copy the link to Excel and see the value. The link was generated using RSLinx

The link is like that: [NEW_TOPIC]Program:MainProgram.VARIABLE_1.ACC,L1,C1

ACC is the accumulator value, but I don't know how to format de address. I just copy the link to the PLCaddressValue field and nothing happens but an "invalid value returned! Unknown Message - 5 Cip Status 5".

Here's the picture
gkjrt

http://www.freeimagehosting.net/gkjrt
Any suggestion?

Thanks in advance.
 
Last edited:
The PLCaddressValue is part of every AdvancedHMI object (buttons, indicators, etc). If you place an AdvancedHMI object on your AdvancedHMI form, you will find that it is one of the properties in the property panel.

I was thinking that you may not really care about using the object, but just using the driver to read values from the PLC and writing code to do something with it (put it in a text file, excel spreadsheet). You would do this by placing a driver on your form, then using "DriverName.ReadAny()" to get the value from the PLC.
 
Hello, Thanks for your suppor its really appreciated. Yes, Ethernet is an option. I will try what you suggested
You would do this by placing a driver on your form, then using "DriverName.ReadAny()" to get the value from the PLC.

Thanks again
 
Hello, Thanks for your suppor its really appreciated. Yes, Ethernet is an option. I will try what you suggested
Thanks again

Then use the EthernetIPforCLX driver.

I see you were reading arrays in your DDE example, you can do this as well. There are limits with Strings, but you can overcome this with code. I'm doing this off of memory but I think the format is "DriverName.ReadAny(TagName, NoOfElements)".
 
Last edited:
Then use the EthernetIPforCLX driver.

I see you were reading arrays in your DDE example, you can do this as well. There are limits with Strings, but you can overcome this with code. I'm doing this off of memory but I think the format is "DriverName.ReadAny(TagName, NoOfElements).

Thanks again...

Actually the EthernetIPforCLX is the one I'm trying to use, lol. So, if my generated link from RSLinxs used in Excel is [NEW_TOPIC]Program:MainProgram.VARIABLE_1.ACC,L1,C1

In the VBStudio I picked a EthernetIPforCLX driver wich I named Driver1. The syntax would be something like "Driver1.ReadAny("VARIABLE_1", 8) if I followed the information of the this screenshot http://www.freeimagehosting.net/gkjrt

Sorry for my dumb questions, but I really trying and I'm willing to learn. At this time is a "learning in the fly", lol.

Thanks again

I will make some test hopping it works.
 
Greetings Dmroeder, there is no way to thank You for your help.

I have a little progress, using RSLinx "Data Monitor" I was able to found the needed tag, so I place a Digital Panel Meter (Panel1) to test the connection between the PLC and the Program. The driver was the one You suggested (EtherNET_IP).

The configuration is as followed:

EtherNET_IP.IP = 192.168.1.1
Panel1.PLCaddressValue = Program:MainProgram.VARIABLE_1.ACC 'According to RSLinx Tag

And it works just fine. Later I put a label (Label1) just for picking the data, as followed:

Label1.Text = EtherNET_IP.ReadAny(Panel1.PLCaddressValue)
And also works, my only concern for now is that I do not have a clue of how to refresh the value, it only place the instant value when the program runs for the first time and never updates again. The Digital Panel Meter (Panel1) works just fine and refresh constantly.

Using Visual Studio 2010 Express I can only get the code for the MainForm.vb and I put the Label1 code inside the "Private Sub Form_VisibleChange"

Code:
...
If components IsNot Nothing Then
  For i As Integer = 0 To components.Components.Count - 1
  ...
  End If
 
  Label1.Text = EtherNET_IP.ReadAny(Panel1.PLCaddressValue)
 
End If
...

As far I get progress with this I will create a socket for sending the data to PHP and I will post any working solution

Thanks again...
 
Last edited:
Try this:

Dim intVariable as integer = Driver1.ReadAny(VARIABLE_1.ACC)
MessageBox.Show(intVariable)

Hello again,

I just put a timer. May be that is not the best or elegant solution but at least is working, now the next step is to set the socket.

The Timer has a refresh interval of 1ms and the code is set as followed:

Code:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Time1.Tick
 
  Dim intVariable As Integer = EtherNET_IP.ReadAny(Panel1.PLCaddressValue)
  Label1.Text = intVariable
 
 
End Sub

Regards,
 

Similar Topics

Hello. I am trying to establish communication between CompactLogix 1769-L32E and CompactLogix 1768-L43 using serial port but with DeviceNet (and...
Replies
6
Views
2,735
Hi Experts. I need your help, I wanna communicate a MIcro850 with L19ER CompactLogix through Serial communication (Modbus RTU). I am using...
Replies
2
Views
2,139
We currently have a scale communicating to a SLC 5/05 over Remote IO (1747-SN). We are going to be changing out the 5/05 with a new CompactLogix...
Replies
7
Views
4,772
Currently,we are facing the communication go through with 422 tx+ and tx-. Mitsubishi fx5u series is used and using command rs2. But the package...
Replies
0
Views
100
I have wasted a week trying to figure out how to connect an SLC5/03 with my laptop. I do not have and can not Buy the 1747 UIC and PC3 cables. I...
Replies
14
Views
2,544
Back
Top Bottom