Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CON
- _clkmode = xtal1 + pll16x
- _xinfreq = 5_000_000
- CLS = 16
- CR = 13
- Clock = 2
- Latch = 1
- Serial = 0
- OBJ
- keys: "Keyboard"
- debug: "FullDuplexSerial"
- PUB KeyboardDisplay | Index
- keys.start(26,27)
- 'debug.start(31,30,0,57600)
- dira[Latch] := 1
- dira[Clock] := 1
- dira[Serial] := 1
- waitcnt(clkfreq + cnt)
- 'debug.str(string(CLS, "Type characters on", CR, "the PS/2 keyboard:", CR, CR))
- repeat
- if keys.gotKey
- dirb := keys.getKey
- debug.tx(keys.gotKey)
- repeat Index from 0 to 7
- 'Set the state of LED Serial Pin for this LED to the value stored in its slot of the SwitchState array
- outa[Serial] := dirb[Index]
- 'Pull the LED Clock Pin high then low to write this LED's state into the 595's register
- outa[Clock] := 1
- outa[Clock] := 0
- 'Pull the LED Latch Pin high then low to apply the contents of the 595's register to the 595's output pins (LEDs)
- outa[Latch] := 1
- outa[Latch] := 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement