27297 Parallax Inc, 27297 Datasheet - Page 202

KIT STAMPWORKS WITH BS2-IC

27297

Manufacturer Part Number
27297
Description
KIT STAMPWORKS WITH BS2-IC
Manufacturer
Parallax Inc
Datasheet

Specifications of 27297

Lead Free Status
Contains lead
Product
Microcontroller Accessories
Lead Free Status / Rohs Status
Lead free / RoHS Compliant

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
27297SQ
Manufacturer:
NS
Quantity:
4
' Do a block read from clock registers
Get_Clock:
' =====[ High Level I2C Subroutines]=======================================
' Random location write
' -- pass device slave address in "slvAddr"
' -- pass bytes in word address (0, 1 or 2) in "addrLen"
' -- word address to write passed in "wrdAddr"
' -- data byte to be written is passed in "i2cData"
Write_Byte:
NEXT
GOSUB I2C_Stop
RETURN
GOSUB I2C_Start
i2cWork = slvAddr & %11111110
GOSUB I2C_TX_Byte
IF (i2cAck = Nak) THEN Get_Clock
i2cWork = 0
GOSUB I2C_TX_Byte
GOSUB I2C_Start
i2cWork = slvAddr | %00000001
GOSUB I2C_TX_Byte
FOR idx = 0 TO 6
NEXT
GOSUB I2C_RX_Byte_Nak
control = i2cWork
GOSUB I2C_Stop
RETURN
GOSUB I2C_Start
i2cWork = slvAddr & %11111110
GOSUB I2C_TX_Byte
IF (i2cAck = Nak) THEN Write_Byte
IF (addrLen > 0) THEN
ENDIF
i2cWork = i2cData
GOSUB I2C_TX_Byte
i2cWork = secs(idx)
GOSUB I2C_TX_Byte
GOSUB I2C_RX_Byte
secs(idx) = i2cWork
IF (addrLen = 2) THEN
ENDIF
i2cWork = wrdAddr.BYTE0
GOSUB I2C_TX_Byte
i2cWork = wrdAddr.BYTE1
GOSUB I2C_TX_Byte
' send Start
' send slave ID (write)
' wait until not busy
' point at secs register
' send slave ID (read)
' read secs to year
' read control
' send Start
' send slave ID (write)
' wait until not busy
' send word address (1)
' send word address (0)
' send data

Related parts for 27297