// Maker Programing: BAKTI DAN ALFIAN / POLITEKNIK NEGERI BANDUNG
// KETERANGAN : INPUT 1 MENGENDALI OUTPUT 1 DAN OUTPUT 2 DAN RESET DAN STOP SEDANG
UJICOBA
// Created On: Wednesday, May 30, 2012, 01:03 PM
// File Name: INDEPENDENT_3W.lf
LOGIC_ID 261 //3 WIRE INDEPENDENT MODE
// Temp register allocation
// Temp 0 and Temp 1 as scratch
// Temp 2 as Requested Control Mode
// 0=PLC
// 1=HMI
// 2=TS (terminal strip)
// Temp 3 as Active Control Mode
// 0=PLC
// 1=HMI
// 2=TS (terminal strip)
// Temp 4 as state bits group 1
// 0=Control Transfer in process
// 1=LO1 PLC fallback value
// 2=L02 PLC fallback value
// 3=L01 HMI fallback value
// 4=L02 HMI fallback value
// 5=Global Stop
// 6=Stop1
// 7=Stop2
// 8=Run1
// 9=Run2
// 10=Forward
// 11=Reverse
// 12=Reversing Timer
// 13=Swapping
// 14=Last Direction
// 15=Two Wire Swap
// Temp 5 as 2 Step states
// Temp 6,7,8 as Step 1 Timer
// Temp 9,10,11 as Step 2 Timer
// Temp 12 as INPUT History
// 1=PLC Run 1
// 2=PLC Run 2
// 3=HMI Run 1
// 4=HMI Run 2
// 5=TS Run 1
// 6=TS Run 2
// 7=Mode Change 1
// 8=Spare
// 9=Mode Change 2
// 10=Spare
// 11=Bumpless in Process
// 12=Power up Done
// Temp 13 as Voltage Dip and HMI keypad group
// 0=Normal Load Shed
// 1=Dip Auto Enable
// 2=Dip Stop
// 3=Dip Stop History
// 4=Dip Set Inhibit Latch
// 5=Dip Clear Inhibit Latch
// 6=Dip Inhibit Run
// 7 11=Spare
// 12=HMI Aux 1
// 13=HMI Aux 2
// 14=HMI Stop
// Temp 14 Voltage Dip Latch Status
// 0=State
// 1=Set
// 2=Clear
// Temp 15 Custom Logic Outputs
// 0=CL "Motor Running" information
// 1=CL "Motor Stopped" information
// 2=CL "Reset" information
// 9=CL "Run1 LED" information
// 10=CL "Run2 LED" information
// 11=CL "Stop LED" information
// 12=CL "Run1 Cde" information
// 13=CL "Run2 Cde" information
// 14=CL "Alarm" information
// 15=CL "No Fault" information
// Temp 16 Custom Logic Terminal Strip imputs
// 0=Run 1
// 1=Run 2
// 2=External fault
// 4=Reset
// 5=Local/Remote Control
// Temp 17 Custom Logic HMI imputs
// 0=Aux 1
// 1=Aux 2
// 3=Stop
// 5=Local/Remote Control
// Temp 18 Custom Logic REMOTE inputs
// 0=Run 1
// 1=Run 2
// 3=Reset
// Temp 19 Speedup image of LTMR Register 1200.
// Temp 20 three wire status
// 0=3_wire / not 3 wire(2 wire)
// Temp 50+ as general status registers
// Temp 50 as ONSET status transition time value
// Temp 51 as ONSET status Low to High timer
// Temp 52 as ONSET status High to Low timer
// Temp 53 Last Speed Latch Save Requested Control.in Temp 2
// Temp 54, 55 HMI Remote State Counter (LSB is significant)
// Temp 56 as HMI Local/Remote state bits
// 0=HMI Remote Active
// 1=Remote LED Status
// 2=HMI L/R button history
// Temp 57, 58, 59, 60, 61 as OFF TIME adjustment of Transition Timer Reg 541.
//define 2_wire or 3_wire
LOAD_K_BIT 1
SET_TMP_BIT 20 0 //3 wire
//LOAD_K_BIT 1
//SET_NOT_TMP_BIT 20 0 2 wire
//Input
LOAD_BIT 457 0 //LI1
SET_NOT_TMP_BIT 16 0
SET_TMP_BIT 16 1
SET_NOT_TMP_BIT 16 3
//LOAD_BIT 457 0 //LI2
//SET_TMP_BIT 16 1
//SET_NOT_TMP_BIT 16 3
//LOAD_BIT 457 2 //LI3
//SET_TMP_BIT 16 2
//LOAD_BIT 457 3 //LI4
//SET_TMP_BIT 16 3
//LOAD_BIT 457 4 //LI5
//SET_TMP_BIT 16 4
//AND_TMP_BIT 16 4
//OR_NOT_TMP_BIT 16 4
LOAD_BIT 457 3
//SET_TMP_BIT 16 3
SET_NOT_TMP_BIT 16 3
SET_TMP_BIT 16 2
LOAD_BIT 457 4
SET_TMP_BIT 16 4
OR_TMP_BIT 16 3
SET_TMP_BIT 16 3
//OR_TMP_BIT 16 4
//SET_TMP_BIT 16 4
//OR_NOT_TMP_BIT 16 3
//SET_TMP_BIT 16 3
//OR_NOT_TMP_BIT 16 4
//SET_TMP_BIT 16 4
LOAD_BIT 457 5 //LI6
SET_TMP_BIT 16 5
LOAD_BIT 1020 12 //HMI Aux1 button
SET_TMP_BIT 17 0
LOAD_BIT 1020 13 //HMI Aux2 button
SET_TMP_BIT 17 1
LOAD_BIT 1020 14 //HMI Stop button
SET_TMP_BIT 17 2
LOAD_BIT 1020 11 //HMI Reset button
SET_TMP_BIT 17 4
LOAD_BIT 1020 10 //HMI L/R button
SET_TMP_BIT 17 5
LOAD_BIT 704 0 //PLC Run1 command
SET_TMP_BIT 18 0
LOAD_BIT 704 1 //PLC Run2 command
SET_TMP_BIT 18 1
LOAD_BIT 704 3 //PLC Run2 command
SET_TMP_BIT 18 3
//End customer Zone
//Call Command
//Output
//=========================================================
// Customer Zone: Custom application
// Add specific code for Custom Logic function here
CALL_EOM 2 //Independent mode
//=========================================================
// Customer Zone: Outputs management
//HMI Aux 1 Led
LOAD_TMP_BIT 15 9
SET_TMP_BIT 19 9 //Image of HMI Aux1 LED
//HMI Aux 2 Led
//LOAD_TMP_BIT 15 10
//SET_TMP_BIT 19 10 //Image of HMI Aux2 LED
//HMI Stop Led
LOAD_TMP_BIT 15 11
SET_TMP_BIT 19 11 //Image of HMI Stop LED
// Output LO1
LOAD_TMP_BIT 15 12
SET_TMP_BIT 19 12 //Image of Output LO1
// Output LO2
LOAD_TMP_BIT 15 13
SET_TMP_BIT 19 13 //Image of Output LO2
// Output LO3
LOAD_TMP_BIT 15 14
SET_TMP_BIT 19 14 //Image of Output LO3
// Output LO4
//LOAD_TMP_BIT 15 15
//SET_TMP_BIT 19 15 //Image of Output LO4
// End Customer Zone
//=========================================================
// Schneider Zone (Do not modify)
LOAD_K_BIT 1
SET_NOT_TMP_BIT 0 3
LOAD_TMP_REG 19 //Get image of 1200
ON_SET_REG 1200 0 //Put it into 1200