Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Con
- _clkmode = xtal1 + pll16x
- _xinfreq = 5_000_000
- Obj
- pst : "Parallax Serial Terminal"
- Var
- long State[9]
- Pub Main | Index
- Init
- repeat
- waitpeq(%100000000, %100000000, 0) 'wait until pin 1 is HIGH
- pst.Str(String("States: ")) 'write "States:" in terminal
- dirb := 0 'clear out Register B
- repeat Index from 0 to 7
- State[Index] := ina[Index] 'read in which LEDs are exposed according to paper tape
- pst.Dec(State[Index]) 'Send that information to the terminal as 1's and 0's
- pst.Str(String(", ")) 'Send comma and space
- dirb[Index] := State[Index] 'Sent that information to Register B
- pst.Char(dirb[0..7]) 'Send ASCII equivalent to terminal
- pst.Char(13) 'Go to next line
- waitpeq(%000000000, %100000000, 0) 'wait until pin 1 is LOW
- waitcnt((clkfreq / 1000) + cnt) 'debounce 1 ms
- Pub Init
- dira[0..8] := %000000000 'set pins 0 to 8 as inputs
- pst.Start(115_200) 'start up the terminal
- waitcnt((clkfreq / 100) + cnt) 'wait 10ms
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement