home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 April / CHIP4_98.ISO / software / ccconrad / basic.exe / CHIP / Programme.Bas / Beispiele_2 / WUERFEL3.BAS < prev    next >
Encoding:
BASIC Source File  |  1997-06-04  |  958 b   |  56 lines

  1. '**************************************
  2. '
  3. ' C-Control/BASIC       WUERFEL.BAS
  4. '
  5. ' Aufgabe: Wuerfelsteuerung mit 7 LEDs:
  6. '
  7. '          D1          D5
  8. '
  9. '          D2    D4    D6
  10. '
  11. '          D3          D7
  12. '
  13. '  Starttaste = D9
  14. '
  15. '**************************************
  16.  
  17. ' --- Dekarationen --------------------
  18.  
  19. define Ausgabe Byteport[1]
  20. define Starttaste port [9]
  21. define Zufall word
  22. define Zahl byte
  23.  
  24. '---- Programmanweisungen -------------
  25. randomize timer
  26. #loop1
  27. #loop2
  28. wait 2  'Entprellung
  29. if Starttaste = ON then goto loop2
  30. Ausgabe = OFF
  31. wait 2  'Entprellung
  32. #loop3
  33. wait 2  'Entprellung
  34. if Starttaste = OFF then goto loop3
  35. Zufall = rand
  36. print Zufall
  37. Zufall = ABS (Zufall)
  38. Zufall = Zufall mod 371
  39. print Zufall
  40. Zahl = Zufall mod 6
  41. print Zahl
  42. ' Tabelle 0...5
  43. looktab Bitmuster, Zahl, Ausgabe
  44. goto loop1
  45. end
  46.  
  47. table Bitmuster
  48. &B00001000  &B00100010
  49. &B00101010  &B01010101
  50. &B01011101  &B01110111
  51. tabend
  52.  
  53.  
  54.  
  55.  
  56.