Figure 1: Interfacing 6502/MKHBC-8-R1 buffered I/O bus to multiplexed bus type chip DS1685. Signal IO4 is an active low chip select signal from my I/O address decoder.
Glue logic can be done with just one 74LS00. My messy board uses extra inverter from 74LS04 because one 7400 gate is already taken by LCD interface on the same bread board (inverting of /CS signal, LCD has E-pin active HI).
With above solution, accessing registers of the RTC is done in two steps:
1) Sending register address (8-bit value) to I/O 4 port (odd address bytes).
2) Sending or reading data to/from I/O 4 port (even address bytes).
Example:
IOBase = $c000
IO4 = IOBase+4*256
DSCALADDR = IO4+1
DSCALDATA = IO4
IO4 = IOBase+4*256
DSCALADDR = IO4+1
DSCALDATA = IO4
;-------------------------------------------------------------------------------
; Write DS1685 address (Acc).
;-------------------------------------------------------------------------------
WrRTCAddr:
sta DSCALADDR
rts
;-------------------------------------------------------------------------------
; Write DS1685 data (Acc).
;-------------------------------------------------------------------------------
WrRTCData:
sta DSCALDATA
rts
;-------------------------------------------------------------------------------
; Read DS1685 data (-> Acc).
;-------------------------------------------------------------------------------
RdRTCData:
lda DSCALDATA
rts
;-------------------------------------------------------------------------------
; Write DS1685 Acc = Addr, X = Data
;-------------------------------------------------------------------------------
WrRTC:
jsr WrRTCAddr
txa
jsr WrRTCData
rts
;-------------------------------------------------------------------------------
; Read DS1685 Acc = Addr -> A = Data
;-------------------------------------------------------------------------------
RdRTC:
jsr WrRTCAddr
jsr RdRTCData
rts
Some pictures of prototype:; Write DS1685 address (Acc).
;-------------------------------------------------------------------------------
WrRTCAddr:
sta DSCALADDR
rts
;-------------------------------------------------------------------------------
; Write DS1685 data (Acc).
;-------------------------------------------------------------------------------
WrRTCData:
sta DSCALDATA
rts
;-------------------------------------------------------------------------------
; Read DS1685 data (-> Acc).
;-------------------------------------------------------------------------------
RdRTCData:
lda DSCALDATA
rts
;-------------------------------------------------------------------------------
; Write DS1685 Acc = Addr, X = Data
;-------------------------------------------------------------------------------
WrRTC:
jsr WrRTCAddr
txa
jsr WrRTCData
rts
;-------------------------------------------------------------------------------
; Read DS1685 Acc = Addr -> A = Data
;-------------------------------------------------------------------------------
RdRTC:
jsr WrRTCAddr
jsr RdRTCData
rts
Figure 2: RTC and LCD interfaces on bread board connected to buffered I/O bus. Program runs displaying seconds, minutes and hours read from RTC (hexadecimal for now) in endless loop.
Figure 3: Main board (left), buffered I/O (center) and UART (right).
I admit, I am not religious about quality of my connections. I should be more neat, even with prototyping. I get pretty anxious to get things done quickly when I get some idea and this is where the mess happens :-) . I am surprised this thing even works. It is enough to touch the wires in the wrong area to have all sorts of issues with serial communication. This thing is very sensitive. Currently I supply power to the boards from my old ATX power supply and the 7805 with big heat sink you see on the screen is not in use. It was getting awfully hot while working. I believe this is normal since the whole computer does not consume more than half amp., probably less (I need to take a measure when the thing is built on boards). But for now I just do not want any fire resulting from my hobby.
That's it for today. I have CF card interface in mind now. Just after I finish driver for this calendar/clock chip and have some chips assembled on real boards hopefully soon.
No comments:
Post a Comment