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

DS1302 RTC (i know its been done)

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



Joined: 09 Jun 2013
Posts: 153

View user's profile Send private message Visit poster's website

DS1302 RTC (i know its been done)
PostPosted: Sun Aug 24, 2014 9:21 am     Reply with quote

Hi, im looking into using the RTC DS1302
however i dont have enough pins for the RESET line!

it looks like a CS line. CAN the CS be left HIGH (ON) at all times? as i plan to use the 2 remaining lines for the serial clock and IO?

thanks
temtronic



Joined: 01 Jul 2010
Posts: 9240
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Aug 24, 2014 10:08 am     Reply with quote

from the datasheet...
Input. CE signal must be asserted high during a read or a write. This pin has an internal 40kΩ (typ) pulldown resistor to ground. Note: Previous data sheet revisions referred to CE as RST. The functionality of the pin has not changed.


I assume it could be tied high, no harm in trying !!! Just be sure to test reads and writes to all registers....

hth
jay
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Aug 24, 2014 10:12 am     Reply with quote

The ds1302 data sheet says:
Quote:
1. Driving the CE input high initiates all data transfers.
2. CE turns on the control logic that allows access to the shift register for the address/command sequence.
3. The CE signal provides a method of terminating either single-byte or multiple-byte CE data transfer.
4. At power-up, CE must be a logic 0 until VCC > 2.0V.

Even if it were possible for items 1-3 to somehow be ignored, I don't see
how you can avoid #4.

But you definitely can't ignore this one:
Quote:

5. The countdown chain is reset whenever the seconds register is written.
Write transfers occur on the falling edge of CE.

and
Quote:
6. When reading the time and date registers, the user buffers are
synchronized to the internal registers on the rising edge of CE.
neochrome32



Joined: 09 Jun 2013
Posts: 153

View user's profile Send private message Visit poster's website

PostPosted: Sun Aug 24, 2014 10:20 am     Reply with quote

nah, just found the answer, sorry lads, it was more of a "HOPE" than a sensible question.. sorry..

thanks guys

looks like i'll be losing one of the RAM address buss lines! from 512k to 256K
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Sun Aug 24, 2014 3:31 pm     Reply with quote

If you already have I2C in your system then you could use one of the I2C based real time chips and sacrifice no additional pins.
For example the MCP7940 uses just SCL and SDA, the Multifunction Pin (MFP) is an optional output you can use.
Note that there are different versions of the chip, the 'M' version costs around $0.70 @ 1 piece but has no battery backup. The 'N' version costs around $0.90 and has battery backup.
This is a lot cheaper than $3.05 for the DS1302...

More info: http://www.ccsinfo.com/forum/viewtopic.php?t=50587
temtronic



Joined: 01 Jul 2010
Posts: 9240
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Aug 24, 2014 4:17 pm     Reply with quote

The 'run out of pins' problem.....

I learned a long time ago to always choose a bigger PIC for 'the project'. In fact the 18F46K22, 40 pin DIP is my 'go to PIC' Size of the PCB is NOT the main issue, rather NEVER running out of pins, memory, etc.R&D labour and time is the BIG factor in getting a product from concept to customer.Rather than pay $$$ for 'can I rearrange my design for another pin...' which might take days and NOT happen, I prefer to spend a couple extra bucks up front for a PIC I KNOW will do the job(and a few 'extras' that always happen !).

If you can detail us the design, we might be able to 'rearrange' some I/O, maybe mux a pin or two to 'find' that extra pin you need.

hth
jay
neochrome32



Joined: 09 Jun 2013
Posts: 153

View user's profile Send private message Visit poster's website

PostPosted: Sun Aug 24, 2014 8:23 pm     Reply with quote

Temtronic, my pic is a dsPIC33EP 512 GHP 806, its 64 pins lol

although ckielstra, thanks for that tip!! i do have i2C setup already!
i'll have a look at this chip!!! thanks!!
Ttelmah



Joined: 11 Mar 2010
Posts: 19535

View user's profile Send private message

PostPosted: Mon Aug 25, 2014 12:42 am     Reply with quote

One question is are you using the internal oscillator, or a crystal?.
If the latter, then consider switching to an external oscillator module. You can then use RC15.
Saving a pin this way is always worth considering, especially since an external oscillator module can also drive other things.

However the I2C RTC, may well be the easiest solution.
neochrome32



Joined: 09 Jun 2013
Posts: 153

View user's profile Send private message Visit poster's website

PostPosted: Mon Aug 25, 2014 11:27 am     Reply with quote

yeah i've opted for the i2c RTC (i dont like i2c protocol much)
also i used to use the DS1307 but the systems a 3.3v and thus doesn't work so i am using the MCP7940N alot more compnents, but in the end, i need stability on this machine..

i know its done many many times, but i am building a mini Androidy type thing, my own OS tho 512k isn't enough for a real android thing lol

im using the dsPIC internal clock as i need the pins from the OSC1 OSC2 pins lol... i didn't want to use the 80 pins as that would juist be wasted legs in the end

i2c puts me back on track
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