Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- ROM Reader (eventually will include a write routine)
- Ver 0.0.4
- 06/11/2010
- Forest Kunecke AKA Vaati
- version 0.0.4 - swtitched to using the FDS object instead of serial_terminal.spin
- version 0.0.3 - swtitched to having it actually communicate with the pc instead of displaying on a tv. Takes 26 seconds to read a 65535 byte rom
- version 0.0.2 - fixed a major error which caused it to read the rom as empty all the time.
- }
- con
- _clkmode = xtal1 + pll16x
- _xinfreq = 5_000_000
- OE = 25
- CS = 24
- var
- long addr
- byte data
- obj
- 'tv: "Debug_1pinTV"
- ptx: "jm_txserial"
- 'uart: "FullDuplexSerial"
- pub start | i
- 'OE = output enable on ROM
- 'CS = chip select on ROM
- addr:=%0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0 'set address as first address in memory
- dira[OE]~~ 'make OE an output
- dira[CS]~~ 'make CS an output
- dira[0..15]~~ 'make P0 thru P15 outputs
- dira[16..23]~ 'make P16 thru P23 inputs
- 'uart.start(31,30,0,115200)
- ptx.init(30,115200)
- repeat i from 0 to 65535 'change the end value to however many memory addresses your rom has
- outa[OE]~ 'make OE low
- outa[CS]~ 'make CS low
- outa[0..15] := addr 'write address
- 'Pause(5)
- waitcnt((clkfreq/1000000)*5 + cnt)
- data := ina[16..23] 'read data from rom
- outa[OE]~~ 'make OE high
- outa[CS]~~ 'make CS high
- 'uart.hex(data,2)
- ptx.hex(data,2)
- addr++ 'increment address
- 'Pause(5)
- waitcnt((clkfreq/1000000)*5 + cnt)
- {PRI Pause(us)
- ''Calculates the pause rate in microseconds
- waitcnt((clkfreq/1000000)*us + cnt)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement