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

  1. '**************************************
  2. '
  3. ' C-Control/BASIC       PWM.BAS
  4. '
  5. ' Aufgabe:
  6. '
  7. ' - Steuerung der PWM-AusgΣnge
  8. ' - ⁿber vier Tasten <A, >A, <B, >B
  9. '
  10. '**************************************
  11. ' --- Definitionen --------------------
  12.  
  13. define TasterA1 port[1]
  14. define TasterA2 port[2]
  15. define TasterB1 port[3]
  16. define TasterB2 port[4]
  17. define AusgangA DA[1]
  18. define AusgangB DA[2]
  19. define WertA word
  20. define WertB word
  21.  
  22. ' --- Programmoperationen -------------
  23. WertA = 0
  24. WertB = 0
  25. #Loop
  26.   if (Not TasterA1) then WertA = WertA - 1
  27.   if (Not TasterA2) then WertA = WertA + 1
  28.   if (Not TasterB1) then WertB = WertB - 1
  29.   if (Not TasterB2) then WertB = WertB + 1
  30.   if WertA < 0 then WertA = 0
  31.   if WertA > 255 then WertA = 255
  32.   if WertB < 0 then WertB = 0
  33.   if WertB > 255 then WertB = 255
  34.   AusgangA = WertA
  35.   AusgangB = WertB
  36. goto Loop              'Endlosschleife
  37. end
  38.  
  39.  
  40.  
  41.  
  42.