Advertisement
Atdiy

Wireless Accelerometer Rev 0.01

Aug 14th, 2012
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. OBJ
  2.  
  3. pst : "FullDuplexSerial"
  4. MM2125 : "Memsic2125"
  5. XB : "FullDuplexSerial"
  6. CON
  7.  
  8. _clkmode = xtal1 + pll16x
  9. _xinfreq = 5_000_000
  10.  
  11. xIn = 0
  12. yIn = 1
  13. XB_Rx = 6 ' XBee DOUT
  14. XB_Tx = 7 ' XBee DIN
  15. XB_Baud = 9600
  16. CR = 13 ' Carriage Return value
  17.  
  18. PUB Go | x,y
  19. XB.start(XB_Rx, XB_Tx, 0, XB_Baud) ' Initialize comms for XBee
  20.  
  21. MM2125.start(xIn, yIn) ' Initialize Memsic 2125
  22.  
  23. repeat
  24. x := MM2125.Mx ' Read X axis
  25. y := MM2125.My ' Read Y axis
  26.  
  27. XB.dec(x / 100) ' Display X axis, divided by 100
  28. XB.tx(9) ' Tab
  29. XB.dec(y / 100) ' Display Y axis, divided by 100
  30. XB.tx(13) ' New line
  31. WaitCnt(ClkFreq / 2 + Cnt)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement