Advertisement
Guest User

Untitled

a guest
Sep 25th, 2014
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. CON
  2.  
  3. _clkmode = xtal1 + pll16x
  4. _xinfreq = 5_000_000
  5. CLS = 16
  6. CR = 13
  7. Clock = 2
  8. Latch = 1
  9. Serial = 0
  10.  
  11. OBJ
  12.  
  13. keys: "Keyboard"
  14. debug: "FullDuplexSerial"
  15.  
  16. PUB KeyboardDisplay | Index
  17.  
  18. keys.start(26,27)
  19. 'debug.start(31,30,0,57600)
  20. dira[Latch] := 1
  21. dira[Clock] := 1
  22. dira[Serial] := 1
  23.  
  24. waitcnt(clkfreq + cnt)
  25.  
  26. 'debug.str(string(CLS, "Type characters on", CR, "the PS/2 keyboard:", CR, CR))
  27.  
  28. repeat
  29. if keys.gotKey
  30. dirb := keys.getKey
  31. debug.tx(keys.gotKey)
  32.  
  33. repeat Index from 0 to 7
  34. 'Set the state of LED Serial Pin for this LED to the value stored in its slot of the SwitchState array
  35. outa[Serial] := dirb[Index]
  36. 'Pull the LED Clock Pin high then low to write this LED's state into the 595's register
  37. outa[Clock] := 1
  38. outa[Clock] := 0
  39. 'Pull the LED Latch Pin high then low to apply the contents of the 595's register to the 595's output pins (LEDs)
  40. outa[Latch] := 1
  41. outa[Latch] := 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement