Category Archives: communication

How to Implement the Omron PLC Host Link Protocol

Hostlink communication protocol is a method developed by Omron for communication to PLC’s and other equipment. This ASCII based protocol is used over RS232 or RS422/RS485. It is a many to one implementation which means that you can communicate with up to 32 devices back to a master. (1:N) This communication on the industrial floor can control PLC’s, Temperature Controllers, Panel Meters, etc.

Our look at this protocol will include the wiring, setting of RS232 port settings, protocol format and  writing a VB6 program to read information from the PLC. I will also point you links to then store this information into a database and share over an intranet/internet. Lets get started.

Wiring of the communication ports will depend on the equipment purchased. If communicating over 15 meters, it is recommended to switch to RS422 or RS485 connection. However I have seen RS232 runs of 50 meters without an issue. It will depend on your implementation and electrical noise in the plant.

The above diagram is the basic communication needed for RS232C. Note that the shield of the communication wire is connected only to one side. This ensures that any noise induced in the communication is filtered to one end.

Settings for RS232C communications are set in a number of ways. Older Omron C**K PLC were set through a series of dip switches. Current Omron SMR1/CPM1 PLC’s are set though data memory locations.
Note: Most of the time, you need to cycle the power or switch to program / run mode for the setting to be activated.

I generally tend to leave everything at the default settings: 9600 bps, Even parity, 7 data bits, 1 stop bit. The default host link unit number is 00. (32 max. – 00 – 31)

Protocol Format
Each piece of equipment will have a list of parameters that can be read and written using the HostLink protocol. This can be found in the programming manual of the device. Here are the areas in the CPM1/CPM1A/CPM2A/CPM2C/SRM1(-V2) from the programming manual.

Lets take a look at the command to read the DM area. All of the commands and responses will be in an ASCII format.

The command format begins with a ‘@‘ sign followed by the Node / Unit number that you wish to communicate. Header code is the command in which you with to execute. (RD) This header code will determine the next series of information. In our case the next four digits will be the beginning word followed by the next four digits to indicate the number of words. The next part of the command is the FCS (checksum) calculation. The comparison to this at each end will ensure that the command/response is correct. FCS is a 8 bit data converted into two ASCII characters. The 8 bits are a result of an Exclusive OR performed on the data from the beginning to the end of the text in the frame. In our case this would be performed on the following:

"@00RD00000010"

The last part of the command is the terminator. This is an ‘*’ followed by the character for the carriage return. (CHR$(13))

The response format begins with a ‘@’ sign followed by the Node / Unit number that you are communicating to. The header code is next (RD) followed by the End Code. The end code is a two digit ASCII code that indicates the message response / errors when executing the action. A normal code of ’00’ indicates that everything is fine. See the operation manual for the entire list of end codes for your equipment. The next part of the response depends on the header code executed. In our case it would contain the data requested. The last two parts of the response is the FCS and terminator just like the command format.

The above shows the timing of the command and responses.

Visual Basic VB6 (Example)
Now lets look at an example of reading the first 10 words from the DM area  of an Omron PLC.

The first step is the design the form. You can see that we have our ten DM area words set out to populate with values. We also have a T$ for transmit. This will show what we are sending to the PLC. The RXD$ will show what the response will be from the PLC.

The MSComm is used to communicate through the serial ports of the computer. The following is the settings for the communication port.

Here is the VB6 code for the program:
When the form loads the Date/Time will get updated and Timer1 is enabled. This timer controls the interval in which the commands get executed. (Set to 1 second)

Private Sub Form_Load()
 Label2.Caption = Format(Date, "YYYY/MM/DD") + "    " + Format(Time, "HH:MM:SS")
 Timer1.Enabled = True
 End Sub

The following code will open the communication port, set the command format, send the command through the port, receive the response through the port and display the information. It will then close the communication port.

Private Sub Timer1_Timer()
 Timer1.Enabled = False
 MSComm1.PortOpen = True
 Label2.Caption = Format(Date, "YYYY/MM/DD") + "    " + Format(Time, "HH:MM:SS")
'Check DM AREA DM0000 to DM0009 data update
 T$ = "@00RD00000010"
 charreturn = 51
 GoSub FCS
 GoSub communicate
'Show Transmit information
 Label24.Caption = Buffer
 'Show Returned information
 Label26.Caption = rxd$
If Mid(rxd$, 6, 2) = "00" And (Len(rxd$)) >= charreturn Then
 Label4.Caption = Mid(rxd$, 8, 4)
 Label6.Caption = Mid(rxd$, 12, 4)
 Label8.Caption = Mid(rxd$, 16, 4)
 Label10.Caption = Mid(rxd$, 20, 4)
 Label12.Caption = Mid(rxd$, 24, 4)
 Label14.Caption = Mid(rxd$, 28, 4)
 Label16.Caption = Mid(rxd$, 32, 4)
 Label18.Caption = Mid(rxd$, 36, 4)
 Label20.Caption = Mid(rxd$, 40, 4)
 Label22.Caption = Mid(rxd$, 44, 4)
 End If
 Timer1.Enabled = True
 MSComm1.PortOpen = False
 Exit Sub

