CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Example program EX_RTCLK

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Aryan
Guest







Example program EX_RTCLK
PostPosted: Tue Mar 15, 2005 12:57 pm     Reply with quote

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








PostPosted: Tue Mar 15, 2005 1:59 pm     Reply with quote

You should be using RTC_SCLK. You can either modify your #define or rewire.

#define RTC_SCLK PIN_D2
Aryan
Guest







PostPosted: Tue Mar 15, 2005 2:18 pm     Reply with quote

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








PostPosted: Wed Mar 16, 2005 10:47 am     Reply with quote

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








PostPosted: Wed Mar 16, 2005 10:53 am     Reply with quote

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








PostPosted: Wed Mar 16, 2005 11:06 am     Reply with quote

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
PostPosted: Sat Mar 19, 2005 5:58 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Mar 21, 2005 9:50 am     Reply with quote

welcome.... Wink
_________________
-Matt
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group