Programmable Logic Controllers (PLC) will scan very quickly. This can be anywhere from 1 to 20 ms, which translates into 1000 to 500 times each second. But what exactly is a scan?

A scan is when the PLC will complete the following:

Read Inputs:

Look at all of the inputs to the programmable controller. Digital, Analog, Communication

Execute Program:

Solve the logic to determine the output status. PLCs generally will solve the logic from left to right, top to bottom. The output of the rung before is available for the next rung.

This is like some of the popular brands of PLCs like Mitsubishi, Allen Bradley, Siemens, Omron, Automation Direct, etc. There are some exceptions like older Modicon models that solve the logic top to bottom, left to right. Always refer to the manufactures manual to ensure the program execution method.

Diagnostics and Communication:

The PLC will do a self-check. It will verify that no errors exist in memory, cards attached, etc. This is critical because the PLC in an industrial application can have devastating effects if something malfunctions and the machine continues to function erratically. The PLC will stop executing, return the outputs to a normal state, and indicate an error has occurred.

Communication will happen to the remote I/O, operator panels, etc.

Update Outputs:

Outputs are set according to the PLC program. (Digital, Analog) This is where the physical items will start moving. (Motors, Valves, etc.)

To understand the scan lets take a look at an example.

The following program will look at input X0 and set an internal bit for one scan one on the rising edge of the input and one on the trailing edge of the input. The rising edge is when the input transitions from off to on and the trailing edge is when the input transitions from on to off.

The bits will only be on for one scan so we will increment an internal word by one when the bits go on. This way we will be able to see the bit increment in the word.

Leading-edge one shot (one scan) bit. When the input signal goes on (X0) and C1 is not on, then C0 is turned on. The next rung will have C0 and X0 on so C1 turns on.

Remember: The PLC will scan from left to right, top to bottom and the outputs from the previous rung are available for the next.

C0 is on so the increment will add one to D0.

The next scan X0 is still on, C1 is now on so output C0 is turned off. C0 has been now on for one scan from the transition from off to on.

Trailing edge one shot (one scan) bit. When the input signal goes ooff (X0) and C3 is not on, then C2 is turned on. The next rung will have C2 and not X0 on so C3 turns on.

C2 is on so the increment will add one to D1.

The next scan X0 is still off, C3 is now on so output C2 is turned off. C2 has been now on for one scan from the transition from on to off.

Contact me for the above program. I will be happy to email it to you.
If you have any questions or need further information please contact me.
Thank you,
Garry

You can download the software and simulator free at the following address. Also listed are helpful guides to walk you through your first program. Do-more Designer Software

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.

Most programmable controllers will come with an RS232 communication port. This recommended standard (RS) has voltage signals in the range between 3 to 15 volts DC with respect to the ground/common pin. RS232 devices are classed either DTE (data terminal equipment) or DCE (data communication equipment).
The maximum cable length for the communication cable is 15m, however, depending on the environment, I have seen this as much as 50m without an issue.
Most RS232 connectors are 9 pins like the diagram below, but they can also come in 25 pin or RJ45 connectors.

A minimum 3 wire RS232 connection consists of only the transmit data, receive data, and ground. This is commonly used if full handshaking is not required.

Note: I always jump Pin 4 and 6 out together on each side. The shield on the connection cable should only be connected to one housing when making the cable. I usually connect it on the PLC-end.

5 wire RS232 connection consists of the transmit data, receive data, ground, request to send (RTS), clear to send (CTS)

Note: The shield on the connection cable should only be connected to one housing when making the cable. I usually connect it on the PLC-end.

RS232 is a one to one communication method. (1:1) This means it is designed to communicate with one device. If multiple devices are needed,(1: N) RS422 or RS485 should be used by way of converters.

RS232 must have the same settings on each end. (Port Settings)

These include the following parameters:

Bits per second: 9600 (Baud Rate)

Data Bits: 8

Parity: None

Stop Bits: 1

Flow Control: None

I have found the following connectors are great to test and connect if you are unsure of the communication pinout.

Just select a DB9, DB25, or DB15 connector depending on the number of pins of your serial port.
These connectors should be part of everyone’s toolbox. You never know when they will come in handy.

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.

Allot of times in industrial environments we get noise on the analog signal input to PLC’s or other controllers. The noise can be generated by motors, bad wiring, etc.

Placing a 1- 100 uF capacitor on the input signal and ground (common to the cabinet) will reduce the noise that the input is receiving.

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.