The following is the subroutine to communicate. Timer2 is the amount of time to wait before expecting an answer on the communication port. Once the command has been sent a maximum of two seconds is waited for an response. If no response nothing is returned. When the response is obtained, the FCS is checked and if correct the information is returned.

communicate:
 rxd$ = ""
 Buffer = T$ + FCS$ + "*" + Chr$(13)
 MSComm1.Output = Buffer
 Timer2.Enabled = True
 Do
 DoEvents
 Loop Until Timer2.Enabled = False
 If Time > #11:59:50 PM# Then
 timeout = #12:00:02 AM#
 Else
 timeout = DateAdd("s", 2, Time)
 End If
 MSComm1.InputLen = 0
 Do
 If timeout <= Time Then GoTo timeoutcom
 DoEvents
 Loop Until MSComm1.InBufferCount >= charreturn
 rxd$ = MSComm1.Input
 fcs_rxd$ = Left((Right(rxd$, 4)), 2)
 If Left(rxd$, 1) = "@" Then
 T$ = Mid(rxd$, 1, (Len(rxd$) - 4))
 ElseIf Mid(rxd$, 2, 1) = "@" Then
 T$ = Mid(rxd$, 2, (Len(rxd$) - 5))
 rxd$ = Mid(rxd$, 2, (Len(rxd$) - 1))
 End If
 GoSub FCS
 If FCS <> fcs_rxd$ Then
 rxd$ = ""
 End If
 clearbuffer$ = MSComm1.Input
 Return

This is the FCS (checksum) calculation routine.

FCS:
 L = Len(T$)
 A = 0
 For J = 1 To L
 TJ$ = Mid$(T$, J, 1)
 A = Asc(TJ$) Xor A
 Next J
 FCS$ = Hex$(A)
 If Len(FCS$) = 1 Then FCS$ = "0" + FCS$
 Return

This is the routine that will execute if the response is not received within the time period expected.

timeoutcom:
 clearbuffer$ = MSComm1.Input
 rxd$ = ""
 Return
End Sub

Timer2 was used as a delay before looking for a response after sending the command.

Private Sub Timer2_Timer()
 Timer2.Enabled = False
 End Sub

Here is the code running:

Helpful Tips/Links:
– When troubleshooting serial communications it is sometimes helpful to use HyperTerminal. This program will send and receive information in/out of the serial ports.
HostLink Command Generator
HostLink Command Format

Watch on YouTube : How to Implement the Omron PLC Host Link Protocol

If you have any questions, need further information or would like a copy of this program please contact me.
Thank you,
Garry



If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLC’s are not difficult to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimal, Hexadecimal, ASCII and Floating Point.

To get this free article, subscribe to my free email newsletter.


Use the information to inform other people how numbering systems work. Sign up now.

The ‘Robust Data Logging for Free’ eBook is also available as a free download. The link is included when you subscribe to ACC Automation.

What Everybody Ought to Know About Speaking to Individual People

Talking to individuals is a complex thing. Everyone is unique and has something to contribute. It is up to use to find out what that is through the way we conduct ourselves. It boils down to our ability to modify our behaviour to allow our audience to feel safe so true communications and be done. We will go through some of the things that I have learned over the years. Some items I am still working. Lets get started.

Julian Treasure in this  June 2013 TED talk gives us some of the basic rules and sins to stay away from in speaking. He also lists some ideas in the toolbox that we can all learn to use. We as individuals need to change in order to speak more effectively.

Julian Treasure: How to speak so that people want to listen

Listen
Listening is a skill. I was always told ‘We have Two ears and One mouth… Listen twice the amount we speak’. Active listening involves understanding what the other is trying to communicate. Do not interrupt the other person. Listen with an open mind. That is to think about what they are saying. Understand their point of view and opinions. Do not sympathise, empathise with the other person.

Communicate in the way in which the listener wants to communicate
There are several personality profiles that people can use to label individuals.  Assessments like Meyers -Briggs and DISC profiling are good to establish and understand your own profile. These should be use only for your reference. Communication to other people involve speaking to them in the manner that they want. This is where your own personal judgement comes into play. You can divide everyone that you communicate with into four categories.  They can be either more or less emotional than you, and more or less dominant than you. We can plot this out like this: We communicate to the individual based upon how they are on this plot in our opinion only. If I was personally strong in dominant and less in emotional then everyone would that I would talk to would seem to me like the other 3 areas.  I would adjust the way I communicate to them so it matches the way I perceive them.
So how do we communicate:
More Dominant / Less Emotional (Dominant)
We would speak direct and decisive. They are problem solvers, risk takers and self starters. Keep in mind that they have a high ego. There is only one way to get from Point A to Point B: That is a straight line.

