View previous topic :: View next topic |
Author |
Message |
pic2
Joined: 04 Nov 2009 Posts: 9
|
Using Pic with Maxim DS1682 time & event recorder |
Posted: Mon Nov 30, 2009 3:51 pm |
|
|
Hello,
Has anyone here used the Maxim DS1686 before? I am fairly new to the PIC and CCS, and I'm looking for a good source of reference on how to use this DS1682 with a PIC via I2C communication.
I tried google and Maxim site without luck. Thanks in advance. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Nov 30, 2009 4:09 pm |
|
|
Maxim has an appnote here, and it could be translated to CCS:
http://pdfserv.maxim-ic.com/en/an/AN506.pdf
They use "bit banging" to do the i2c. CCS has an i2c library that will
do this for you. Invoke it with this:
Code: | #use i2c(Master, sda=PIN_C4, scl=PIN_C3) |
Use whatever pins are appropriate or available on your PIC.
Be sure to put a 4.7K pull-up resistor on each signal: sda and scl.
The following Maxim functions each have a CCS equivalent:
Code: |
Maxim function CCS equivalent function
void start2w() i2c_start()
void stop2w() i2c_stop()
void writebyte2w(uchar d) i2c_write()
uchar readbyte2w(uchar b) i2c_read()
|
In other words, don't use their low-level routines, such as start2w(), etc.,
as shown above. Delete them. Then edit the following routines and
substitute the CCS functions for their functions.
Code: |
uchar read_byte(uchar reg_add)
void writereg()
void readreg()
void init()
|
Their init() routine just goes on and on. It's much too large for a test
program. It really should be cut down. |
|
|
pic2
Joined: 04 Nov 2009 Posts: 9
|
|
Posted: Mon Nov 30, 2009 4:28 pm |
|
|
Thanks PCM. I'll try what you suggested and see. In fact, I did find that app notes on Maxim site, but I just had no idea how to use CCS in place of that coding pages.
By the way, would you happen to know if there is such a thing you can interface to the DS1682 and have the recorded information in EEPROM read and displayed on display such as hyper terminal or the like? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Nov 30, 2009 4:37 pm |
|
|
You're talking about a pre-packaged interface to it ? That would have
to be some kind of Evaluation board from Maxim, if it exists. Or some
other board produced for commerical sale, and probably found with
Google. Possibly you could get a program that runs on the PC and uses
the PC Parallel port to talk to an i2c device. Some kind of data logger
company might offer such a product. It's up to you to search for it. |
|
|
pic2
Joined: 04 Nov 2009 Posts: 9
|
|
Posted: Mon Nov 30, 2009 4:50 pm |
|
|
Thanks. I see your points. |
|
|
zamorah
Joined: 21 Apr 2011 Posts: 2
|
CCS i2c library |
Posted: Thu Apr 21, 2011 5:09 pm |
|
|
Hi,
I am new to this forum. I was wondering where I can locate the
CCS i2c library that you mentioned?
Thanks,
Harlan |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1933 Location: Norman, OK
|
|
Posted: Thu Apr 21, 2011 6:28 pm |
|
|
It is not a separate library. You will find it in the manual under Built In
Functions of the compiler... _________________ Google and Forum Search are some of your best tools!!!! |
|
|
zamorah
Joined: 21 Apr 2011 Posts: 2
|
|
Posted: Fri Apr 22, 2011 6:21 am |
|
|
Hi,
Thank you so much for the info. After further googling and searching around I found out that they were part of the CCS compiler.
Thanks again for the help.
regards |
|
|
|