8. PLC Memory Basics: Bits, Words, DINTs, and Tags


0
Categories : PLC Foundations

To understand PLC programming, you need to understand how a PLC stores information.

A PLC does not only turn inputs and outputs ON or OFF. It also stores data in memory.

That memory can hold:

Input status
Output status
Internal bits
Timers
Counters
Analog values
Setpoints
Faults
Alarms
Machine states
Recipe values
Production counts

In simple words:

PLC memory is where the controller stores the information it needs to run the machine.

PLC memory stores the user program, input/output status, numerical values, and other retrievable digital information. Common PLC data sizes such as bits, bytes, words, and double words, along with Allen-Bradley Logix data types like BOOL, SINT, INT, and DINT.


Why PLC Memory Matters

When you troubleshoot a PLC, you are not only looking at wires and modules.

You are also looking at memory.

For example:

DI_Start_PB = 1
Motor_Run_Command = 1
Timer_Done = 0
Tank_Level = 63.5
Fault_Active = 1
Door_State = 30

Each of these values is stored somewhere in PLC memory.

If you understand memory, it becomes easier to understand:

Why an output turns ON
Why a fault stays latched
Why a timer is done
Why a counter value changed
Why an analog value looks wrong
Why a state machine is stuck

1. What Is a Bit?

A bit is the smallest piece of PLC memory.

A bit can only be:

0 or 1
OFF or ON
False or True

In PLC logic, a bit is commonly used for simple ON/OFF conditions.

Examples:

Start_PB = 1
Stop_OK = 1
Motor_Running = 0
Fault_Active = 1
Auto_Mode = 1

A bit is perfect for discrete logic.


Bit Example

Imagine a photoeye sensor.

Box not present → Photoeye bit = 0
Box present     → Photoeye bit = 1

In ladder logic:

