Make your own free website on Tripod.com

Flying Machette


Home
Schedule
Directions

aim.jpg

Dhoopy ito ung program... kpag may error i-txt u na lng c ate...

<start>

 

Define lcd-bits = 8

define lcd_dreg = portb

define lcd_dbit = 0

define lcd_rsreg = portd

define lcd_rsbit = 5

define lcd_ereg = portd

define lcd_ebit = 7

define lcd_rwreg = portd

define lcd_rwbit =6

lcdinit

dim mode as byte

dim a as byte

dim temp as byte

dim ctr as byte

dim lmt as byte

 

goto introduction

ghq:

  gosub msg_selection

  accepting:

    if rc6 then goto sure

end

introduction:

  lcdcmdout lcdclear

  lcdcmdout lcdline1pos(1)

  lcdout "MCU Integrated"

  lcdcmdout lcdline2pos(1)

  lcdout "Digital Trainer"

  goto if_press

end

if_press:

  if portc < E0h then

    if portc > 00h then

      goto ghq

    endif

  else

    goto if_press

  endif

end

gen_item:

  if mode<5 then

    goto selecting_skt

  else

   if mode<12 then

     if mode >4 then

       goto selecting_gate

     endif

   else

     if mode < 16 then

       if mode>11 then

         goto selecting_io

       endif

     endif

   endif

  endif

end

selecting_skt:

  if rc5 then

    mode = mode + 1

    if lmt > 5 then mode = 0

    gosub check

    gosub verify

    goto accepting

  else

   if not rc5 then goto selecting_skt

  endif

end

selecting_gate:

  if rc5 then

    mode = mode + 1

     if lmt > 12 then mode = 5

     gosub verify

     goto accepting

   else

    if not rc5 then goto selecting_gate

 endif

end

selecting_io:

  if rc5 then

    mode = mode + 1

    if lmt > 16 then mode = 12

    gosub verify

    goto accepting

  else

   if not rc5 then goto selecting_io

 endif

end

sure:

  gosub msg_sure

  confirmation:

    if rc6 then

      goto accepted

    else

      if rc7 then

        goto accepting

      else

        goto confirmation

      endif

    endif

end

verify:

 lcdcmdout lcdclear

 lcdcmdout lcdline2pos(1)

 if mode = 0 then lcdout "Socket 1"

 if mode = 1 then lcdout "Socket 2"

 if mode = 2 then lcdout "Socket 3"

 if mode = 3 then lcdout "Socket 4"

 if mode = 4 then lcdout "Socket 5"

 if mode = 5 then lcdout "Inverter"

 if mode = 6 then lcdout "OR-gate"

 if mode = 7 then lcdout "AND-gate"

 if mode = 8 then lcdout "NOR-gate"

 if mode = 9 then lcdout "NAND-gate"

 if mode = 10 then lcdout "XOR-gate"

 if mode = 11 then lcdout "XNOR-gate"

 if mode = 12 then lcdout "2-input"

 if mode = 13 then lcdout "3-input"

 if mode = 14 then lcdout "4-input"

 if mode = 15 then lcdout "5-input"

return

msg_selection:

  lcdcmdout lcdclear

  lcdcmdout lcdline1pos(1)

  gosub msg_name

  lcdcmdout lcdline2pos(1)

  gosub verify

  lcdcmdout lcdline2pos(21)

  lcdout "RESET"

  lcdcmdout lcdline2pos(28)

  lcdout "ACCEPT"

  lcdcmdout lcdline2pos(35)

  lcdout "CHOOSE"

return

msg_name:

  if name = 0 then lcdout "Select IC Socket:"

  if name = 1 then lcdout "Select Logic Gate:"

  if name = 2 then lcdout "Select Input:"

return

msg_sure:

  lcdcmdout lcdclear

  lcdcmdout lcdline1pos(1)

  lcdout "Are you sure?"

  lcdcmdout lcdline2pos(21)

  lcdout "NO!"

  lcdcmdout lcdline2pos(28)

  lcdout "YES!"

end

msg_accepted:

  lcdcmdout lcdline1pos(1)

  gosub verify

  lcdcmdout lcdline2pos(1)

  lcdout "ACCEPTED!"

return

xfer_data:

  if item(0) = 0 then porta = 01h

  if item(0) = 1 then porta = 02h

  if item(0) = 2 then porta = 03h

  if item(0) = 3 then porta = 04h

  if item(0) = 4 then porta = 05h

  if item(1) = 5 then porte = 01h

  if item(1) = 6 then porte = 02h

  if item(1) = 7 then porte = 03h

  if item(1) = 8 then porte = 04h

  if item(1) = 9 then porte = 05h

  if item(1) = 10 then porte = 06h

  if item(1) = 11 then porte = 07h

  if item(2) = 12 then portc = 00h

  if item(2) = 13 then portc = 01h

  if item(2) = 14 then portc = 02h

  if item(2) = 15 then portc = 03h

  gosub msg_xferred

  goto program_again

end

msg_xfer:

  lcdcmdout lcdclear

  lcdcmdout lcdline2pos(1)

  lcdout "Data Transferring..."

return

msg_xferred:

  lcdcmdout lcdclear

  lcdcmdout lcdline2pos(1)

  lcdout "TRANSFERRED!"

return

next_item:

  if mode<5 then

    mode = 5

    goto ghq

  else

    if mode<12 then

      if mode > 4 then

        mode = 12

        goto ghq

      endif

    else

      if mode < 16 then

        if mode > 11 then

          mode = temp(a-1)+1

          gosub msg_xfer

          goto xfer_data

        endif

      endif

    endif

  endif

end

check:

  if temp(a) = mode then

    mode = mode + 1

  else

    a = mode

  endif

return

accepted:

  gosub msg_accepted

  item(n) = mode

  n = n + 1

  if mode < 5 then

    temp(a) = mode

    a = a+1

  else

    if mode < 16 then

      if mode > 11 then

        gosub msg_xfer

        goto xfer_data

      endif

    endif

  endif

  if mode = 5 then

    gosub msg_xfer

    goto xfer_data

  endif

  goto Next_item

end

 

Please get in touch if you have any comments or suggestions.