View previous topic :: View next topic |
Author |
Message |
Aryan Guest
|
Example program EX_RTCLK |
Posted: Tue Mar 15, 2005 12:57 pm |
|
|
Hi,
This example came along with CCS compilor to read and write an external real time clock ds1302 using a keypad and LCD.
I am a bit confused with the code in this example EX_RTCLK.C .In this example the pin connections of ds1302 with the circuit is as follows
#define RTC_SCLK PIN_B1
#define RTC_RST PIN_B2
#define RTC_CE PIN_D0
#define RTC_IO PIN_D1
#define RTC_CLK PIN_D2
#define RTC_DATA PIN_D3
Can anyone pls advice what is the difference between RTC_SCLK and RTC_CLK. The driver example ds1302.c says the the real time clock to be connected according to following.
#define RTC_SCLK PIN_B1
#define RTC_IO PIN_B3
#define RTC_RST PIN_B2
I have connected ds1302 on port D on the pins as follows
#define RTC_CE PIN_D0
#define RTC_IO PIN_D1
#define RTC_CLK PIN_D2
#define RTC_DATA PIN_D3
Am I connecting it correctly?? The display I am getting by connecting ds1302 this way is as follows
FF/FF/FF
FF:FF:FF
Please can anyone advice
1) Which is the correct way of connecting the ds1302 ?
2) Why am I getting the erronous results by connecting the way I have done.
Regards
Aryan |
|
|
Guest
|
|
Posted: Tue Mar 15, 2005 1:59 pm |
|
|
You should be using RTC_SCLK. You can either modify your #define or rewire.
#define RTC_SCLK PIN_D2 |
|
|
Aryan Guest
|
|
Posted: Tue Mar 15, 2005 2:18 pm |
|
|
Anonymous wrote: | You should be using RTC_SCLK. You can either modify your #define or rewire.
#define RTC_SCLK PIN_D2 |
I tried as adviced you...but no luck...yielding same results. I modified to #define RTC_SCLK PIN_D2 |
|
|
Guest
|
|
Posted: Wed Mar 16, 2005 10:47 am |
|
|
You did this in the EX_RTCLK.C file right? What ever is in the ds1302 driver file is not used since it is defined in the EX_RTCLK.C from the #ifndef. |
|
|
Guest
|
|
Posted: Wed Mar 16, 2005 10:53 am |
|
|
By the way, do you have a crystal hooked up to the ds1302? Have you tested it to make sure it is running (oscilloscaope)? |
|
|
Guest
|
|
Posted: Wed Mar 16, 2005 11:06 am |
|
|
another problem I see is that the RTC_RCT is no set right. RTC_CE = RTC_RST. Change RTC_RST in the EX_RTCLK.C to:
#define RTC_RST PIN_D0 |
|
|
Aryan Guest
|
Thanks |
Posted: Sat Mar 19, 2005 5:58 pm |
|
|
Anonymous wrote: | another problem I see is that the RTC_RCT is no set right. RTC_CE = RTC_RST. Change RTC_RST in the EX_RTCLK.C to:
#define RTC_RST PIN_D0 |
Thanks a lot.
Your advice helped me immensly. Everything is working fine now.
Thanks once again
Regards
Aryan |
|
|
DragonPIC
Joined: 11 Nov 2003 Posts: 118
|
|
Posted: Mon Mar 21, 2005 9:50 am |
|
|
welcome.... _________________ -Matt |
|
|
|