I have always been an old school programmer. Hardware in front of you hooked up to all of the I/O. I have recently looked at the automation direct do-more designer software solution. The Do-More Designer Software will allow you to build your ladder logic, download into a simulator (comes with the software) and run the code. The price of all of this… FREE

I will not get into a lot of details because the documentation available already will get you through the software step by step.
– Download the software
– Install the software
– Use the YouTube videos for help with getting around the software and making your first program.

The following are several links to help you discover the plc programmer in you:

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.

The term I/O means Input/Output. I/O can come in two different types; Discrete or Analog Most people starting out leaning about programmable logic controls (PLC) are taught all about discrete input and outputs. Data is received from devices such as push-buttons, limit-switches etc. and devices are turned on such as motor contactor, lights, etc. Discrete input and output bits are either on or off. (1 or 0) The following program will show a motor control circuit stop start. Motor off:

Motor on:

Analog inputs Common input variables for analog are temperature, flow, pressure, etc. They are converted to an electrical signal into a PLC analog input. Standard electrical signals are 0 – 20 mA, 4 – 20 mA, 0 – 10 volts DC, -10 – 10 volts DC. Note: It is recommended that a 4 – 20 mA signal is best. If voltage is required, a resistor can be added to get a voltage input. Analog outputs Common output variables for analog are speed, flow, pressure, etc. They are converted from a word in the PLC to the output of the analog. The range of signal is then outputted to the device to control the position, rate, etc. Standard electrical signals to the device are 4 – 20 mA, 0 – 10 volts DC, -10 – 10 volts DC. Both Analog Inputs and Outputs use words to determine the signal going to or from the device. Example: 4 – 20 mA current Input – 8 bit resolution 4 mA = 000000002 = 0016 20 mA = 111111112 = FF16 Example: 4 – 20 mA current Output – 8 bit resolution 0016 = 000000002 =4 mA FF16 = 111111112 =20 mA For a review of numbering systems, follow the link below: What everyone should know about PLC numbering systems

Let me know if you have any questions or need further information.
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.

Grey Code
Grey Code is used because only one bit of data will change at a time. The following chart shows the conversion of Grey Code to Binary.

Number

Binary Code

Grey Code

Number

Binary Code

Grey Code

0

0000

0000

8

1000

1100

1

0001

0001

9

1001

1101

2

0010

0011

10

1010

1111

3

0011

0010

11

1011

1110

4

0100

0110

12

1100

1010

5

0101

0111

13

1101

1011

6

0110

0101

14

1110

1001

7

0111

0100

15

1111

1000

It is important for absolute encoders because if the power is interrupted the encoder will know where it is within the one bit.

Example:
Power is interrupted when the encoder is between 7 and 8. If we are looking at Binary Code all of the bits would be effected and we would not be sure as to what number we are looking at for the encoder. Therefore we have lost position. In Grey Code only one bit changes so we will still be able to tell if we were on 7 or 8 if the power was interrupted.

The following sample PLC program will convert 4 bit grey code into binary code.
This code was written in an Automation Direct PLC software called Do-more Designer.

Contact me for the above program. I will be happy to email it to you.
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.

Programmable Logic Controllers (PLC) are the same as computers. They only understand two conditions; on and off. (1 or 0 / Hi or Low/ etc.) This is known as binary. The PLC will only understand binary but we need to display, understand and use other numbering systems to make things work. Let’s look at the following common numbering systems.

Binary has a base of two (2). Base means the number of symbols used. In binary the symbols are 1 or 0. Each binary symbol can be referred to as a bit. Putting multiple bits together will give you something that looks like this: 100101112. The 2 represents the number of symbols/binary notation. Locations of the bits will indicate weight of the number. The weight of the number is just the number to the power of the position. Positions always start at 0. The right hand bit is the ‘least significant bit’ and the left hand bit is the ‘most significant bit’.

Let’s look back at our example to determine what the value of the binary number is:
100101112 =
We start with the least significant bit and work our way to the most significant bit.
1 x 2^{0 }= 1 x 1 = 1
1 x 2^{1 }= 1 x 2 = 2

1 x 2^{2 }= 1 x 2 x 2 = 4

0 x 2^{3 }= 0 x 2 x 2 x 2 = 0

1 x 2^{4 }= 1 x 2 x 2 x 2 x 2 = 16

0 x 2^{5 }= 0 x 2 x 2 x 2 x 2 x 2 = 0

0 x 2^{6 }= 0 x 2 x 2 x 2 x 2 x 2 x 2 = 0

1 x 2^{7 }= 1 x 2 x 2 x 2 x 2 x 2 x 2 x 2 = 128

100101112 = 1 + 2 + 4 + 16 + 128

100101112 = 151

Note that the we just converted the binary number to our decimal numbering system. The decimal numbering system is not written with a base value of 10 because this is universally understood.

To be sure we have the concept down, let’s take a look at our decimal numbering system the same way as we did the binary.

Decimal has a base of ten (10). The symbols are 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9.

15110 =

1 x 10^{0 }= 1 x 1 = 1

5 x 10^{1 }= 5 x 10 = 50
1 x 10^{2 }= 1 x 10 x 10 = 100
15110 = 1 + 50 + 100
151 = 151

Hexadecimal has a base of sixteen (16). The symbols are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E and F. Hexadecimal is used to represent binary numbers. F16 = 11112
Every for bits of binary represent one hexadecimal digit.
In our original binary number we now can convert this to hexadecimal.
100101112
The least significant four bits are:
01112 =
1 x 2^{0 }= 1 x 1 = 1
1 x 2^{1 }= 1 x 2 = 2

1 x 2^{2 }= 1 x 2 x 2 = 4

0 x 2^{3 }= 0 x 2 x 2 x 2 = 0

01112 = 1 + 2 + 4 + 0 = 716

The most significant four bits are:

10012 =

1 x 2^{0 }= 1 x 1 = 1

0 x 2^{1 }= 0 x 2 = 0

0 x 2^{2 }= 0 x 2 x 2 = 0

1 x 2^{3 }= 1 x 2 x 2 x 2 = 8

10012 = 1 + 0 + 0 + 8 = 916
Therefore:
100101112 = 9716
We can now convert this hexadecimal number back into decimal
9716 =

7 x 16^{0 }= 7 x 1 = 7

9 x 16^{1 }= 9 x 16 = 144
9716 = 7 + 144 = 151

The following chart will show all of the combinations for 4 bits (nibble) of binary. Its shows the Binary, Decimal and Hexadecimal (Hex) values. It is interesting to not that Hex is used because you still have only one digit (Place Holder) to represent the nibble of information.

Binary

Decimal

Hexadecimal

Binary

Decimal

Hexadecimal

0000

00

0

1000

08

8

0001

01

1

1001

09

9

0010

02

2

1010

10

A

0011

03

3

1011

11

B

0100

04

4

1100

12

C

0101

05

5

1101

13

D

0110

06

6

1110

14

E

0111

07

7

1111

15

F

ASCII (American Standard Code for Information Interchange)

Two nibbles (8 bits of data) together form a byte. A byte is what computers (PLC) use to store and use individual information. So it will take one unique byte to represent each individual numbers, letters (upper and lower case), punctuation etc. www.AsciiTable.com

Example:

Chr ‘A’ = 4116 = 010000012

Chr ‘a’ = 6116 = 011000012

Chr ‘5’ = 3516 = 001101012

Each time you hit a key on your keyboard, the following 8 bits of data get sent.

A word ismade up of two bytes, or 4 nibbles, or 16 bits of data. Words are used in the PLC for holding information. The word can also be referred to as an integer.

Long word / Double word is made up of 4 bytes, or 8 nibbles, or 32 bits of data. Long words are used for instructions in the PLC like math.

Hey what about negative numbers?

So far we have talked about unsigned words. (Positive numbers)

Signed words can hold negative numbers. Bit 15 (most significant bit) of a word is used to determine if the word is negative or not.

The following table shows you the signed vs unsigned numbers that can be represented in the PLC.

HEX

8000

BFFF

FFFE

FFFF

0000

3FFF

7FFE

7FFF

Signed

-32768

-16385

-0002

-0001

00000

16383

32766

32767

Unsigned

32768

49151

65534

65535

00000

16383

32766

32767

Memory retentiveness:

When working with PLC’s look at the memory tables to determine what will happen if power is removed from the device. Will the bits go all off or retain their prior state?

Usually there will be areas that can be used in the PLC for both conditions.

As you can see PLC numbering systems and computers are very much related and it all boils down to individual bits turning on and off. The interpretation of these bits will determine what the value will be.

Let me know your thoughts, or questions that you have on PLC numbering systems.

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.