Hola les dejo un ejemplo de como hacer menues en Mikrobasic, igualmente todo puede ser ampliado y desarrollado a gusto.
Esta es una pequena cuota para esta gran comunida.
program menu1
dim x as short
dim y as short
main:
trisa=1
trisb=0
porta=0
portb=0
x=0
y=0
inizio:
if (porta.0=1) and (porta.1=1) then
gosub proce1
end if
goto inizio
proce1:
x=x-1
y=y-1
while true
if porta.2=1 then
gosub inizio
end if
if porta.1=1 then
while porta.1=1
wend
x=x+1
delay_ms(50)
if x=1 then
portb.7=1
end if
if x=2 then
portb.6=1
end if
if x=3 then
portb.5=1
end if
if x=4 then
portb.4=1
end if
if x=5 then
portb.7=0
portb.6=0
portb.5=0
portb.4=0
x=0
end if
end if
if porta.0=1 then
while porta.0=1
wend
y=y+1
delay_ms(50)
if y=1 then
portb.3=1
end if
if y=2 then
portb.2=1
end if
if y=3 then
portb.1=1
end if
if y=4 then
portb.0=1
end if
if y=5 then
portb.0=0
portb.1=0
portb.2=0
portb.3=0
y=0
end if
end if
wend
return
end.
Esta es una pequena cuota para esta gran comunida.
program menu1
dim x as short
dim y as short
main:
trisa=1
trisb=0
porta=0
portb=0
x=0
y=0
inizio:
if (porta.0=1) and (porta.1=1) then
gosub proce1
end if
goto inizio
proce1:
x=x-1
y=y-1
while true
if porta.2=1 then
gosub inizio
end if
if porta.1=1 then
while porta.1=1
wend
x=x+1
delay_ms(50)
if x=1 then
portb.7=1
end if
if x=2 then
portb.6=1
end if
if x=3 then
portb.5=1
end if
if x=4 then
portb.4=1
end if
if x=5 then
portb.7=0
portb.6=0
portb.5=0
portb.4=0
x=0
end if
end if
if porta.0=1 then
while porta.0=1
wend
y=y+1
delay_ms(50)
if y=1 then
portb.3=1
end if
if y=2 then
portb.2=1
end if
if y=3 then
portb.1=1
end if
if y=4 then
portb.0=1
end if
if y=5 then
portb.0=0
portb.1=0
portb.2=0
portb.3=0
y=0
end if
end if
wend
return
end.