Page 130 - Making PIC Microcontroller Instruments and Controllers
P. 130
r 20 ct ocKs. MElrollY. allD socKEls
&llmnfriffilg Program lo read from and write to Microwke SEEPRoMS
(Continued,
NEXT A.DDR
rrooP: i
FOR ADDR = O IO 15 ; loop 16 tines
GOSOB EEREA,D i TEAd fTOTN SEEPROM
LcDorxr SFE. 1, *aDDR,": ',iiBo ; displav
PlusE 1000
NEXT A.DDR
GOEO LOOP
; sl}broutine !o tead daLa fron addr in serial EEPRoM
EERE]AD t
CS=1 ; enable serial EEPROI,I
aEIFtrouT Dt, ct/R, ItEBFIllsI, I%1100\4' ADDRI ; send read cnd
; and address
SEIFETN m, cIiK, ![sBPOsf, lB0] , read data
c s = O ; d i s a b l e
RETURTI
; subroutine to write data a!
; addr in serial EEPROM
ErgrRrtE: CS = 1 ; Enable serial EEPROM
SHIRIOT'T DI. CI,K. MSBFIRST, IZ1O1O\{. A.DDR, BOT
; sends wrile corEnand, address
; and data
c s . o ; d i s a b l e
RET('RI{
; s u b r o u l i n e r o a a o b l c w r j . e p r o s e r i a . _ ' o P o M
EEWRIAEEIiI: ; subrouline
C S = 1 ; e n a b l e s e r i a l E E P R O M
sErFTOtt! Dr. cr,K, MgBFtRsr, I%10011\5. 0\71
; send wrile enabLe cnd and
; drurrny ctocks
c s = o ; d i s a b l e
AEIFORN
END ; end Proqra
Socket U6-Real-Time Clocks
Four options are available for using socket U6. This socket is designed to let us exper-
iment with three real-time clocks and with a l2-bit analog_to-digital converter' It con
nects to the microcontroller as shown:
As shown in Figure 7.5, this is a four wire interface betweon the MCU and the lC
The wiring for this chip is similar to the wiring for the Microwire SEEPROMS and the
Microwire memory ICs. Essentially, this looks like a memory chip to the pmc€ssor When
we write to ihis memory, we are writing to the clock, and when we read from this chip'
we are reading an ever cha.nging memory content lhat gives us infomation that we can
'lime." So the progam to read and write to this clock looks like a program
interpret as
that interacts with the Microwire fanily of SEEPROMS (See Program 7.3 )