Dave-W
02-16-2010, 09:11 AM
Hello All,
I·am just starting to program my BS2P to interface my new DS3232 Date / Time IC.
Here is some code I just started with and I would like to know if I am on the right track or way out in left field. According to PBasic the address is not needed. It says:
·Note that some devices like the PCF8574 do not require an internal address, so this parameter is optional (BS2p firmware 1.3 or later is required to omit the Address parameter).
So, I am using the Slave ID as the Memory address for the DS3232. Will this work?
Will this work?
' {$STAMP BS2p}
' {$PBASIC 2.5}
·
' ================================================== ======================
·
' -----[ Program Description ]---------------------------------------------
·
' This code will interface the BS2p, BS2pe and BS2px to a Dallas DS3232 maybe
·
' -----[ I/O Definitions ]-------------------------------------------------
·
SDA··········· PIN····· 0············· ' I2C Serial Data Line
SCL··········· PIN····· 1············· ' I2C Serial Clock Line
·
' -----[ Variables ]-------------------------------------------------------
·
TimeDate········· ········ VAR····· Byte·········· ' Variable Used To Store Value
DS3232_Start_add··· VAR····· Byte·········· ' DS3232 Start+ counter address to put Data
Counter······················ VAR··· ·· Byte············ ' Loop counter for Data Address
' ------- Preset Data ----------------------------------------------------------
'
DS3232_Start_add···· =$00
Counter· ···················· = 00····
'
I2COUT SDA, ID+COUNTER, [TimeDate]
·
' This will loop until all time and date data has been transferred.
Any suggestions welcome,
Dave
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Dave W.
I·am just starting to program my BS2P to interface my new DS3232 Date / Time IC.
Here is some code I just started with and I would like to know if I am on the right track or way out in left field. According to PBasic the address is not needed. It says:
·Note that some devices like the PCF8574 do not require an internal address, so this parameter is optional (BS2p firmware 1.3 or later is required to omit the Address parameter).
So, I am using the Slave ID as the Memory address for the DS3232. Will this work?
Will this work?
' {$STAMP BS2p}
' {$PBASIC 2.5}
·
' ================================================== ======================
·
' -----[ Program Description ]---------------------------------------------
·
' This code will interface the BS2p, BS2pe and BS2px to a Dallas DS3232 maybe
·
' -----[ I/O Definitions ]-------------------------------------------------
·
SDA··········· PIN····· 0············· ' I2C Serial Data Line
SCL··········· PIN····· 1············· ' I2C Serial Clock Line
·
' -----[ Variables ]-------------------------------------------------------
·
TimeDate········· ········ VAR····· Byte·········· ' Variable Used To Store Value
DS3232_Start_add··· VAR····· Byte·········· ' DS3232 Start+ counter address to put Data
Counter······················ VAR··· ·· Byte············ ' Loop counter for Data Address
' ------- Preset Data ----------------------------------------------------------
'
DS3232_Start_add···· =$00
Counter· ···················· = 00····
'
I2COUT SDA, ID+COUNTER, [TimeDate]
·
' This will loop until all time and date data has been transferred.
Any suggestions welcome,
Dave
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Dave W.