More Dominant / More Emotional (Influencing)
We would speak enthusiastically and optimistic. They are trusting, persuasive, talkative and impulsive.  Keep in mind that they want to be entertained. When asked how to get from Point A to Point B: They will ask ‘Who else is going?’, but will come up with an answer.

Less Dominant / More Emotional (Steady)
We would speak possessively and predictable. They are good listeners, team players, steady and friendly. Keep in mind that they are reliable, dependable, patient and good at reconciling conflicts. When asked how to get from Point A to Point B: They will ask what is the plan?

Less Dominant / Less Emotional (Correct)
We would speak accurate and precise. They are conscientious, careful, analytical and systematic. Keep in mind that they want to know everything about the issue before making a decision. When asked how to get from Point A to Point B: They would need more information.

Remember that people change all of the time. We need to adjust the way we speak to them based upon our current observations.

Watch on YouTube : Communicate in the way in which the listener wants to communiate

Observe the conversation on their side
We mentioned that we should empathise with the other person. This means that we put ourselves in the mind of the other person to determine the next step that they will take.  Everyone has a picture of what they are thinking. We need to ensure that we understand their picture and possibly help them paint a masterpiece with our information.

Make people feel safe. You can do this by making every one that you communicate with feel important. Think of it as a big, blinking neon sign on everyone’s forehead saying ‘Make me feel important’. Simon Sinek explains in this March 2014 TED Talk this same message.

Simon Sinek: Why good leaders make you feel safe

If you have any questions or need further information please contact me.
Thank you,
Garry



If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLC’s are not difficult to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimal, Hexadecimal, ASCII and Floating Point.

To get this free article, subscribe to my free email newsletter.


Use the information to inform other people how numbering systems work. Sign up now.

The ‘Robust Data Logging for Free’ eBook is also available as a free download. The link is included when you subscribe to ACC Automation.

Looking For Production Improvements – Then Do A Gemba Walk!

I recently went for a Gemba Walk with Ann Machan,  General Manager of Pentair. Instead of doing normal daily production meetings, their walk does everything you can do in a boardroom, plus so much more.

What is a Gemba Walk?
http://www.gembawalk.com/the-gemba-walk/

We met in her office and were explained the KPI (Key Performance Indicators) for the operation of the plant.  Each of these KPI’s are posted at each department where the work happens and are on a large white board.

The walk each morning starts at the shipping office with the rest of the staff. The operator in shipping  discusses how their department has done in the last 24 hours in relation to the KPI. Questions are raised about the next 24 hours and possible issues. Before we leave this department Ann asks a few personal questions to the shipper. He answers and they start to laugh. It is obvious that they have a good relationship in which information can flow freely.

Splitting up the group into three different teams to cover the entire plant, the walk continues. We went to three additional departments where again we were shown the KPIs and how they related to the department. Notes were taken and questions asked about possible issues and current problems. Information was exchanged from the previous days problem with the solution for one that was to be implemented that afternoon.

We assembled back all together in a central location in the plant. A large board with people’s names (Responsible for Department) was listed on the left side and twenty one numbers were written on the top representing three weeks. The current week that they were on, followed by the next two weeks. This grid pattern was where they then discussed the walk and the issues raised. To the right of the board a chart was placed. This chart contained the total number of problems/issues solved for each department and total company. A graph was also displayed showing the growing trend. Underneath this chart were the KPI charts that all showed either sustained or improved performance.

We started with the previous days issues under yesterdays date. A status update was given and the posted note was moved to either the completion clip at the side or put under a future date. When this was complete, a representative of each of the three groups when through their list of issues. These were then assigned and placed on the board. Problems that required additional investigation were discussed briefly and then the 5 why process was assigned to the person who had the greatest knowledge.

This whole process took about one hour. The Gemba walk accomplished the following:

  • Everyone’s understanding on the current company situation based upon the KPIs
  • Everyone knowing exactly what is expected
  • Everyone taking pride and knowing they are doing a good job
  • Everyone knowing someone is there to help

I found the whole experience of the Gemba walk fascinating. It is the only way that I see that you can have clear lines of communication to all staff. The way in which to grow as a company is to learn from our workers and in turn we will teach them.  It was an opportunity to:

  • See the work being done
  • Experiment with ideas
  • Learn from all parties involved
  • Explain why things are this / that way
  • Watch what is being done

Take your own Gemba walk on your production floor. Let me know how it turns out.

If you have any questions or need further information please contact me.
Thank you,
Garry



If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLC’s are not difficult to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimal, Hexadecimal, ASCII and Floating Point.

To get this free article, subscribe to my free email newsletter.


Use the information to inform other people how numbering systems work. Sign up now.

The ‘Robust Data Logging for Free’ eBook is also available as a free download. The link is included when you subscribe to ACC Automation.