27220 Parallax Inc, 27220 Datasheet - Page 199

BOOK STAMPWORKS

27220

Manufacturer Part Number
27220
Description
BOOK STAMPWORKS
Manufacturer
Parallax Inc
Datasheet

Specifications of 27220

Accessory Type
Booklet
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Not applicable / Not applicable
For Use With/related Products
StampWorks
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Not applicable / Not applicable
Program: SW21-EX33-DS1307.BS2
' {$STAMP BS2}
' {$PBASIC 2.5}
' -----[ Program Description ]---------------------------------------------
'
' This program demonstrates the access and control of an external real-
' time-clock chip, the DS1307.
' -----[ I/O Definitions ]-------------------------------------------------
SDA
SCL
BtnBus
' -----[ Constants ]-------------------------------------------------------
Ack
Nak
DS1307
' -----[ Variables ]-------------------------------------------------------
slvAddr
devNum
addrLen
wrdAddr
i2cData
i2cWork
i2cAck
secs
mins
hrs
day
date
month
year
control
btns
btnBack
btnDay
btnHr
btnMn
idx
PIN
PIN
VAR
CON
CON
CON
VAR
VAR
VAR
VAR
VAR
VAR
VAR
VAR
VAR
VAR
VAR
VAR
VAR
VAR
VAR
VAR
VAR
VAR
VAR
VAR
VAR
0
1
INB
0
1
%1101 << 4
Byte
Nib
Nib
Word
Byte
Byte
Bit
Byte
Byte
Byte
Byte
Byte
Byte
Byte
Byte
Nib
btns.BIT3
btns.BIT2
btns.BIT1
btns.BIT0
Nib
' I2C serial data line
' I2C serial clock line
' four inputs, pins 4 - 7
' acknowledge bit
' no ack bit
' I2C slave address
' device number (0 - 7)
' bytes in word addr (0 - 2)
' word address
' data to/from device
' work byte for TX routine
' Ack bit from device
' DS1307 time registers
' weekday
' day in month, 1 - 31
' SQW I/O control
' debounced button inputs
' roll back
' +/- day
' +/- hours
' +/- minutes
' loop control

Related parts for 27220