Skip to main content

Phase 2 - Resolve Compilation Warnings

· 2 min read
Adrian Littlejohns
Industrial Process Control and Automation Enthusiast

Today's Tasks

  1. Compilation Warnings
    1. LT410 scaling
    2. OBJECT TIMER
    3. FaultTDAlsafe
    4. PULSGENERATOR

Compilation Warnings

LT410 scaling

Method

An integer value was being written to an absolute address of a datablock memory area which consisted of consecutive boolean variables.

To resolve the issue, employed R function to reset each bit individually.

Question

Is there a more concise method of resetting consecutive bits which are not in an array?

OBJECT TIMER

Warning

Network 1,The output parameter "OUT" might not be written.

Method

Replaced the BEC operator with a JC to the END label

Original code

     A     #START               //Start of timer
JC CNT
L 0
T #MEMORY //Reset MEMORY
JU END
CNT: L #MEMORY
L #TIME_VALUE
>=I
JC END
A #F_PULSE //FLANK PULSE
L #MEMORY
JCN END
L 65535
==I //Check overflow
SAVE
BEC
L #MEMORY
L 1 //Count up
+I
T #MEMORY
END: A(
L #MEMORY
L #TIME_VALUE
>=I
)
A #START
= #OUT

updated to

     A     #START               //Start of timer
JC CNT
L 0
T #MEMORY //Reset MEMORY
JU END
CNT: CLR
L #MEMORY
L #TIME_VALUE
>=I
JC END
A #F_PULSE //FLANK PULSE
L #MEMORY
JCN END
L 65535
==I //Check overflow
JC END // <-- added to resolve compilation warning. afl 111025
L #MEMORY
L 1 //Count up
+I
T #MEMORY
END: CLR
A(
L #MEMORY
L #TIME_VALUE
>=I
)
A #START
= #OUT

FaultTDAlsafe

The Problem

Block Interface - Temp

img_1.png

Network 4

img.png

The Fix

Block Interface - Temp

img_2.png

Network 4

img_3.png

PULSGENERATOR

The Problem(s)

Block Interface Input variables were being written too. Block Interface Output variables were being read.

The Fix

  1. Removed lines A #ALWAYS_FALSE and AN #ALWAYS_TRUE,
  2. Added SET on line 1
  3. Moved the HELP_BYTE to the InOut interface.
  4. Updated the PULSGENERATOR block call
  5. Compiled, Program Blocks > software(Rebuild All)

Before fix

img_4.png

MAIN_PRG

img_5.png

After fix

img_6.png

MAIN_PRG

img_7.png