PDA

View Full Version : Ds1307



miniman
- 31st January 2005, 21:28
Could anyone help me in the interface of a PIC16F877A to DS1307 using the i2c protocol to set up and read.

NavMicroSystems
- 31st January 2005, 22:17
miniman

Have you searched the Forum for "DS1307"

There is plenty of stuff !

And if you have a look at the Melabs site you will find a redy to run example from Melanie.


You have got to do your homework on your own now.

photoeye
- 1st February 2005, 17:49
Hi miniman,

do you know what is needed
to change Mel's code from
the melabs site to work with a
PIC16F877?

I read about the @ command
but not sure how to change this
to work with the 16F877.

thanks.

NavMicroSystems
- 1st February 2005, 22:54
Click Here (http://www.picbasic.co.uk/forum/showthread.php?s=&threadid=543)

Sorry for this comment,
but if you don't know how to load Melanies code onto a 16F877
you will not be able to understand that code at all.

photoeye
- 2nd February 2005, 01:21
I understand some of the code, not all of it.
as I mentioned, I don't know the assembly side of things so that is why I am asking what changes are required to program it on a 16F877.

I did not know I had to fully understand every bit
of her code to post a question that would result in a
helpful answer or one that I could learn from.

darn, what happened to if you don't understand something, just ask?

NavMicroSystems
- 2nd February 2005, 02:01
photoeye

The link posted earlier should give vo all information you need.

BTW

Melanies DS1307 example does not involve any assembler at all !!

photoeye
- 2nd February 2005, 03:27
not sure what link you are referring to.

sorry, maybe I did not ask clearly enough.
I am using the microcode studio. loaded
the ds1307.bas file. when I compile, I get
the following error messages:

Error ds1307~1.asm 166:[255]undefined symbol 'intrc_osc_noclkout'
etc...

I went back to the pic basic manual
to find out what the @ command does,
it mentions the @ command allows insertion
of an assembly line of code.

I understand her code is written entirely
in pic basic. there are lines of code in there
that are assembly related.

such as how the months are stored. that is
why I am asking if there are changes
required to properly compile for the 16f877 since
the memory locations maybe different for each pic.
I am guessing here that is why I am asking. I am
not at your senior level to know and understand every
line of code.


if I select the target processor as 16F628, it compiles
just fine but I don't have the 16F628 pic.

Melanie
- 2nd February 2005, 08:29
Those @DEFINE statements preset the configuration bits for the 16F628. You can just delete those lines out and compile with default settings for your PIC16F877 or whatever you chose.

If you go to the FAQ's section of this forum, see the thread on "Preseting Configuration Fuses". It tells you ALL you need to know about those lines. Insert one's appropriate to your chosen PIC - detailed instuctions on how to find all about your particular PIC's config fuses are contained theirin.

The 16F877 doesn't have an equivallent to the 16F628's 'intrc_osc_noclkout', you'll have to chose a different oscillator setting - whatever option you chose will not affect the code (as long as it's 4MHz).