A NALOG P OSITION R EADING F ROM AN LV D T

A NALOG P OSITION R EADING F ROM AN LV D T

A linear variable differential transformer (LVDT) provides position feed- back for the moving mechanism of a machine. Figure 11-55 illustrates a block diagram of an LVDT application. The LVDT has a range of ± 10 inches from its null position; therefore, the effective total range is 20 inches from a zero reference. The LVDT provides a ± 10 VDC signal and is connected to an analog input module, which transforms the –10 to +10 VDC voltage swing into counts ranging from –4095 to +4095.

LVDT

LVDT Attachment

Motor

0 inches Virtual

20 inches

Position (V.P.)

Virtual Position Start PB ( )

5867 TWS Reset PB ( )

Stop PB ( )

Counts + 4095

Displacment (inches)

Y counts = mX + b

Y counts =

20 X inches – 4095 Y counts = (4095)(10 –1 ) X inches – 4095

Figure 11-55. LVDT analog position reading system.

Industrial Text & Video Company 1-800-752-8398

www.industrialtext.com

S ECTION PLC System Programming C HAPTER 3 Programming

and Implementation 11

When the start push button starts the machine, the moving piece must move to the virtual starting position (V.P.) defined by the set of 4-digit TWS. The TWS settings range from 00.00 to 20.00; the decimal point will be imple- mented in the controller. When the machine finishes its cycle, the moving piece must return to the virtual position. The machine cycle may end at either side of the virtual starting position.

Figure 11-56 illustrates the flowchart for this system, while Tables 11-25, 11-

26, and 11-27 show the I/O address assignment, register assignment, and internal assignment, respectively. Figure 11-57 presents the PLC program solution for this example.

START

Read LVDT analog input

continously.

Is Start PB1

No

ON? Yes

GO SUB to ensure that position is at 0 inches.

Once at 0 inches, then go to V.P. Read TWS and

convert to counts.

After V.P. is read, start machine cycle. Issue end of cycle.

Go back to V.P. after end of machine cycle.

If stop is pushed, stop all machine activity.

If reset is pushed, stop activity and go back to 0" position.

END

Figure 11-56. Flowchart of the LVDT reading and virtual position calculations.

Industrial Text & Video Company 1-800-752-8398

www.industrialtext.com

S ECTION PLC System Programming C HAPTER 3 Programming

and Implementation 11

Table 11-25. I/O address assignment.

Table 11-26. Register assignment.

Subroutines are used to implement the flowchart, to facilitate interlocking and programming. Latch instructions enable the subroutines, allowing the program to go to a subroutine until its operation has been performed. Once a subroutine finishes its function, it sends an unlatch signal signifying the end of the subroutine. This unlatch signal triggers the execution of the next subroutine.

Industrial Text & Video Company 1-800-752-8398

www.industrialtext.com

S ECTION PLC System Programming C HAPTER 3 Programming

and Implementation 11

1 0 0 1 L V D T a n a l o g i n p u t e s t a b il s h e d ( L V D T R e a d )

1 3 5 0 C o m p a r e L V D T w ti h V . P . ( ≥ ) — R e t u r n t o V . P . s u b

Table 11-27. Internal output assignment.

Figures 11-58, 11-59, and 11-60 present the subroutine codes. In Figure 11-

58 (check for 0-inch position), the compare instruction checks for the LVDT count to be less than or equal to the compare constant –4090, rather than strictly equal to the value –4095. If the instruction checked for the value to be strictly equal to –4095, then fluctuations inherent in the LVDT’s count output could cause the PLC to not latch this value. So, once the LVDT passes –4090 counts, it latches this value and assumes that the position is at 0 inches.

Industrial Text & Video Company 1-800-752-8398

www.industrialtext.com

Start Mach

Cycle Done

Disable Cycle

N IO Start Mach

Start machine–no stop, no reset.

Stop

LVDT Read ro L XFER IN P

Read analog position continu-

Start Mach

Length 1

Enable

Cycle Done

Back to V.P.

Once the end of cycle is

In completed, return to V.P. for

d next cycle. When V.P. is u

Enable

CMP LVDT = 0" After start, go to subroutine

Back to V.P.

Sub Return to V.P. achieved (1362 ON), proceed

GO SUB 10

GO SUB 1150

and make sure at 0" to start.

GO SUB 1350

to next cycle.

tri a Once at 0" position (1153 ON),

lT Disable Sub

0" Found

go to V.P.

Found V.P. After Cycle

x Found V.P. after cycle.

t& Disable subroutine to find the

Deactivate subroutine to look

Stop

V.P. after cycle. Can be 001

for 0". System is stopped or

stopped because stop of

w id

reset commands.

e Reset

s Go to 0" after reset m

0" Found

Enable Read TWS Sub

Reset

tri If reset is pushed, return to 0" a p

a position and wait for start. n (sub 1250).

Read TWS and look for V.P.

lte CMP LVDT = 0" y

x GO SUB 1150 t.c

Enable Read TWS Sub

Read TWS Sub

Go to 0" after reset

GO SUB 1250

o At V.P. Ready

m 0" Found

1 Disable looking for 0" posi-

Deactivate read TWS sub to

look for V.P. because it is

tion after reset.

found. System stop or reset.

FWD Motor

-7 Forward Motor from com- Once V.P. is achieved, start 5 Reset

mands Go Fwd 1 (before cy-

a S ys

cycle of the machine in sub-

Go Fwd 2

routine 1750. The program of

cle) or Go Fwd 2 (after cycle).

