Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #rem
  2. 4th Form Display Project 2010
  3.         Theme: NASA
  4.         Programmer: Manav *****
  5.         Other team members: ****** ** (Electronics), ******* ********** (Design), *** ********* (Design)
  6.  
  7. ============================================================================
  8. USER PIN CONNECTIONS
  9. ============================================================================
  10.         PIN 0   (output)        LEDs
  11.         PIN 1   (output)        LEDs
  12.         PIN 2   (output)        LEDs
  13.         PIN 3   (input)     Push Switch
  14.         PIN 4 (output)      Motor
  15.  
  16. ============================================================================
  17. ALGORITHM
  18. ============================================================================
  19. Switch on
  20. Press button
  21. Play light sequence
  22. Run motor for 6 seconds
  23. Play light sequence
  24. End
  25.  
  26. #endrem
  27. '============================================================================
  28. 'SET UP INPUTS AND OUTPUTS
  29. '============================================================================
  30. init:
  31.         let dirs = %00010111        'sets pins 0,1,2,4 as oututs & pin 3 as an input
  32.    
  33.                                                      
  34. '============================================================================
  35. 'MAIN PROGRAM ROUTINE
  36. '============================================================================
  37. attractLEDs:
  38.         high 0,1,2
  39.         pause 150
  40.         low 0,1,2
  41.         if pin3 = 1 then goto start
  42.         pause 150
  43.         goto attractLEDs
  44.  
  45. start: 
  46.         if pin3 = 1 then goto main
  47.         goto start
  48.    
  49. main:
  50.         if pin3 = 1 then goto LEDs
  51.         goto start
  52.        
  53.        
  54. '============================================================================
  55. 'SUBROUTINES
  56. '============================================================================  
  57. LEDs:
  58.         pause 1000
  59.         for b1 = 1 to 3
  60.         high 0
  61.         pause 100
  62.         low 0
  63.         high 1
  64.         pause 100
  65.         low 1
  66.         high 2
  67.         pause 100
  68.         low 2
  69.         next b1
  70.         pause 1000
  71.         goto LEDs2
  72.        
  73. LEDs2:
  74.         for b3 = 1 to 3
  75.         high 0,1,2
  76.         pause 200
  77.         low 0,1,2
  78.         pause 200
  79.         next b3
  80.         pause 1000
  81.         goto motor
  82.  
  83. motor:
  84.         let b0 = 60
  85.         high 0,1,2
  86.         pwm 4, 100, 2
  87.         pwm 4, b0, 1000
  88.         pwm 4, b0, 1000
  89.         pwm 4, b0, 1000
  90.         pwm 4, b0, 1000
  91.         pwm 4, b0, 1000
  92.         pwm 4, b0, 1000
  93.         low 0,1,2
  94.         goto LEDs3
  95.        
  96. LEDs3:
  97.         for b5 = 1 to 3
  98.         high 0
  99.         pause 300
  100.         low 0
  101.         high 1
  102.         pause 300
  103.         low 1
  104.         high 2
  105.         pause 300
  106.         low 2
  107.         next b5
  108.         pause 1000
  109.         goto LEDs4
  110.  
  111. LEDs4:
  112.         for b7 = 1 to 5
  113.         high 0,1,2
  114.         pause 100
  115.         low 0,1,2
  116.         pause 100
  117.         next b7
  118.         pause 2000
  119.         goto attractLEDs
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement