Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. ' CheckQtiSubroutine.bs2
  2. ' Displays QTI sensor states. 0 means white surface, 1 means black.
  3.  
  4. ' {$STAMP BS2}
  5. ' {$PBASIC 2.5}
  6.  
  7.  
  8. qtis VAR Nib ' qti black/white states
  9.  
  10. OUTB = %1111 ' Set OUTB bits to 1
  11.  
  12. DEBUG CRSRX, 8, "FMMF", CR, ' Display bit positions
  13. CRSRX, 8, "LLRR", CR
  14.  
  15. DO ' Main DO...LOOP
  16. GOSUB Check_Qtis ' Get QTI states
  17. DEBUG BIN4 ? qtis, CRSRUP ' Display QTI states
  18. PAUSE 100 ' 1/10 s delay
  19. LOOP
  20.  
  21. Check_Qtis:
  22. ' Result -> qtis variable. 0 means white surface, 1 means black
  23. ' surface.
  24.  
  25. DIRB = %1111 ' P7..P4 -> output
  26. PAUSE 0 ' Delay = 230 us
  27. DIRB = %0000 ' P7..P4 -> input
  28. PAUSE 0 ' Delay = 230 us
  29. ' PULSOUT UnusedPin, 0 ' Delays = 208 + (Duration*2) us
  30. qtis = INB ' Store QTI outputs in INB
  31.  
  32. RETURN
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement