Advertisement
Guest User

Untitled

a guest
Apr 27th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.91 KB | None | 0 0
  1. ad
  2. movlw b'11000000' ;GIE=ON PEIE=ON
  3. movwf intcon ;Set INTCON register
  4. goto $+3 ;wait for interrupt
  5. movlw b'00000000'
  6. movwf intcon
  7.  
  8.  
  9. movlw d'3' ;mode start value
  10. movwf mode ;move to mode
  11. movlw d'255' ;set highest value in reader
  12. movwf countfrom ;move to countfrom
  13. movlw d'5' ;set number of times to test
  14. movwf countdown ;move to countdown
  15. goto again ;I don't feel i need to comment this
  16. read
  17. movlw d'25' ;set interval between modes
  18. movwf countdown ;move to countdown
  19. movfw mode ;move mode to w
  20. addwf pcl ;add mode to level counter
  21. goto glasread ;mode = 0 test glas
  22. goto plastread ;mode = 1 test plast
  23. goto dåseread ;mode = 2 test dåse
  24.  
  25. again
  26. movfw countfrom ;move countfrom to wreg
  27. subwf adconvalue,0 ;subtract w from adresh, store in w
  28. bz done ;matching value, mode found
  29. decf countfrom ;decrement countfrom
  30. decfsz countdown ;decrement countdown, test 0
  31. goto again ;no, try next value
  32. decf mode ;yes, change mode
  33. goto read
  34.  
  35. dåseread
  36. movlw d'26' ;set start value of countdown
  37. movwf countfrom ;set
  38. goto again ;start reading
  39. glasread
  40. movlw d'150' ;set start value of countdown
  41. movwf countfrom ;Set
  42. goto again ;start reading
  43. plastread
  44. movlw d'250' ;set start value of countdown
  45. movwf countfrom ;set
  46. goto again ;start reading
  47.  
  48.  
  49. done
  50. movfw mode ;read mode
  51. addwf pcl ;add to level counter
  52. goto glas ;glass detected goto glas
  53. goto plastik ;plastic detected goto plastik
  54. goto dåse ;can detected goto dåse
  55. goto ad ;nothing detected goto a/d converter
  56.  
  57.  
  58.  
  59. plastik
  60. call timer ;wait
  61. goto start ;restart
  62. dåse
  63. call stepmotor ;move steppermotor
  64. call timer ;wait
  65. goto start ;restart
  66. glas
  67. call pneu2 ;move pneumatic actuator
  68. goto start ;restart
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement