Reader small image

You're reading from  Mastering PLC Programming

Product typeBook
Published inMar 2023
PublisherPackt
ISBN-139781804612880
Edition1st Edition
Right arrow
Author (1)
Mason White
Mason White
author image
Mason White

M.T. White has been programming since the age of 12. His fascination with robotics flourished when he was a child programming microcontrollers such as Arduinos. M.T. currently holds an undergraduate degree in mathematics, a master's degree in soft ware engineering, and is currently working on an MBA in IT project management. M.T. is currently working as a soft ware developer for a major US defense contractor and is an adjunct CIS instructor at ECPI University. His background mostly stems from the automation industry where he programmed PLCs and HMIs for many different types of applications. M.T. has programmed many different brands of PLCs over the years and has developed HMIs using many different tools.
Read more about Mason White

Right arrow

Preface

Object-oriented programming and the principles that govern the concept rule the modern IT world and automation programming is no different. Though modern technology is progressing rapidly in the automation realm, software development practices are not. As such, this book is meant to be a bridge between automation programmers and modern software engineer practices.

Who this book is for

This book is for automaton programmers with a background in software engineering topics such as object-oriented programming and general software engineering knowledge. Automation engineers, software engineers, electrical engineers, PLC technicians, hobbyists, and upper-level university students with an interest in automation or robotics will also find this book useful and interesting.

To get the most out of this book, you should have a basic knowledge of PLCs, PLC programming, and modern structured text. Though not totally necessary, a rough idea about object-oriented programming would also be beneficial.

What this book covers

Chapter 1, Software Engineering for PLCs, establishes the basics of software engineering and why it is important for PLC programmers. The chapter also walks you through installing CODESYS and creating a sample project to ensure the setup is working.

Chapter 2, Advanced Structured Text — Programming a PLC in Easy-to-Read English, explores some of the lesser-used concepts of structured text, such as error handling and pointers. This chapter also covers the basics of state machines and proper code documentation.

Chapter 3, Debugging — Making Your Code Work, introduces troubleshooting PLC code. The chapter covers concepts such as print debugging, using built-in debugging tools, and more.

Chapter 4, Complex Variable Declaration — Using Variables to Their Fullest, is about complex variables. Topics covered include variable lists, auto-declaring variables, structs, and much more.

Chapter 5, Functions — Making Code Modular and Maintainable, introduces code modularity. To do this, the concept of functions is covered, along with arguments, return types, and more.

Chapter 6, OOP — Reducing, Reusing, and Recycling Code, introduces the power of objects and how they can be used. The chapter explores basic object-oriented programming (OOP) principles such as function blocks, methods, and getter and setter methods.

Chapter 7, OOP — The Power of Objects, is a continuation of Chapter 6 and covers more complex object-oriented principles such as the pillars of OOP, composition, access specifiers, interfaces, and more.

Chapter 8, Libraries — Write Once, Use Anywhere, explores the whole process of creating a library from scratch to consuming the library. This chapter essentially is applied OOP.

Chapter 9, The SDLC — Navigating the SDLC to Create Great Code, introduces the full software development life cycle (SDLC). The goal of this chapter is to teach you how to navigate the full SDLC process to properly build and implement PLC code.

Chapter 10, Advanced Coding — Using SOLID to Make Solid Code, shows you how to create SOLID PLC code. The goal of this chapter is to teach you how to create well-engineered code that can be adapted and will age well. In short, this chapter explains how to properly implement OOP.

Chapter 11, HMIs — UIs for PLCs, introduces the concept of Human Machine Interface (HMIs). The goal of this chapter is to introduce the core idea behind HMIs, wireframing, setting up a basic HMI project, and why HMIs are used.

Chapter 12, Industrial Controls — User Inputs and Outputs, covers some of the commonly used CODESYS HMI widgets. The goal of the chapter is to introduce the widgets, what they do, and how they work.

Chapter 13, Layouts — Making HMIs User-Friendly, explores how to make functional HMIs. In other words, the goal of this chapter is to lay down principles that can be used to create high-functioning and user-friendly HMIs in CODESYS.

Chapter 14, Alarms — Avoiding Catastrophic Issues with Alarms, covers one of the most important aspects of automation programming – alarms. This chapter introduces the concept of alarms and how to set up an alarm, its layout, and even how to trigger them.

Chapter 15, Putting It All Together — The Final Project, is the last hands-on chapter. This chapter cherry-picks concepts from the whole book and incorporates them into a final project.

Chapter 16, Distributed Control System, PLCs, and Networking, is theoretical in nature, unlike all the previous chapters. This chapter covers the basics of networking, as well as introducing the basics of common networking protocols for automation.

To get the most out of this book

This book covers some advanced PLC programming topics. As such, it is recommended that you read the book from cover to cover. It is also recommended that you have some knowledge of PLC programming and at least a basic grasp of structured text.

Software/hardware covered in the book

Operating system requirements

CODESYS

Windows

If you are using the digital version of this book, we advise you to type the code yourself or access the code from the book’s GitHub repository (a link is available in the next section). Doing so will help you avoid any potential errors related to the copying and pasting of code.

Download the example code files

You can download the example code files for this book from GitHub at https://github.com/PacktPublishing/Mastering-PLC-programming. If there’s an update to the code, it will be updated in the GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Download the color images

We also provide a PDF file that has color images of the screenshots and diagrams used in this book. You can download it here: https://packt.link/bqJiM.

Conventions used

There are a number of text conventions used throughout this book.

Code in text: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: “As can be seen in the code, the keyword EXTENDS Felion is added to the function block code.”

A block of code is set as follows:

//turn on motor
IF turnOnMotor = FALSE THEN
	turnOnMotor := TRUE;
END_IF

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

//turn on motor
IF turnOnMotor = FALSE THEN
	turnOnMotor := TRUE;
END_IF

Any command-line input or output is written as follows:

$ mkdir css
$ cd css

Bold: Indicates a new term, an important word, or words that you see onscreen. For instance, words in menus or dialog boxes appear in bold. Here is an example: “Select System info from the Administration panel.”

Tips or important notes

Appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: If you have questions about any aspect of this book, email us at customercare@packtpub.com and mention the book title in the subject of your message.

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/support/errata and fill in the form.

Piracy: If you come across any illegal copies of our works in any form on the internet, we would be grateful if you would provide us with the location address or website name. Please contact us at copyright@packt.com with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.

Share Your Thoughts

Once you’ve read Mastering PLC Programming, we’d love to hear your thoughts! Please click here to go straight to the Amazon review page for this book and share your feedback.

Your review is important to us and the tech community and will help us make sure we’re delivering excellent quality content.

Download a free PDF copy of this book

Thanks for purchasing this book!

Do you like to read on the go but are unable to carry your print books everywhere? Is your eBook purchase not compatible with the device of your choice?

Don’t worry, now with every Packt book you get a DRM-free PDF version of that book at no cost.

Read anywhere, any place, on any device. Search, copy, and paste code from your favorite technical books directly into your application. 

The perks don’t stop there, you can get exclusive access to discounts, newsletters, and great free content in your inbox daily

Follow these simple steps to get the benefits:

  1. Scan the QR code or visit the link below

https://packt.link/free-ebook/9781804612880

  1. Submit your proof of purchase
  2. That’s it! We’ll send your free PDF and other benefits to your email directly
lock icon
The rest of the chapter is locked
You have been reading a chapter from
Mastering PLC Programming
Published in: Mar 2023Publisher: PacktISBN-13: 9781804612880
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at £13.99/month. Cancel anytime

Author (1)

author image
Mason White

M.T. White has been programming since the age of 12. His fascination with robotics flourished when he was a child programming microcontrollers such as Arduinos. M.T. currently holds an undergraduate degree in mathematics, a master's degree in soft ware engineering, and is currently working on an MBA in IT project management. M.T. is currently working as a soft ware developer for a major US defense contractor and is an adjunct CIS instructor at ECPI University. His background mostly stems from the automation industry where he programmed PLCs and HMIs for many different types of applications. M.T. has programmed many different brands of PLCs over the years and has developed HMIs using many different tools.
Read more about Mason White