NI Home > Community > NI Discussion Forums

LabVIEW

Showing results for 
Search instead for 
Do you mean 
Reply
Member
cacalderon
Posts: 14
Accepted Solution

LOGO! PLC driver based on LabVIEW

I'm happy because these past 2 weeks I have been working to decode and interpret the communication between the LOGO! PLC and a PC. Well ... I finished this work and achieved the following:

-          Ask the status of communication between PC - LOGO! PLC

-          Ask the status of the PLC (The PLC responds RUN/STOP status)

-          Forcing the status of the PLC to RUN mode.

-          Forcing the status of the PLC to STOP mode.

-          Ask the current values (in real-time) of all channels of the PLC:

o   24 digital inputs

o   16 digital outputs

o   8 analog inputs

o   2 analog outputs

o   24 digital marks

o   6 analog marks

o   4 cursors

 

The application developed in LabVIEW performs the main function of communicate the Desktop / Laptop with PLC LOGO! (That is to say link National Instruments with Siemens ... ja ja). The software performs the following functions:

-          Monitors and displays all channels of the LOGO!

-          Choose the communication port.

-          The user can save in a file all the data, each configurable period.

 

I have made many tests with different logic modules, and it has not given any problems.

 

In the image attached, I show you some of the topologies that can be implemented knowing this protocol of communication. I ask you to spread this to engineers/technicians who design and implement these MICRO-AUTOMATION systems, in order to offer this Software applicable to supervisory system or data-logger device.

 

I'm ready to be able to help

 

Esquemas de configuracion 

____________________________________________
Carlos Calderón Córdova, Ing.
Universidad Técnica Particular de Loja
Grupo de Control, Automatización y Robótica
Escuela de Electrónica y Telecomunicaciones
Phone: (+593) 7-2570275 ext. 2650
Cell: 098663798
____________________________________________
Member
SNATAX
Posts: 3

Re: LOGO! PLC driver based on LabVIEW

Hello,

I've also been working on this and I'm sharing knowledge I've adquired and the source code of the VI. It's not finished and it's not commercial. I'm just willing to share something useful.

 

This program communicates with Logo! (Tested with 7th generation, former versions may not work) and retrieve the status of the inputs, outputs…It’s just an outline of what I think it should be. I explain everything I’ve done so anyone can use it or create other programs.

 

It uses LabView 8.6 and the .NET library, I’m sorry if this bothers someone but it was the easiest way for me to establish the serial connection. So you will need the .NET framework to make it works, or improve the program using built-in LabView libraries. 

 

The communication with Logo! is based on RS232 but it’s not revealed. Here you have some of the protocol configuration and control words that I’ve learned and how I have interpreted them.

 

BaudRate 9600. Parity=0. Databits=8. Stopbits=2. The XOn/XOff Handshake seems to work quite fine.

All control words and answers are written in Hexadecimal code. No terminator is needed.

 

Question? (PC) Answer (Logo)

(Status?) 21--->( Status OK ) 06 03 21 44                                 

(Mode?) 55 17 17 AA ---> (if STOP) 06 42

                                         (if RUN) 06 01

(Go to Stop Mode) 55 11 11 AA --->(OK) 06

(Go to Run Mode) 55 18 18 AA --> (OK) 06

(Read all status) 55 13 13 00 AA --> (79 bytes length packet) 06 55 11 11 4A D6 00 19 20 00 00 00 00 00 00 00 ….. AA

 

Where byte 34 represents the status of the digital inputs, byte 38 is the status of the digital outputs and byte 45 is the status of the cursors. But there is much more like analog inputs, analog outputs and marks (both digital and analog) that I haven’t identified.

 

The cable (USB version) create a virtual COM PORT in order to use the RS232 protocol. It uses a 6pin connector but I haven’t been able to identify the pins. They use a Texas Instruments chip HA14 7AK G4 but I couldn’t find any information about it. I believe that the Logo! itself power the chip on the cable with +5V (bottom left pin) and GND is middle left pin so it left 4 pins for TX, RX, RTS and DTR but trying to identify the pins was when my Logo! died. So be careful.

 

Hope you find it useful and if anything is wrong or you learn something more, please post it.

 

Member
cacalderon
Posts: 14
0 Kudos

Re: LOGO! PLC driver based on LabVIEW

Thanks for sharing ....

 

I send you some interesting items:

 

- The PLC data frame depends on the versions of the PLC

  Generation 4 and 5 mistra not send the data frame.
  The Generation 6 sends a data frame larger.
  The generation 7 mmmm. I do not know. Siemens has not yet released it to Latin America.

 

- With respect to the data cable PLC-PC. This link may help you.

  Siemens LOGO PC cable pinout

 cir_logo_pc_cable.png

 

 - With respect to commands ...

Capture.PNG

 

Capture2.PNG

 

Finally, with respect to the GUI

Snapshot LOGO!view.PNG

____________________________________________
Carlos Calderón Córdova, Ing.
Universidad Técnica Particular de Loja
Grupo de Control, Automatización y Robótica
Escuela de Electrónica y Telecomunicaciones
Phone: (+593) 7-2570275 ext. 2650
Cell: 098663798
____________________________________________
Member
LOGOSA
Posts: 1
0 Kudos

Re: LOGO! PLC driver based on LabVIEW

Thanks for the VI which I managed to get to work with a OBA6, however it seems to be very unstable when running on my PC (Windows7 64bit) also when I converted it to use the VISA blocks, the data has shifted.  I am also getting very inconsistent comms?  Any suggestions would be much appreciated.

Member
søren_hallberg_jensen
Posts: 51
0 Kudos

Re: LOGO! PLC driver based on LabVIEW

Carlos,

 

This looks amazing. I was just setting out on the same quest that I see you have been on. Would you be willing to post your code here ?

 

Greetings,

søren jensen (vendersgade@gmail.com)

Member
SNATAX
Posts: 3
0 Kudos

Re: LOGO! PLC driver based on LabVIEW

Hi.

Mi code is above, you can easly see what it does and make your own aplication.

 

Member
søren_hallberg_jensen
Posts: 51
0 Kudos

Re: LOGO! PLC driver based on LabVIEW

SNATAX,

 

Yes, thanks a bunch !. Already tested your code, it worked without any problems !. Did you find any good source of documentation of the LOGO protocol ?

 

In order to use all the features of the Logo, reading AI, AO and being able to set AO and DO's is also needed. Reverse engineering is always somwhat of a challenge and I noticed that our fellow LV'er  cacalderon had solved this issue.

 

I found a dutch made software for logging of the LOGO data, however, I could not get it to work.

http://logomonitor.quirex.nl/home.php

 

I have been using the USBlyzer software to capture the commands on the LOGO USB<->PC cable, its fairly easy to use ang comes with 33 days of free trial time.

 

/søren

Member
SNATAX
Posts: 3
0 Kudos

Re: LOGO! PLC driver based on LabVIEW

I didn't find any documentation, all I know is from this forum and reverse engineering.


I only had the basic model so I cna't help with AI, AO and I don't know if is possible to set a value.

Member
	 Alias for use with communities
Posts: 1
0 Kudos

Re: LOGO! PLC driver based on LabVIEW

THANK YOU VERY MUCH   FOR THIS GOOD PROJECT    BUT PLEASE SEND ME THE BLOCK DIAGRAM OF THIS PROJECT

Member
gtathatos
Posts: 23
0 Kudos

Re: LOGO! PLC driver based on LabVIEW

Hello Carlos,

 

You have done an excellent job gongratulations.You would like to share with all of us your knoweldge of how you create this by posting your Vi code?Thanks