DI_Box_Present_PE       Conveyor_Stop_Request
----] [---------------------------( )----

If the bit is true, the rung can become true.


2. What Is a BOOL?

In Studio 5000 / Logix 5000, a single true/false tag is usually a BOOL.

BOOL = Boolean value
BOOL = 1 bit
BOOL = True or False

Common BOOL tags:

DI_Start_PB
DI_Stop_PB_OK
DO_Motor_Run
Motor_Command
Fault_Reset
Alarm_Active
Auto_Mode_Selected

A BOOL is used when the condition has only two states.


3. What Is a Byte?

A byte is a group of 8 bits.

1 byte = 8 bits

Bit positions are commonly numbered from 0 to 7.

Example:

Bit 7  Bit 6  Bit 5  Bit 4  Bit 3  Bit 2  Bit 1  Bit 0
  0      1      0      0      1      1      0      1

You may not use byte-level memory every day as a technician, but it is important for understanding digital data, communication, and older PLC systems.


4. What Is a Word?

A word is commonly a group of 16 bits.

1 word = 16 bits

Older PLC systems often organize data in 16-bit words.

For example, in RSLogix 500 / SLC 500 systems, you may see integer files like:

N7:0
N7:1
N7:2

These are commonly 16-bit integer values.

A 16-bit signed integer can hold values from:

-32,768 to 32,767

This is why sometimes you see analog raw values or counts stored as integers.


5. What Is a DINT?

A DINT means Double Integer.

In Allen-Bradley Logix systems:

DINT = 32-bit signed integer

A DINT can store a much larger whole number than a 16-bit INT.

Common uses for DINTs:

Production counts
Machine states
Step numbers
Fault codes
Recipe numbers
Index values
Counter values
Status words

Example:

Door_State = 30
Fault_Code = 104
Production_Count = 12500
Recipe_Number = 7

In modern Logix programming, DINTs are very common.


6. Common Logix 5000 Data Types

In Studio 5000, tags have data types.

A data type tells the PLC what kind of value the tag stores.

Data TypeSizeUsed ForExample
BOOL1 bitON/OFF logicMotor_Running
SINT8 bitsSmall integerSmall_Code
INT16 bitsInteger valueAnalog_Raw
DINT32 bitsStandard integerProduction_Count
REAL32 bitsDecimal valueTank_Level_Percent
TIMERStructureTimer instructionT_StartDelay
COUNTERStructureCounter instructionC_BoxCount

7. BOOL vs DINT vs REAL

This is a simple way to understand the difference:

BOOL = Yes or No
DINT = Whole number
REAL = Decimal number

Examples:

BOOL:
Motor_Running = True

DINT:
Box_Count = 245

REAL:
Tank_Level = 72.5%

Use the correct data type for the job.


8. What Is a REAL?

A REAL is used for decimal values.

Common REAL values:

Pressure_PSI = 82.4
Tank_Level_Percent = 63.7
Temperature_F = 145.8
Flow_GPM = 28.5
Speed_Hz = 42.3
Weight_lb = 725.6

REAL values are very common with analog signals and process control.

Example:

Raw analog signal → scaling logic → REAL engineering value
AI_Pressure_Raw = 16384
Pressure_PSI = 50.0

9. What Is a Tag?

A tag is a named memory location in the PLC.

In Studio 5000, instead of using only fixed memory addresses, you create tags with meaningful names.

Examples:

DI_Start_PB
DO_Motor_Starter
Motor_Run_Command
Tank_Level_Percent
Box_Count
Fault_Active
Door_State

Each tag has:

Name
Data type
Scope
Description
Value

Example:

Tag NameData TypeValueDescription
DI_Start_PBBOOL1Start pushbutton input
Motor_Run_CommandBOOL1Internal motor run command
Tank_Level_PercentREAL63.5Tank level in percent
Box_CountDINT125Production count
Door_StateDINT30Door machine state

10. Controller Tags vs Program Tags

In Studio 5000, tags can have different scope.

The two common scopes are:

Controller Scope
Program Scope

Controller Scope Tags

Controller tags are available to the whole controller.

They can be used by:

Multiple programs
HMI
SCADA
Produced/consumed tags
MSG instructions
Other controller-level functions

Examples:

HMI_Start_Command
Machine_Running
System_Faulted
Line_Status
Production_Count

Program Scope Tags

Program tags are local to a specific program.

They are useful for keeping logic organized.

Examples:

Motor_Run_Command
Motor_Start_Request
T_StartDelay
C_CycleCounter
Fault_Internal

Good tag organization makes troubleshooting easier.


11. Input Image and Output Image

A PLC stores the status of physical inputs and outputs in memory.

This is commonly known as:

Input image
Output image

Input Image

The input image stores what the PLC sees from the input modules.

Example:

Local:1:I.Data.0 = 1
Local:1:I.Data.1 = 0
Local:1:I.Data.2 = 1

These bits represent real input points.

Example alias tags:

Local:1:I.Data.0 → DI_Start_PB
Local:1:I.Data.1 → DI_Stop_PB_OK
Local:1:I.Data.2 → DI_Box_Present_PE

Output Image

The output image stores what the PLC commands to the output modules.

Example:

Local:2:O.Data.0 = 1
Local:2:O.Data.1 = 0
Local:2:O.Data.2 = 1

Example alias tags:

Local:2:O.Data.0 → DO_Motor_Starter
Local:2:O.Data.1 → DO_Solenoid_Valve
Local:2:O.Data.2 → DO_Run_Light

Understanding input/output memory is important because the PLC program works with memory values, not directly with the physical world.


12. Internal Bits

An internal bit is a BOOL tag used inside the PLC program.

It may not be directly wired to any physical device.

Examples:

Start_Request
Motor_Run_Command
Auto_Mode_Active
Cycle_Active
Fault_Reset_Request
Alarm_Acknowledge
Step_Complete
Permissive_OK
Interlock_Clear

Internal bits help organize logic.

Example:

DI_Start_PB → Start_Request → Motor_Run_Command → DO_Motor_Starter

This is cleaner than using raw inputs directly to physical outputs.


13. Timer Memory

A timer is not just one bit.

A timer is a structure that contains several values and bits.

Common timer elements:

.EN = Enable bit
.TT = Timer Timing bit
.DN = Done bit
.PRE = Preset value
.ACC = Accumulated value

Example:

T_MotorStartDelay.EN
T_MotorStartDelay.TT
T_MotorStartDelay.DN
T_MotorStartDelay.PRE
T_MotorStartDelay.ACC

If the timer preset is 5000 ms and the accumulated value reaches 5000 ms, the .DN bit turns ON.

Example:

T_MotorStartDelay.PRE = 5000
T_MotorStartDelay.ACC = 5000
T_MotorStartDelay.DN = 1

14. Counter Memory

A counter also has internal memory.

Common counter elements:

.CU = Count Up enable
.CD = Count Down enable
.DN = Done bit
.OV = Overflow bit
.UN = Underflow bit
.PRE = Preset value
.ACC = Accumulated count

Example:

C_BoxCount.ACC = 128
C_BoxCount.PRE = 500
C_BoxCount.DN = 0

When the accumulated count reaches the preset, the done bit turns ON.

C_BoxCount.ACC = 500
C_BoxCount.DN = 1

Counters are commonly used for production counting, machine cycles, reject counts, and batch tracking.


15. Retentive vs Non-Retentive Memory

Some PLC memory values reset when logic goes false or power cycles.

Other values stay stored.

This is called retentive and non-retentive memory.


Non-Retentive Example

A normal output energize bit is usually non-retentive.

If rung is true  → output ON
If rung is false → output OFF

Example:

Motor_Run_Command

If the logic goes false, the bit turns off.


Retentive Example

A latched bit or production count may stay stored until reset.

Examples:

Fault_Latched
Production_Count
Batch_Count
Machine_State
Retentive_Timer_ACC

A fault latch may remain active even after the original condition clears, until the operator presses reset.

Example:

Overload fault occurs → Fault_Latched = 1
Overload clears       → Fault_Latched stays 1
Operator resets       → Fault_Latched = 0

This is important in troubleshooting because some bits do not reset automatically.


16. Machine State Stored in Memory

A machine state is often stored as a DINT.

Example:

Door_State = 0
Door_State = 10
Door_State = 20
Door_State = 30
Door_State = 40
Door_State = 60

A simple state table:

State ValueMeaning
0Idle
10Opening
20Fully Open
30Closing
40Fully Closed
50Stopped
60Faulted

In logic, the PLC uses comparisons:

Door_State == 10 → Door is opening
Door_State == 30 → Door is closing
Door_State == 60 → Door is faulted

This is a professional way to organize machine sequences.


17. Fault Codes Stored in Memory

Faults are often stored as bits or numbers.

Fault Bits
Flt_Overload
Flt_FailedToStart
Flt_DoorTimeout
Flt_EstopOpen
Flt_VFD
Fault Code DINT
Fault_Code = 101

Example fault code table:

Fault CodeMeaning
0No fault
101Motor overload
102Failed to start
103Door timeout
104VFD fault
105Safety circuit open

Using a fault code makes it easier to send information to an HMI.


18. Analog Values Stored in Memory

Analog values usually start as raw values and are converted into engineering units.

Example:

AI_TankLevel_Raw = 16384
Tank_Level_Percent = 50.0

Or:

AI_Pressure_Raw = 22118
Pressure_PSI = 67.5

The PLC memory may store both:

Raw analog value
Scaled engineering value

This is useful for troubleshooting because you can compare what the module sees with what the HMI displays.


19. HMI Tags and PLC Memory

The HMI reads and writes PLC tags.

Examples:

HMI_Start_PB
HMI_Stop_PB
HMI_Reset_PB
HMI_Speed_Setpoint
HMI_Manual_Mode

The HMI may also display PLC memory values:

Motor_Running
Fault_Active
Tank_Level_Percent
Production_Count
Current_State
Alarm_Message

If the HMI shows the wrong value, the issue may be:

Wrong PLC tag
Wrong HMI tag
Communication problem
Wrong scaling
Wrong data type
Old runtime file
Tag renamed in PLC

20. Common Memory Mistakes

Mistake 1 — Using the Wrong Data Type

Example:

Using BOOL when you need a number
Using INT when the count may exceed 32,767
Using DINT where REAL is needed for decimal values

Mistake 2 — Not Understanding Retentive Bits

A latched fault may stay ON even after the field problem clears.

Example:

Sensor is now OK
But Fault_Latched is still ON
Machine still will not start

You need to reset the latch properly.


Mistake 3 — Confusing Command and Feedback

Example:

Motor_Run_Command = 1
Motor_Running_Feedback = 0

This means the PLC is asking the motor to run, but the field device has not proven that it is actually running.


Mistake 4 — Wrong HMI Data Type

An HMI may display a bad value if it reads the wrong data type.

Example:

PLC tag is REAL
HMI object expects INT

Result:

Wrong displayed value
No decimal point
Unstable display
Unexpected scaling

Practical Technician Example

Problem

A conveyor does not start.

Online Values
DI_Start_PB = 1
DI_Stop_PB_OK = 1
DI_Overload_OK = 1
Motor_Run_Command = 0
Flt_Conveyor = 1
Fault_Code = 102
Interpretation

The inputs are good, but the command is blocked because a fault is active.

Fault code 102 may mean:

Motor failed to start

The issue is not the Start button.

The issue is in the fault memory.


Practical Technician Example 2

Problem

The HMI tank level is stuck at 0%.

PLC Values
AI_TankLevel_Raw = 0
Tank_Level_Percent = 0.0

Possible issue:

Analog signal is missing
Transmitter has no power
Broken 4–20 mA loop
Input channel fault

But if:

AI_TankLevel_Raw = 16384
Tank_Level_Percent = 0.0

Possible issue:

Scaling logic problem
Wrong tag sent to HMI
HMI reading wrong value

Understanding memory helps you separate field problems from logic problems.


Automation Technician Notes

When troubleshooting PLC memory, ask:

Is this tag a BOOL, DINT, REAL, TIMER, or COUNTER?
Is the tag physical I/O or internal memory?
Is it a command or feedback?
Is it retentive or non-retentive?
Is the value being written somewhere else?
Is the HMI reading this tag correctly?
Is the data type correct?
Is the value raw or scaled?
Is the tag controller scope or program scope?

This mindset makes PLC troubleshooting much more professional.


Best Practices for PLC Memory and Tags

Use these habits:

Use clear tag names
Use consistent prefixes
Use BOOLs for ON/OFF logic
Use DINTs for counts, states, and codes
Use REALs for scaled analog values
Use timers and counters with descriptive names
Avoid duplicate writes to the same tag
Separate command tags from feedback tags
Use input and output mapping routines
Document descriptions clearly

Examples:

DI_Start_PB
DI_Stop_PB_OK
DO_Motor_Starter
Cmd_Motor_Run
Sts_Motor_Running
Flt_Motor_Overload
Alm_Motor_FailedToStart
T_MotorStartDelay
C_BoxCount
AI_Tank_Level_Raw
Tank_Level_Percent

Key Terms

TermMeaning
BitSmallest memory value, 0 or 1
BOOLBoolean tag, true or false
Byte8 bits
WordCommonly 16 bits
DINT32-bit signed integer
REALDecimal value
TagNamed memory location
Input ImageMemory storing physical input status
Output ImageMemory storing output commands
Internal BitPLC memory bit not directly wired to field device
TIMERTimer data structure
COUNTERCounter data structure
RetentiveMemory that stays stored until reset
Non-RetentiveMemory that resets when logic goes false
Engineering UnitsHuman-readable values such as PSI, %, °F, GPM

Final Thoughts

PLC memory is the foundation of how a controller stores and processes information.

A bit stores a simple ON/OFF condition. A DINT stores whole numbers such as counts, states, and fault codes. A REAL stores decimal process values such as pressure, temperature, and tank level. Tags give these memory locations meaningful names.

For an Automation Technician, understanding PLC memory makes troubleshooting much easier. It helps you understand what the PLC sees, what it remembers, what it commands, and what it sends to the HMI.

Once you understand bits, words, DINTs, REALs, timers, counters, and tags, PLC programs become much easier to read and diagnose.

Leave a Reply

Your email address will not be published. Required fields are marked *