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

Using Pic with Maxim DS1682 time & event recorder

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



Joined: 04 Nov 2009
Posts: 9

View user's profile Send private message

Using Pic with Maxim DS1682 time & event recorder
PostPosted: Mon Nov 30, 2009 3:51 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Nov 30, 2009 4:09 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Nov 30, 2009 4:28 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Nov 30, 2009 4:37 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Nov 30, 2009 4:50 pm     Reply with quote

Thanks. I see your points.
zamorah



Joined: 21 Apr 2011
Posts: 2

View user's profile Send private message

CCS i2c library
PostPosted: Thu Apr 21, 2011 5:09 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Apr 21, 2011 6:28 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Apr 22, 2011 6:21 am     Reply with quote

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
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