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

  1. '**************************************
  2. '
  3. ' C-Control/BASIC       WUERFEL1.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 Wuerfelzahl byte
  23. define Eins &B00001000
  24. define Zwei &B00100010
  25. define Drei &B00101010
  26. define Vier &B01010101
  27. define Fuenf &B01011101
  28. define Sechs &B01110111
  29.  
  30. '---- Programmanweisungen -------------
  31.  
  32. #loop1
  33. #loop2
  34. if Starttaste = ON then goto loop2
  35. Zufall = Zufall + 1
  36. Wuerfelzahl = Zufall mod 6 + 1
  37. if Wuerfelzahl = 1 then Ausgabe = Eins
  38. if Wuerfelzahl = 2 then Ausgabe = Zwei
  39. if Wuerfelzahl = 3 then Ausgabe = Drei
  40. if Wuerfelzahl = 4 then Ausgabe = Vier
  41. if Wuerfelzahl = 5 then Ausgabe = Fuenf
  42. if Wuerfelzahl = 6 then Ausgabe = Sechs
  43. goto loop1
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.