   0:# INIT TABLES
   9:# 
  10:# ======= START RUNG 1 =======
  11:LabelRung1:
  12:
  13:set bit '$rung_top'
  15:# start series [
  16:# ELEM_PERSIST
  17:if '$rung_top' {
  18:    if '$EepromPostponeBytesCounter' != '0' {
  19:    } else {
  20:        set bit '$scratch' if EEPROM busy
  21:        if not '$scratch' {
  22:            if not '$once_0_isIniPERSIST_PROGRAM' {
  23:                set bit '$once_0_isIniPERSIST_PROGRAM'
  24:                read EEPROM[0..0+1] into 'PROGRAM'
  25:            } else {
  26:                read EEPROM[0..0+1] into '$tmpVar2byte'
  27:                if '$tmpVar2byte' != 'PROGRAM' {
  28:                    let var '$EepromPostponeBytesCounter' := 2
  29:                    let var '$EepromPostponeBytes' := 'PROGRAM'
  30:                    set bit '$once_1_isWrPERSIST_PROGRAM'
  31:                }
  32:            }
  33:        }
  34:    }
  35:}
  36:if '$once_1_isWrPERSIST_PROGRAM' {
  37:    if '$EepromPostponeBytesCounter' == '0' {
  38:    } else {
  39:        set bit '$scratch' if EEPROM busy
  40:        if not '$scratch' {
  41:            let var '$tmpVar2byte' := '2' - '$EepromPostponeBytesCounter'
  42:            write '$EepromPostponeBytes' into EEPROM[$tmpVar2byte]
  43:            let var '$EepromPostponeBytes' := '$EepromPostponeBytes' sr0 '8'
  44:            decrement '$EepromPostponeBytesCounter'
  45:            if '$EepromPostponeBytesCounter' == '0' {
  46:                clear bit '$once_1_isWrPERSIST_PROGRAM'
  47:            }
  48:        }
  49:    }
  50:}
  52:# ] finish series
  53:# 
  54:# ======= START RUNG 2 =======
  55:LabelRung2:
  56:
  57:set bit '$rung_top'
  59:# start series [
  60:# ELEM_CONTACTS
  61:if not 'XPP' {
  62:    clear bit '$rung_top'
  63:}
  65:# ELEM_COIL
  66:if '$rung_top' {
  67:    clear bit 'RNN'
  68:} else {
  69:    set bit 'RNN'
  70:}
  72:# ] finish series
  73:# 
  74:# ======= START RUNG 3 =======
  75:LabelRung3:
  76:
  77:set bit '$rung_top'
  79:# start series [
  80:# ELEM_CONTACTS
  81:if not 'RNN' {
  82:    clear bit '$rung_top'
  83:}
  85:# ELEM_ONE_SHOT_RISING
  86:if '$rung_top' {
  87:    if '$once_2_ONE_SHOT_RISING' {
  88:        clear bit '$rung_top'
  89:    } else {
  90:        set bit '$once_2_ONE_SHOT_RISING'
  91:    }
  92:} else {
  93:    clear bit '$once_2_ONE_SHOT_RISING'
  94:}
  96:# ELEM_LEQ
  97:if '$rung_top' {
  98:    if 'PROGRAM' > '2' {
  99:        clear bit '$rung_top'
 100:    }
 101:}
 103:# ELEM_ADD
 104:if '$rung_top' {
 105:    increment 'PROGRAM'; copy overlap(-1 to 0) flag to '$overlap'; copy overflow flag to 'ROverflowFlagV'
 106:}
 108:# ] finish series
 109:# 
 110:# ======= START RUNG 4 =======
 111:LabelRung4:
 112:
 113:set bit '$rung_top'
 115:# start series [
 116:# ELEM_EQU
 117:if '$rung_top' {
 118:    if 'PROGRAM' != '3' {
 119:        clear bit '$rung_top'
 120:    }
 121:}
 123:# ELEM_ONE_SHOT_RISING
 124:if '$rung_top' {
 125:    if '$once_3_ONE_SHOT_RISING' {
 126:        clear bit '$rung_top'
 127:    } else {
 128:        set bit '$once_3_ONE_SHOT_RISING'
 129:    }
 130:} else {
 131:    clear bit '$once_3_ONE_SHOT_RISING'
 132:}
 134:# ELEM_MOVE
 135:if '$rung_top' {
 136:    let var 'PROGRAM' := 0
 137:}
 139:# ] finish series
 140:# 
 141:# ======= START RUNG 5 =======
 142:LabelRung5:
 143:
 144:set bit '$rung_top'
 146:# start series [
 147:# ELEM_EQU
 148:if '$rung_top' {
 149:    if 'PROGRAM' != '0' {
 150:        clear bit '$rung_top'
 151:    }
 152:}
 154:# ELEM_COIL
 155:let bit 'Y1' := '$rung_top'
 157:# ] finish series
 158:# 
 159:# ======= START RUNG 6 =======
 160:LabelRung6:
 161:
 162:set bit '$rung_top'
 164:# start series [
 165:# ELEM_EQU
 166:if '$rung_top' {
 167:    if 'PROGRAM' != '1' {
 168:        clear bit '$rung_top'
 169:    }
 170:}
 172:# ELEM_COIL
 173:let bit 'Y2' := '$rung_top'
 175:# ] finish series
 176:# 
 177:# ======= START RUNG 7 =======
 178:LabelRung7:
 179:
 180:set bit '$rung_top'
 182:# start series [
 183:# ELEM_EQU
 184:if '$rung_top' {
 185:    if 'PROGRAM' != '2' {
 186:        clear bit '$rung_top'
 187:    }
 188:}
 190:# ELEM_COIL
 191:let bit 'Y3' := '$rung_top'
 193:# ] finish series
 194:LabelRung8:
 195:
 196:# Latest INT_OP here
