Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ad
- movlw b'11000000' ;GIE=ON PEIE=ON
- movwf intcon ;Set INTCON register
- goto $+3 ;wait for interrupt
- movlw b'00000000'
- movwf intcon
- movlw d'3' ;mode start value
- movwf mode ;move to mode
- movlw d'255' ;set highest value in reader
- movwf countfrom ;move to countfrom
- movlw d'5' ;set number of times to test
- movwf countdown ;move to countdown
- goto again ;I don't feel i need to comment this
- read
- movlw d'25' ;set interval between modes
- movwf countdown ;move to countdown
- movfw mode ;move mode to w
- addwf pcl ;add mode to level counter
- goto glasread ;mode = 0 test glas
- goto plastread ;mode = 1 test plast
- goto dåseread ;mode = 2 test dåse
- again
- movfw countfrom ;move countfrom to wreg
- subwf adconvalue,0 ;subtract w from adresh, store in w
- bz done ;matching value, mode found
- decf countfrom ;decrement countfrom
- decfsz countdown ;decrement countdown, test 0
- goto again ;no, try next value
- decf mode ;yes, change mode
- goto read
- dåseread
- movlw d'26' ;set start value of countdown
- movwf countfrom ;set
- goto again ;start reading
- glasread
- movlw d'150' ;set start value of countdown
- movwf countfrom ;Set
- goto again ;start reading
- plastread
- movlw d'250' ;set start value of countdown
- movwf countfrom ;set
- goto again ;start reading
- done
- movfw mode ;read mode
- addwf pcl ;add to level counter
- goto glas ;glass detected goto glas
- goto plastik ;plastic detected goto plastik
- goto dåse ;can detected goto dåse
- goto ad ;nothing detected goto a/d converter
- plastik
- call timer ;wait
- goto start ;restart
- dåse
- call stepmotor ;move steppermotor
- call timer ;wait
- goto start ;restart
- glas
- call pneu2 ;move pneumatic actuator
- goto start ;restart
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement