Advertisement
Guest User

Untitled

a guest
Jul 26th, 2015
672
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. Con
  2.  
  3. _clkmode = xtal1 + pll16x
  4. _xinfreq = 5_000_000
  5.  
  6. Obj
  7.  
  8. pst : "Parallax Serial Terminal"
  9.  
  10. Var
  11.  
  12. long State[9]
  13.  
  14. Pub Main | Index
  15.  
  16. Init
  17. repeat
  18. waitpeq(%100000000, %100000000, 0) 'wait until pin 1 is HIGH
  19. pst.Str(String("States: ")) 'write "States:" in terminal
  20. dirb := 0 'clear out Register B
  21. repeat Index from 0 to 7
  22. State[Index] := ina[Index] 'read in which LEDs are exposed according to paper tape
  23. pst.Dec(State[Index]) 'Send that information to the terminal as 1's and 0's
  24. pst.Str(String(", ")) 'Send comma and space
  25. dirb[Index] := State[Index] 'Sent that information to Register B
  26. pst.Char(dirb[0..7]) 'Send ASCII equivalent to terminal
  27. pst.Char(13) 'Go to next line
  28. waitpeq(%000000000, %100000000, 0) 'wait until pin 1 is LOW
  29. waitcnt((clkfreq / 1000) + cnt) 'debounce 1 ms
  30.  
  31. Pub Init
  32.  
  33. dira[0..8] := %000000000 'set pins 0 to 8 as inputs
  34. pst.Start(115_200) 'start up the terminal
  35. waitcnt((clkfreq / 100) + cnt) 'wait 10ms
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement