PDA

View Full Version : RTC module - Easypic5



malc-c
- 4th February 2010, 19:58
Working out the pin mapping for a project and my lack of experience has lead me to another question.

I've purchased one of the RTC2 modules for use with the EasyPIC5 board and I'm stumped on the ideal port to use with the target PIC which is an 18F4550.

The documentation on the module suggests that it uses RC3 (SCL) and RC4 (SDA), however the datasheet on the 18F4550 states that RC3 is not implemented (why it don't say). I'm therefore assuming that I can't use the RTC module with this PIC ?

rmteo
- 4th February 2010, 20:13
The PIC18F4550 has Vusb on pin 18 - where SCL is located for most (if not all non USB) PIC18's. To get the RTC2 to work with the 4550, you will need to use PORTB with RB1 (SCL) and RB0 (SDA).

Probably easiest to use PORTC of something like a PIC18F4620. Or better yet, look into a PIC18F4xJ11 with a built-in RTCC.
See here http://www.picbasic.co.uk/forum/showthread.php?t=12553

malc-c
- 4th February 2010, 20:46
Thanks for the suggestions

mackrackit
- 4th February 2010, 22:01
What is a RTC2 ?

Bruce
- 4th February 2010, 22:24
Dave,

Here's a link to the RTC2: http://www.mikroe.com/en/tools/rtc2-proto/

Malc-c,

You can use this with pretty much any pin that I2CWrite/I2CRead work on, and
you can probably find several PBP examples here for working with the DS1307.

mackrackit
- 4th February 2010, 22:34
Thanks Bruce,
I was going to suggest what you did but though maybe it was something special.
Just a regular RTC...

I use the 1337 on a 4550 with pins PORTD.0 and PORTD.1.
For whatever it is worth....

Bruce
- 4th February 2010, 22:42
Hey Dave,

Yeah - it's just a plain-old DS1307.....:o)

Malc-C,

Here's one of the best examples I've ever seen for PBP using the DS1307 by Melanie;
http://www.melabs.com/resources/samples/submitted/MN1307.txt

I suspect the reason they recommend specific pins was due to them using hardware I2C
in the sample code they provide for the RTC module.

rmteo
- 4th February 2010, 22:57
I suspect the reason they recommend specific pins was due to them using hardware I2C in the sample code they provide for the RTC module.

That is correct.

malc-c
- 4th February 2010, 23:12
Thanks once again for all the input.

I'll take a look at those examples. I've not used any I2C device before so forgive me for these noobie questions - and Reading TFM just confused things :)

ardhuru
- 5th February 2010, 01:40
You can use this with pretty much any pin that I2CWrite/I2CRead work on, and
you can probably find several PBP examples here for working with the DS1307.

True, especially since you're using a complete module. If you were using a plain RTC chip, I'd suggest choosing 2 pins which are weak pull-up capable, the'd save you 2 external resistors on the signal lines.

Regards,

Anand

malc-c
- 5th February 2010, 20:19
Quick question, I'm having problems reading the schematic of the board http://www.mikroe.com/pdf/rtc2_schematic_v100.pdf

The board doesn't have the 3 x 2 header shown, just the 5 x 2 which connects to the easypic5. As I need to breadboard these modules to connect to the spare pins I'll have and not take up a full port can some one tell me what pins on the 5 x 2 header I need to connect to the PIC (other than supply ;) )

EDIT: - just looked at the code and previous replies... RC3 and RC3 are suggested, so that would be pins 4 and 5 on the header

rmteo
- 6th February 2010, 16:51
One possibility to consider. If you do not need all the features of a full-blown RTCC (especially the calendar and alarm), you can implement a real time clock on a PIC18 with just a watch crystal and 2 capacitors - less than $0.30 in cost.

http://home.earthlink.net/~rmteo/sitebuildercontent/sitebuilderpictures/a_69c.jpg

Using the Secondary Oscillator (RC0, RC1, and TIMER1), all it needs is just a few lines of code to implement an interrupt driven real time clock. Look at the data sheet section for TIMER1 for more details.