Joined: 28 Jun 2005 Posts: 200 Location: Ashburton / Mid Canterbury / New Zealand
Posted: Wed Aug 12, 2015 1:35 pm Post subject: RTC clock address selecting
Hi
I'm busy changing one of my projects from a DS1307 to a DS3231 RTC. Im using the SWQ pin to drive a INT in my program.
My old for the DS1307 code is
Code:
'Setup the module so SQW outpin triggers at one sec I2cstart'Setup the SQW pin for 1 pulse/sec I2cwbyte Ds1307w 'DS1307 write address I2cwbyte7'Data to go to the control register 7 I2cwbyte &B00010000 'set I2cstop
my new code for the DS3231 is
Code:
'Setup the module so SQW outpin triggers at one sec I2cstart'Setup the SQW pin for 1 pulse/sec I2cwbyte Ds1307w 'Ds1307w I2cwbyte&HE 'Data to go to the control register 7 I2cwbyte &B01000000 'set I2cstop
this works fine with no worries
My question is
What does "I2cwbyte Ds1307w" do? I know it has something to do with the I2C rtc address of the RTC. If i change the code to I2cwbyte Ds3231w it fails to compile. Where does Bascom look up the information on Ds1307w to get the address from. I want to change it so my code matched the RTC i'm now using.
Joined: 28 Jun 2005 Posts: 200 Location: Ashburton / Mid Canterbury / New Zealand
Posted: Thu Aug 13, 2015 12:37 am Post subject:
Hi Ben
Yes you're right there are 2 constants for the 1307 R/W. Where is the address for that those constants stored in bascom?. I want to add the DS13231 RTC to the list. I know the addresses are the same as my code works but i would like to add this RTC to it so my code looks correct ETC and possibly add other external devices as well at some stage.
Joined: 28 Jun 2005 Posts: 200 Location: Ashburton / Mid Canterbury / New Zealand
Posted: Thu Aug 13, 2015 1:34 am Post subject:
Sorry yes your right
I couldn't see the wood for the trees.
In the C:\Program Files\MCS Electronics\BASCOM-AVR\LIB folder there is a few ds1307.lib files. What do they do??
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum