george
Joined: 14 Mar 2008 Posts: 10
|
PCD: i2c trouble |
Posted: Fri May 08, 2009 2:51 pm |
|
|
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 |
|