You're reading from Mastering PLC Programming
Chapter 2: Advanced Structured Text — Programming a PLC in Easy-to-Read English
- A pointer points to a memory address where a reference is similar to a pointer with less syntax and references another variable.
- The
^
symbol dereferences a pointer. TRY
,CATCH
,FINALLY
- Self-documenting code is logically named program attributes such as variable names.
- A good comment is a comment that is short and adds context to the code without cluttering it. A bad comment will not add any context to the code, is long, or will unnecessarily clutter the code.
- You should code to a variable so you only need to change values in one place, which will reduce the number of bugs in a program. Coding to a variable will also add context to what the value represents.
Chapter 4: Complex Variable Declaration — Using Variables to Their Fullest
- C
- A GVL is a global variable list where a struct is a data type.
- A constant is a variable that does not change where an ENUM is a user-defined data type that is composed of constants.
- There are many different errors you can get with an array; however, the most common one stems from trying to access an element that is not present.
ArrayName[1..5, 1..6]
OF <TYPE>;
Chapter 5: Functions — Making Code Modular and Maintainable
- A function is a callable block of code that provides modularity to a program, can accept parameters/arguments, and will only run when invoked.
- Arguments that are pre-assigned and do not need to be provided when the function is called.
- A parameter that is assigned a value when the function is called based on its name.
- The function’s parameters, return type, and other attributes that distinguish it.
- By default in a one-to-one fashion.
- Any amount of code as long as the code’s intended purpose can be described in one sentence without the word and.
- The type of value the function will return.
- Technically yes, depending on the system. However, certain return types cannot be assigned to certain variables.
Chapter 8: Libraries — Write Once, Use Anywhere
- A set of prebuilt attributes that can be imported and called by your current program.
- It shows users how to implement and use the library.
- Via the library manager.
- Singleton, Factory, Façade, anything that will simplify the use of the library.
///
is Declaration header while (**
) is a member header.- Varies
Chapter 10: Advanced Coding — Using SOLID to Make Solid Code
- Function blocks, methods, functions
- Break the module up so it is describable in a complete sentence without the word and.
- Principle that states that an object of a part class/function block should be replaceable with objects of a child class/function without affecting the behavior.
- Principle that states that a function block should not have to implement an interface it does not use, nor should it depend on a method that it does not use.
- See the following:
- S: Single-responsibility Principle
- O: Open-closed Principle
- L: Liskov Substitution Principle
- I: Interface Segregation Principle
- D: Dependency inversion Principle
Chapter 13: Layouts — Making HMIs User Friendly
Chapter 16: Distributed Control Systems, PLCs, and Networking
- A cluster that supervises multiple other processes.
- When a single process needs to be overseen.
- 125 Kbps, 250 Kbps, 500 Kbps
- One is ethernet based, the other is serial based, among other things such as speed.
- Star
- TCP/IP is slower but more reliable than UDP. UDP is faster but data integrity is not guaranteed.
- UDP
- Profinet, EtherCat
- 121 ohm
The rest of the chapter is locked
You have been reading a chapter from
Mastering PLC ProgrammingPublished in: Mar 2023Publisher: PacktISBN-13: 9781804612880
© 2023 Packt Publishing Limited All Rights Reserved
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 €14.99/month. Cancel anytime