   0:# INIT TABLES
   1:INIT TABLE signed 1 byte char7seg[129] := {63, 6, 91, 79, 102, 109, 125, 7, 127, 111, 119, 124, 57, 94, 121, 113, 191, 134, 219, 207, 230, 237, 253, 135, 255, 239, 247, 252, 185, 222, 249, 241, 0, 176, 34, 78, 109, 210, 218, 32, 57, 15, 114, 112, 12, 64, 128, 82, 63, 6, 91, 79, 102, 109, 125, 7, 127, 111, 9, 13, 97, 65, 67, 211, 159, 119, 124, 57, 94, 121, 113, 61, 116, 48, 30, 117, 56, 85, 84, 92, 115, 103, 51, 109, 120, 62, 28, 106, 118, 110, 91, 57, 100, 15, 35, 8, 32, 95, 124, 88, 94, 123, 113, 111, 116, 16, 14, 117, 24, 85, 84, 92, 115, 103, 80, 109, 120, 62, 28, 106, 118, 110, 91, 57, 48, 15, 1, 0, 99}
   2:# INIT TABLE: signed 0 bit char7seg[129] see above
   3:# INIT TABLE: signed 0 bit char7seg[129] see above
   4:# INIT TABLE: signed 0 bit char7seg[129] see above
   5:# INIT VARS
   6:if not '$once_0_INIT_VARS' {
   7:    set bit '$once_0_INIT_VARS'
   8:    let var 'Csec' := 0
   9:    let var 'CMinu' := 0
  10:    let var 'CHora' := 0
  11:    let var 'C3' := 0
  12:}
  30:# 
  31:# ======= START RUNG 1 =======
  32:LabelRung1:
  33:
  34:# -- display = common cathode
  35:# 
  36:# ======= START RUNG 2 =======
  37:LabelRung2:
  38:
  39:set bit '$rung_top'
  41:# start series [
  42:# ELEM_MOVE
  43:if '$rung_top' {
  44:    let var '#TRISB' := 0
  45:}
  47:# ] finish series
  48:# 
  49:# ======= START RUNG 3 =======
  50:LabelRung3:
  51:
  52:# -- T1 = sec counter
  53:# 
  54:# ======= START RUNG 4 =======
  55:LabelRung4:
  56:
  57:set bit '$rung_top'
  59:# start series [
  60:# ELEM_TCY T1 500000
  61:if '$rung_top' {
  62:    if 'T1' < '500' {
  63:        increment 'T1'
  64:    } else {
  65:        let var 'T1' := 0
  66:        if not '$once_1_TCY_T1' {
  67:            set bit '$once_1_TCY_T1'
  68:        } else {
  69:            clear bit '$once_1_TCY_T1'
  70:        }
  71:    }
  72:    if not '$once_1_TCY_T1' {
  73:        clear bit '$rung_top'
  74:    }
  75:} else {
  76:    let var 'T1' := 0
  77:}
  79:# ELEM_COIL
  80:let bit 'Rosc' := '$rung_top'
  82:# ] finish series
  83:# 
  84:# ======= START RUNG 5 =======
  85:LabelRung5:
  86:
  87:# -- XMinSet & XHorSet are the set time buttons
  88:# 
  89:# ======= START RUNG 6 =======
  90:LabelRung6:
  91:
  92:set bit '$rung_top'
  94:# start series [
  95:# start parallel [
  96:clear bit '$parOut_0'
  97:let bit '$parThis_0' := '$rung_top'
  98:# start series [
  99:# start parallel [
 100:clear bit '$parOut_1'
 101:let bit '$parThis_1' := '$parThis_0'
 102:# start series [
 103:# ELEM_CONTACTS
 104:if not 'Rosc' {
 105:    clear bit '$parThis_1'
 106:}
 108:# ELEM_CTC
 109:if '$parThis_1' {
 110:    clear bit '$parThis_1'
 111:    if not '$once_2_CTC_Csec' {
 112:        set bit '$once_2_CTC_Csec'
 113:        increment 'Csec'
 114:        if 'Csec' > '59' {
 115:            let var 'Csec' := 0
 116:            set bit '$parThis_1'
 117:        }
 118:    }
 119:} else {
 120:    clear bit '$once_2_CTC_Csec'
 121:}
 123:# ] finish series
 124:if '$parThis_1' {
 125:    set bit '$parOut_1'
 126:}
 127:let bit '$parThis_1' := '$parThis_0'
 128:# start series [
 129:# ELEM_CONTACTS
 130:if not 'XMinuSet' {
 131:    clear bit '$parThis_1'
 132:}
 134:# ELEM_ONE_SHOT_RISING
 135:if '$parThis_1' {
 136:    if '$once_3_ONE_SHOT_RISING' {
 137:        clear bit '$parThis_1'
 138:    } else {
 139:        set bit '$once_3_ONE_SHOT_RISING'
 140:    }
 141:} else {
 142:    clear bit '$once_3_ONE_SHOT_RISING'
 143:}
 145:# ] finish series
 146:if '$parThis_1' {
 147:    set bit '$parOut_1'
 148:}
 149:let bit '$parThis_0' := '$parOut_1'
 150:# ] finish parallel
 151:# ELEM_CTC
 152:if '$parThis_0' {
 153:    clear bit '$parThis_0'
 154:    if not '$once_4_CTC_CMinu' {
 155:        set bit '$once_4_CTC_CMinu'
 156:        increment 'CMinu'
 157:        if 'CMinu' > '59' {
 158:            let var 'CMinu' := 0
 159:            set bit '$parThis_0'
 160:        }
 161:    }
 162:} else {
 163:    clear bit '$once_4_CTC_CMinu'
 164:}
 166:# ] finish series
 167:if '$parThis_0' {
 168:    set bit '$parOut_0'
 169:}
 170:let bit '$parThis_0' := '$rung_top'
 171:# start series [
 172:# ELEM_CONTACTS
 173:if not 'XHoraSet' {
 174:    clear bit '$parThis_0'
 175:}
 177:# ELEM_ONE_SHOT_RISING
 178:if '$parThis_0' {
 179:    if '$once_5_ONE_SHOT_RISING' {
 180:        clear bit '$parThis_0'
 181:    } else {
 182:        set bit '$once_5_ONE_SHOT_RISING'
 183:    }
 184:} else {
 185:    clear bit '$once_5_ONE_SHOT_RISING'
 186:}
 188:# ] finish series
 189:if '$parThis_0' {
 190:    set bit '$parOut_0'
 191:}
 192:let bit '$rung_top' := '$parOut_0'
 193:# ] finish parallel
 194:# ELEM_CTC
 195:if '$rung_top' {
 196:    clear bit '$rung_top'
 197:    if not '$once_6_CTC_CHora' {
 198:        set bit '$once_6_CTC_CHora'
 199:        increment 'CHora'
 200:        if 'CHora' > '23' {
 201:            let var 'CHora' := 0
 202:            set bit '$rung_top'
 203:        }
 204:    }
 205:} else {
 206:    clear bit '$once_6_CTC_CHora'
 207:}
 209:# ] finish series
 210:# 
 211:# ======= START RUNG 7 =======
 212:LabelRung7:
 213:
 214:# --add comment here--
 215:# 
 216:# ======= START RUNG 8 =======
 217:LabelRung8:
 218:
 219:set bit '$rung_top'
 221:# start series [
 222:# ELEM_DIV
 223:if '$rung_top' {
 224:    let var '$scratch2' := 10
 225:    let var 'Dezena1' := 'CHora' / '$scratch2'
 226:}
 228:# ] finish series
 229:# 
 230:# ======= START RUNG 9 =======
 231:LabelRung9:
 232:
 233:set bit '$rung_top'
 235:# start series [
 236:# ELEM_MOD
 237:if '$rung_top' {
 238:    let var '$scratch2' := 10
 239:    let var 'Unidade1' := 'CHora' % '$scratch2'
 240:}
 242:# ] finish series
 243:# 
 244:# ======= START RUNG 10 =======
 245:LabelRung10:
 246:
 247:set bit '$rung_top'
 249:# start series [
 250:# ELEM_DIV
 251:if '$rung_top' {
 252:    let var '$scratch2' := 10
 253:    let var 'Dezena2' := 'CMinu' / '$scratch2'
 254:}
 256:# ] finish series
 257:# 
 258:# ======= START RUNG 11 =======
 259:LabelRung11:
 260:
 261:set bit '$rung_top'
 263:# start series [
 264:# ELEM_MOD
 265:if '$rung_top' {
 266:    let var '$scratch2' := 10
 267:    let var 'Unidade2' := 'CMinu' % '$scratch2'
 268:}
 270:# ] finish series
 271:# 
 272:# ======= START RUNG 12 =======
 273:LabelRung12:
 274:
 275:set bit '$rung_top'
 277:# start series [
 278:# ELEM_OSC
 279:if '$rung_top' {
 280:    if '$once_7_OSC' {
 281:        clear bit '$once_7_OSC'
 282:        clear bit '$rung_top'
 283:    } else {
 284:        set bit '$once_7_OSC'
 285:    }
 286:} else {
 287:    clear bit '$once_7_OSC'
 288:}
 290:# ELEM_CTC
 291:if '$rung_top' {
 292:    clear bit '$rung_top'
 293:    if not '$once_8_CTC_C3' {
 294:        set bit '$once_8_CTC_C3'
 295:        increment 'C3'
 296:        if 'C3' > '3' {
 297:            let var 'C3' := 0
 298:            set bit '$rung_top'
 299:        }
 300:    }
 301:} else {
 302:    clear bit '$once_8_CTC_C3'
 303:}
 305:# ] finish series
 306:# 
 307:# ======= START RUNG 13 =======
 308:LabelRung13:
 309:
 310:set bit '$rung_top'
 312:# start series [
 313:# ELEM_EQU
 314:if '$rung_top' {
 315:    if 'C3' != '0' {
 316:        clear bit '$rung_top'
 317:    }
 318:}
 320:# ELEM_7SEG
 321:if '$rung_top' {
 322:    let var '$scratch' := 176
 323:    if 'Dezena1' == '$scratch' {
 324:        let var 'Dezena1' := 128
 325:    } else {
 326:        if 'Dezena1' < '0' {
 327:            let var 'Dezena1' := 32
 328:        } else {
 329:            if 'Dezena1' < '129' {
 330:            } else {
 331:                let var 'Dezena1' := 32
 332:            }
 333:        }
 334:    }
 335:    let var '$scratch' := 'char7seg[Dezena1]'
 336:    let var '#PORTB' := '$scratch'
 337:}
 339:# ELEM_COIL
 340:let bit 'Yhor1' := '$rung_top'
 342:# ] finish series
 343:# 
 344:# ======= START RUNG 14 =======
 345:LabelRung14:
 346:
 347:set bit '$rung_top'
 349:# start series [
 350:# ELEM_EQU
 351:if '$rung_top' {
 352:    if 'C3' != '1' {
 353:        clear bit '$rung_top'
 354:    }
 355:}
 357:# ELEM_7SEG
 358:if '$rung_top' {
 359:    let var '$scratch' := 176
 360:    if 'Unidade1' == '$scratch' {
 361:        let var 'Unidade1' := 128
 362:    } else {
 363:        if 'Unidade1' < '0' {
 364:            let var 'Unidade1' := 32
 365:        } else {
 366:            if 'Unidade1' < '129' {
 367:            } else {
 368:                let var 'Unidade1' := 32
 369:            }
 370:        }
 371:    }
 372:    let var '$scratch' := 'char7seg[Unidade1]'
 373:    let var '#PORTB' := '$scratch'
 374:}
 376:# ELEM_COIL
 377:let bit 'Yhor2' := '$rung_top'
 379:# ] finish series
 380:# 
 381:# ======= START RUNG 15 =======
 382:LabelRung15:
 383:
 384:set bit '$rung_top'
 386:# start series [
 387:# ELEM_EQU
 388:if '$rung_top' {
 389:    if 'C3' != '2' {
 390:        clear bit '$rung_top'
 391:    }
 392:}
 394:# ELEM_7SEG
 395:if '$rung_top' {
 396:    let var '$scratch' := 176
 397:    if 'Dezena2' == '$scratch' {
 398:        let var 'Dezena2' := 128
 399:    } else {
 400:        if 'Dezena2' < '0' {
 401:            let var 'Dezena2' := 32
 402:        } else {
 403:            if 'Dezena2' < '129' {
 404:            } else {
 405:                let var 'Dezena2' := 32
 406:            }
 407:        }
 408:    }
 409:    let var '$scratch' := 'char7seg[Dezena2]'
 410:    let var '#PORTB' := '$scratch'
 411:}
 413:# ELEM_COIL
 414:let bit 'Ymin1' := '$rung_top'
 416:# ] finish series
 417:# 
 418:# ======= START RUNG 16 =======
 419:LabelRung16:
 420:
 421:set bit '$rung_top'
 423:# start series [
 424:# ELEM_EQU
 425:if '$rung_top' {
 426:    if 'C3' != '3' {
 427:        clear bit '$rung_top'
 428:    }
 429:}
 431:# ELEM_7SEG
 432:if '$rung_top' {
 433:    let var '$scratch' := 176
 434:    if 'Unidade2' == '$scratch' {
 435:        let var 'Unidade2' := 128
 436:    } else {
 437:        if 'Unidade2' < '0' {
 438:            let var 'Unidade2' := 32
 439:        } else {
 440:            if 'Unidade2' < '129' {
 441:            } else {
 442:                let var 'Unidade2' := 32
 443:            }
 444:        }
 445:    }
 446:    let var '$scratch' := 'char7seg[Unidade2]'
 447:    let var '#PORTB' := '$scratch'
 448:}
 450:# ELEM_COIL
 451:let bit 'Ymin2' := '$rung_top'
 453:# ] finish series
 454:LabelRung17:
 455:
 456:# Latest INT_OP here
