option explicit sub main() call delay (1.0) dim display1(0 to 19) as integer dim display2(0 to 19) as integer display1(0)=136 display1(1)=219 display1(2)=162 display1(3)=146 display1(4)=209 display1(5)=148 display1(6)=132 display1(7)=218 display1(8)=128 display1(9)=144 display1(10)=8 display1(11)=91 display1(12)=34 display1(13)=18 display1(14)=81 display1(15)=20 display1(16)=4 display1(17)=90 display1(18)=0 display1(19)=16 display2(0)=136 display2(1)=219 display2(2)=162 display2(3)=146 display2(4)=209 display2(5)=148 display2(6)=132 display2(7)=218 display2(8)=128 display2(9)=144 display2(10)=8 display2(11)=91 display2(12)=34 display2(13)=18 display2(14)=81 display2(15)=20 display2(16)=4 display2(17)=90 display2(18)=0 display2(19)=16 dim bufferout(1 to 50) as byte dim bufferin(1 to 50) as byte dim inputbuffer(1 to 30) as byte dim ouputbuffer(1 to 20) as byte dim programa as integer dim irdata as byte dim unidad as integer dim decena as integer dim unidades as integer dim decenas as integer dim digito as integer call openqueue(bufferout, 100)
call openqueue(bufferin, 100) call definecom3(0, 20, bx0100_1000) call opencom(3, 9600, bufferin, bufferout) call putqueuestr(bufferout, "#3:136 #2:136" & chr(13)) call openqueue(inputbuffer, 30) call openqueue(ouputbuffer, 10) programa=0 unidades=0 decenas=0 unidad=136 decena=136 digito=1 do call delay(0.1) call definecom3(5, 0, bx0000_1000) call opencom(3, 893, inputbuffer, ouputbuffer) call getqueue(inputbuffer, irdata, 1) call definecom3(0, 20, bx0100_1000) call opencom(3, 9600, bufferin, bufferout) if digito=1 then call freqout(14,1000,1000,200) select case irdata case 245 unidad=136 unidades=0 case 209 unidad=219 unidades=1 case 213 unidad=162 unidades=2 case 217 unidad=146 unidades=3 case 221 unidad=209 unidades=4 case 225 unidad=148 unidades=5 case 229 unidad=132 unidades=6 case 233 unidad=218 unidades=7 case 237 unidad=128 unidades=8 case 241 unidad=144 unidades=9 case 249 digito=10 call freqout(14,2000,2000,200) goto marca case else
end select end if if digito=10 then call freqout(14,1000,1000,200) select case irdata case 245 decena=136 decenas=0 case 209 decena=219 decenas=1 case 213 decena=162 decenas=2 case 217 decena=146 decenas=3 case 221 decena=209 decenas=4 case 225 decena=148 decenas=5 case 229 decena=132 decenas=6 case 233 decena=218 decenas=7 case 237 decena=128 decenas=8 case 241 decena=144 decenas=9 case 249 digito=1 call freqout(14,900,900,200) goto marca case else end select end if marca: debug.print cstr(decenas);"";cstr(unidades);" ";cstr(irdata);" ";cstr(digito) call putqueuestr(bufferout, "#3:"&cstr(decena)&"#2:"&cstr(unidad) & chr(13)) if irdata=253 then programa=decenas*10+unidades goto star end if loop star: dim cuentaatras as integer debug.print cstr(programa) call freqout(14,1000,1000,200) call freqout(14,2000,2000,500) for cuentaatras=9 to 0 step -1 call freqout(14,1000,1000,50)
call putqueuestr(bufferout, "#3:"&cstr (display1(cuentaatras))&"#2:"&cstr (display2(cuentaatras))& chr(13)) call delay(0.2) call putqueuestr(bufferout, "#3:255#2:255"& chr(13)) call delay(0.2) next call putqueuestr(bufferout, "#3:"&cstr (display1(decenas+10))&"#2:"&cstr (display2(unidades+10))& chr(13)) debug.print "programa---";cstr(programa) end sub