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 support@ccsinfo.com

PCD: i2c trouble

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



Joined: 14 Mar 2008
Posts: 10

View user's profile Send private message

PCD: i2c trouble
PostPosted: Fri May 08, 2009 2:51 pm     Reply with quote

Hello all

I have converted from a pic 18 series part to a dsp30F5011 part. I am using 3 DACS MCP4725 base part address 00x

we are using the same code but are unable to get the DAC to work. I have tried reading the SDA and SCL with a 100 Mhz scope and are unable to see any bus signals. Is there any differences between 16 bit parts and 8?

Here is the key source code:
Code:

#use delay(clock=10000000)
#fuses XT,NOPROTECT,BROWNOUT,BORV27,NOWDT,PUT64,MCLR

#use I2C(MASTER, scl=PIN_G2, sda=PIN_G3, FAST=10000000, NOFLOAT_HIGH )

#separate
   void dac_i2c(unsigned int16 resvalue){ 
   int j;
   int k;   
    j = make8(resvalue,1);
    k = make8(resvalue,0);
   //output_high(relay);
   i2c_start();   
   i2c_write(194);                        // Device address
   i2c_write(j);                          // Internal Device address   
   i2c_write(k);                          // Resisitor value   
   i2c_stop();                            // Stop condition
   DELAY_uS(10);
   }   

#separate
   void test_dacs(){
   while(true){
   output_high(RELAY);
   output_low(A01);   
   output_low(A02);
   output_low(A03);
   delay_us(50);
   output_high(A01);    //select dac 1
   dac_i2c(409);
   delay_us(50);
}
 }


Thanks Geo
george



Joined: 14 Mar 2008
Posts: 10

View user's profile Send private message

PostPosted: Fri May 08, 2009 3:20 pm     Reply with quote

compiler version 4.092
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