   0:# INIT_TABLES
   1:# 
   2:# ======= START RUNG 1 =======
   3:set bit '$rung_top'
   5:# start series [
   6:# ELEM_MOVE
   7:if '$rung_top' {
   8:    let var 'C1' := -2
   9:}
  11:# ] finish series
  12:# 
  13:# ======= START RUNG 2 =======
  14:set bit '$rung_top'
  16:# start series [
  17:# ELEM_CONTACTS
  18:if not 'R1' {
  19:    clear bit '$rung_top'
  20:}
  22:# ELEM_FORMATTED_STRING
  23:if '$rung_top' {
  24:    if not '$oneShot_0000_FMTD_STR_' {
  25:        set bit '$oneShot_0000_FMTD_STR_'
  26:        let var '$fmtdStr_0000_seq' := 0
  27:        set bit '$fmtdStr_0003_doSend'
  28:    }
  29:} else {
  30:    clear bit '$oneShot_0000_FMTD_STR_'
  31:}
  32:let var '$seqScratch' := '$fmtdStr_0000_seq'
  33:if '$fmtdStr_0000_seq' < 12 {
  34:} else {
  35:    let var '$seqScratch' := -1
  36:}
  37:if '$fmtdStr_0003_doSend' {
  38:    '$scratch' = is uart busy to send ?
  39:    if '$scratch' {
  40:        let var '$seqScratch' := -1
  41:    }
  42:}
  43:let var '$scratch' := 0
  44:if '$scratch' == '$seqScratch' {
  45:    let var '$charToUart' := 118
  46:}
  47:let var '$scratch' := 1
  48:if '$scratch' == '$seqScratch' {
  49:    let var '$charToUart' := 97
  50:}
  51:let var '$scratch' := 2
  52:if '$scratch' == '$seqScratch' {
  53:    let var '$charToUart' := 108
  54:}
  55:let var '$scratch' := 3
  56:if '$scratch' == '$seqScratch' {
  57:    let var '$charToUart' := 117
  58:}
  59:let var '$scratch' := 4
  60:if '$scratch' == '$seqScratch' {
  61:    let var '$charToUart' := 101
  62:}
  63:let var '$scratch' := 5
  64:if '$scratch' == '$seqScratch' {
  65:    let var '$charToUart' := 58
  66:}
  67:let var '$scratch' := 6
  68:if '$scratch' == '$seqScratch' {
  69:    let var '$charToUart' := 32
  70:}
  71:let var '$scratch' := 7
  72:clear bit '$scratch'
  73:if '$scratch' == '$seqScratch' {
  74:    set bit '$scratch'
  75:}
  76:if '$scratch' {
  77:    if 'C1' < 0 {
  78:        let var '$fmtdStr_0001_convertState' := 0
  79:        let var '$fmtdStr_0001_convertState' := '$fmtdStr_0001_convertState' - 'C1'
  80:    } else {
  81:        let var '$fmtdStr_0001_convertState' := 'C1'
  82:    }
  83:    set bit '$fmtdStr_0002_isLeadingZero'
  84:    let var '$scratch' := 100
  85:    let var '$charToUart' := '$fmtdStr_0001_convertState' / '$scratch'
  86:    let var '$scratch' := '$scratch' * '$charToUart'
  87:    let var '$fmtdStr_0001_convertState' := '$fmtdStr_0001_convertState' - '$scratch'
  88:    let var '$scratch' := 48
  89:    let var '$charToUart' := '$charToUart' + '$scratch'
  90:    if '$scratch' == '$charToUart' {
  91:        if '$fmtdStr_0002_isLeadingZero' {
  92:            let var '$charToUart' := 32
  93:        }
  94:    } else {
  95:        clear bit '$fmtdStr_0002_isLeadingZero'
  96:    }
  97:}
  98:let var '$scratch' := 8
  99:clear bit '$scratch'
 100:if '$scratch' == '$seqScratch' {
 101:    set bit '$scratch'
 102:}
 103:if '$scratch' {
 104:    let var '$scratch' := 10
 105:    let var '$charToUart' := '$fmtdStr_0001_convertState' / '$scratch'
 106:    let var '$scratch' := '$scratch' * '$charToUart'
 107:    let var '$fmtdStr_0001_convertState' := '$fmtdStr_0001_convertState' - '$scratch'
 108:    let var '$scratch' := 48
 109:    let var '$charToUart' := '$charToUart' + '$scratch'
 110:    if '$scratch' == '$charToUart' {
 111:        if '$fmtdStr_0002_isLeadingZero' {
 112:            let var '$charToUart' := 32
 113:        }
 114:    } else {
 115:        clear bit '$fmtdStr_0002_isLeadingZero'
 116:    }
 117:}
 118:let var '$scratch' := 9
 119:clear bit '$scratch'
 120:if '$scratch' == '$seqScratch' {
 121:    set bit '$scratch'
 122:}
 123:if '$scratch' {
 124:    let var '$scratch' := 1
 125:    let var '$charToUart' := '$fmtdStr_0001_convertState' / '$scratch'
 126:    let var '$scratch' := '$scratch' * '$charToUart'
 127:    let var '$fmtdStr_0001_convertState' := '$fmtdStr_0001_convertState' - '$scratch'
 128:    let var '$scratch' := 48
 129:    let var '$charToUart' := '$charToUart' + '$scratch'
 130:}
 131:let var '$scratch' := 10
 132:if '$scratch' == '$seqScratch' {
 133:    let var '$charToUart' := 13
 134:}
 135:let var '$scratch' := 11
 136:if '$scratch' == '$seqScratch' {
 137:    let var '$charToUart' := 10
 138:}
 139:if '$seqScratch' < 0 {
 140:} else {
 141:    if '$fmtdStr_0003_doSend' {
 142:        set bit '$scratch'
 143:        uart send from '$charToUart', done? into '$scratch'
 144:        increment '$fmtdStr_0000_seq'
 145:    }
 146:}
 147:clear bit '$rung_top'
 148:if '$fmtdStr_0000_seq' < 12 {
 149:    if '$fmtdStr_0003_doSend' {
 150:        set bit '$rung_top'
 151:    }
 152:} else {
 153:    clear bit '$fmtdStr_0003_doSend'
 154:}
 156:# ] finish series
 157:# 
 158:# ======= START RUNG 3 =======
 159:set bit '$rung_top'
 161:# start series [
 162:# ELEM_RTO
 163:if 'T1' < 100 {
 164:    if '$rung_top' {
 165:        increment 'T1'
 166:        clear bit '$rung_top'
 167:    }
 168:} else {
 169:    set bit '$rung_top'
 170:}
 172:# start parallel [
 173:let bit '$parThis_0000' := '$rung_top'
 174:# ELEM_COIL
 175:let bit 'R1' := '$parThis_0000'
 177:# ELEM_RES
 178:if '$rung_top' {
 179:    let var 'T1' := 0
 180:}
 182:# ] finish parallel
 183:# ] finish series