te

subroutine 1750 (not included)

Im m

9 At VP Ready

performs the machining task.

Cycle Ready

Deactivation of machine cycle

can also occur due to a stop or

reset command. Once cycle is

Reverse motor.

finished, the subroutine must

ta m

tio n g in

Cycle Ready

Cycle Machine

issue an OS 1777 to signify

Go Rev 2

GO SUB 1750

the end of cycle from the sub-

routine. When it returns, the machine cycle is deactivated.

Figure 11-57. PLC implementation of the LVDT analog position reading example.

S ECTION PLC System Programming C HAPTER 3 Programming

and Implementation 11

CMP

Sub CMP LVDT = 0"

Compare analog input

Reg

counts with counts for 0"

Energize reverse motor command if not at 0".

Once at 0", send signal to main program to proceed.

RET

Figure 11-58. Subroutine 1150 brings moving part to 0" position.

XFER IN

Read TWS Sub

Read TWS value in inches.

Rack 0

The format has two decimal

Slot 1

points (10 –2 ).

Reg 4000 Length 1

BCD-BIN Done

Convert from BCD to binary

MUL Done

Multiply decimal value

Reg 4001

multiplier (x10 –2 because of

two decimals) with 409.5

Reg K 4095 (4095 x 10 = –1 ). Store in Reg 4002

register 4002 (counts).

Scale –3

Scale to 10 –3 due to both multipliers.

SUB

SUB Done

Reg 4002

Subtract 4095 according to

the linearization equation.

Reg K 4095 = Reg 4003

CMP

Compare value of analog

Reg 4100

input in counts with V.P. in

V.P. Found

counts. If greater or equal,

Reg 4003

indicate 1255 (ON).

V.P. Found

If V.P. not found, start motor. Move forward until V.P. is reached.

V.P. Found

At V.P. Ready

Ready for machine cycle.

RET

V.P. reached. Proceed with next operation.

Figure 11-59. Subroutine 1250 moves the part to the virtual position.

Industrial Text & Video Company 1-800-752-8398

www.industrialtext.com

S ECTION PLC System Programming C HAPTER 3 Programming

and Implementation 11

Return to V.P.

Compare value of LVDT po-

Reg 4100

sition with V.P. If greater or

equal, indicate 1351. If

Ahead of V.P.

Reg 4003

1351 = ON, V.P. is not

found from a pos ≥ VP.

Compare Done

Compare value of LVDT

Reg 4100

postion with V.P. If less or

equal, indicate 1353. If

Behind V.P.

Reg 4001

1353 = ON, V.P. is not

found from a pos < V.P. Ahead of V.P.

Rev Ahead of PV

Not back at V.P. from a

position greater than V.P. Therefore, reverse motor.

Ahead of V.P.

OS Found V.P. Rev

Found V.P. (latch signal) via

OS

reversing motor command. Issue a found command

OS Found V.P. Rev

Stop Rev Motor (1355 ON).

OS stops reverse motor command Go Rev 2 (1360).

Behind V.P.

Fwd Behind V.P.

Behind V.P.

OS Found V.P. Fwd Found V.P. (latch signal) via

forwarding motor command.

OS

Issue a found command (1357 ON).

OS Found V.P. Fwd

Stop Fwd Motor

OS stops forward motor

command Go Fwd 2 (1361).

Rev Ahead of V.P.

Reverse motor until V.P. is found.

Fwd Behind V.P.

Forward motor until V.P. is found.

OS Found V.P. Rev

Found V.P. After Cycle

Issue command back to main program that V.P. has been

OS Found V.P. Fwd

reached after machine cycle.

1357 RET

Figure 11-60. Subroutine 1350 returns the part to the virtual position at the end of cycle.

Industrial Text & Video Company 1-800-752-8398

www.industrialtext.com

S ECTION PLC System Programming C HAPTER 3 Programming

and Implementation 11

In Figure 11-59, scale multiplication allows the virtual position, which has two decimal points (10 –2 ) to be multiplied by the multiplication constant

(4095 × 10 –1 = 409.5); thus, the final scale is 10 –3 . This routine allows the motor to move the part to the virtual position as specified by the LVDT. Once the virtual position has been reached, the system is ready to start the machine cycle (one-shot output 1257). The machine cycle subroutine will return an end-of-cycle signal (output 1777) when finished, which disables the cycle subroutine (see Figure 11-57).

When the end of cycle has occurred, the PLC will tell the motor to move either forward or backward, depending on the moving part position at the end of cycle. The interlocking performed by output rungs 1354 and 1355 (refer to Figure 11-60) allow the motor to move in reverse if the part is farther than the virtual position (current position > V.P.). Rungs 1356 and 1357 perform the opposite function if the position of the part is closer than the virtual position (current position < V.P.).

The one-shot circuits used in the LVDT application prevent the system from moving the motor forward or backward until the part is at exactly the virtual position in counts. Analog count signals may jump one or two counts in either direction (up or down). This can result in instability, causing the forward and reverse signals to clash. The logic that is employed in this subroutine will detect, once the part crosses the virtual position (one-shot outputs 1355 and 1357 in Figure 11-60), whether the part is coming from a reverse motor or forward motor operation. Once the part is detected (i.e., when the one-shot is triggered), a minor jump in analog counts will not affect the operation, since the program has already determined that the part has just passed the virtual position. After the part stops at the virtual position, both the forward and reverse motor commands from the subroutine are inhibited.