home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 April / CHIP4_98.ISO / software / ccconrad / basic.exe / CHIP / Programme.Bas / Beispiele_2 / TASTEN2.BAS < prev    next >
Encoding:
BASIC Source File  |  1997-05-24  |  1.1 KB  |  56 lines

  1. '**************************************
  2. '
  3. ' C-Control/BASIC       TASTEN2.BAS
  4. '
  5. ' Aufgabe:
  6. '
  7. ' - Tastatureingabe mit 4 x 4 Matrix
  8. ' - Senden des Ergebnisses an den PC
  9. '
  10. '**************************************
  11. ' --- Definitionen --------------------
  12.  
  13. define Eingang byteport [2]
  14. define R1 port [13]
  15. define R2 port [14]
  16. define R3 port [15]
  17. define R4 port [16]
  18. define Eingabe Word
  19. define Taste byte
  20. define Alt byte
  21. define N byte
  22. ' --- Programmoperationen -------------
  23.  
  24. Alt = 0
  25. #Loop
  26.   R1 = OFF
  27.   Eingabe = NOT Eingang
  28.   for N = 0 to 3
  29.    if((Eingabe shr N) AND 1)=1 then Taste=n+1
  30.   next
  31.   R1 = ON:   R2 = OFF
  32.   Eingabe = NOT Eingang
  33.   for N = 0 to 3
  34.    if((Eingabe shr N) AND 1)=1 then Taste=n+5
  35.   next
  36.   R2 = ON: R3 = OFF
  37.   Eingabe = NOT Eingang
  38.   for N = 0 to 3
  39.    if((Eingabe shr N) AND 1)=1 then Taste=n+9
  40.   next
  41.   R3 = ON: R4 = OFF
  42.   Eingabe = NOT Eingang
  43.   for N = 0 to 3
  44.    if((Eingabe shr N) AND 1)=1 then Taste=n+13
  45.   next
  46.   R4 = ON:
  47.   if Taste = ALT then goto Loop
  48.   Alt = Taste
  49.   print Taste
  50. goto Loop              'Endlosschleife
  51.  
  52.  
  53.  
  54.  
  55.  
  56.