iamsaruman
New Member
on flowcharts a box saying gosub sub3 is running sub1 any ideas why? here is the converted code
symbol LED0 = 0
symbol LED1 = 1
symbol LED2 = 2
symbol LED3 = 3
symbol LED4 = 4
symbol LED5 = 5
symbol LED6 = 6
symbol LED7 = 7
symbol switch1 = pin0
symbol switch2 = pin1
symbol switch3 = pin2
symbol switch4 = pin6
symbol reset = pin7
main:
label_20: if switch1=1 then label_2B
if switch2=1 then label_4B
if switch3=1 then label_54
if switch4=1 then label_1CD
goto label_20
label_2B: gosub sub0
goto label_20
label_4B: gosub sub1
goto label_20
label_54: gosub sub2
goto label_20
label_1CD: gosub sub3
goto label_20
sub0:
label_61: let pins = 85 ' %01010101
let pins = 170 ' %10101010
let pins = 0 ' %00000000
if reset=1 then label_81
goto label_61
label_81: return
sub1:
label_F2: let pins = 0 ' %00000000
let pins = 2 ' %00000010
let pins = 4 ' %00000100
let pins = 16 ' %00010000
let pins = 32 ' %00100000
let pins = 64 ' %01000000
let pins = 128 ' %10000000
let pins = 64 ' %01000000
let pins = 32 ' %00100000
let pins = 16 ' %00010000
let pins = 8 ' %00001000
let pins = 4 ' %00000100
let pins = 2 ' %00000010
let pins = 1 ' %00000001
if reset=1 then label_87
goto label_F2
label_87: return
sub2:
label_104: let pins = 129 ' %10000001
let pins = 66 ' %01000010
let pins = 36 ' %00100100
let pins = 24 ' %00011000
let pins = 36 ' %00100100
let pins = 66 ' %01000010
let pins = 129 ' %10000001
if reset=1 then label_140
goto label_104
label_140: return
sub3:
label_153: let pins = 128 ' %10000000
let pins = 64 ' %01000000
let pins = 160 ' %10100000
let pins = 80 ' %01010000
let pins = 168 ' %10101000
let pins = 84 ' %01010100
let pins = 170 ' %10101010
let pins = 85 ' %01010101
let pins = 42 ' %00101010
let pins = 21 ' %00010101
let pins = 10 ' %00001010
let pins = 5 ' %00000101
let pins = 2 ' %00000010
let pins = 0 ' %00000000
if reset=1 then label_1D9
goto label_153
label_1D9: return
symbol LED0 = 0
symbol LED1 = 1
symbol LED2 = 2
symbol LED3 = 3
symbol LED4 = 4
symbol LED5 = 5
symbol LED6 = 6
symbol LED7 = 7
symbol switch1 = pin0
symbol switch2 = pin1
symbol switch3 = pin2
symbol switch4 = pin6
symbol reset = pin7
main:
label_20: if switch1=1 then label_2B
if switch2=1 then label_4B
if switch3=1 then label_54
if switch4=1 then label_1CD
goto label_20
label_2B: gosub sub0
goto label_20
label_4B: gosub sub1
goto label_20
label_54: gosub sub2
goto label_20
label_1CD: gosub sub3
goto label_20
sub0:
label_61: let pins = 85 ' %01010101
let pins = 170 ' %10101010
let pins = 0 ' %00000000
if reset=1 then label_81
goto label_61
label_81: return
sub1:
label_F2: let pins = 0 ' %00000000
let pins = 2 ' %00000010
let pins = 4 ' %00000100
let pins = 16 ' %00010000
let pins = 32 ' %00100000
let pins = 64 ' %01000000
let pins = 128 ' %10000000
let pins = 64 ' %01000000
let pins = 32 ' %00100000
let pins = 16 ' %00010000
let pins = 8 ' %00001000
let pins = 4 ' %00000100
let pins = 2 ' %00000010
let pins = 1 ' %00000001
if reset=1 then label_87
goto label_F2
label_87: return
sub2:
label_104: let pins = 129 ' %10000001
let pins = 66 ' %01000010
let pins = 36 ' %00100100
let pins = 24 ' %00011000
let pins = 36 ' %00100100
let pins = 66 ' %01000010
let pins = 129 ' %10000001
if reset=1 then label_140
goto label_104
label_140: return
sub3:
label_153: let pins = 128 ' %10000000
let pins = 64 ' %01000000
let pins = 160 ' %10100000
let pins = 80 ' %01010000
let pins = 168 ' %10101000
let pins = 84 ' %01010100
let pins = 170 ' %10101010
let pins = 85 ' %01010101
let pins = 42 ' %00101010
let pins = 21 ' %00010101
let pins = 10 ' %00001010
let pins = 5 ' %00000101
let pins = 2 ' %00000010
let pins = 0 ' %00000000
if reset=1 then label_1D9
goto label_153
label_1D9: return