hola
estou precisando utilizar um conversor de 16 bit, peguei o mcp3425 cuja saida é a interface I2C,fiz o circuito no proteus onde a saida I2C do mcp vai para a i2c do pic18f4850,fiz o codigo abaixo,mas quando inicio o simulação não ocorre nehuma conversão,o programa fica travado na linha q contem (data = i2c_read();)do codigo abaixo
#include<18f4580.h>
//#device ADC=10
#use delay(clock=4000000)
#fuses XT,NOWDT,PUT,BROWNOUT,NOLVP
#include <lcd.c>
#use i2c(MASTER, SDA=PIN_C4, SCL=PIN_C3)
main ()
{
char cmd[20];
long int data;
lcd_init();
printf(lcd_putc,"i2c iniciada");
while(1){
i2c_start();
i2c_write(0xD0);
delay_us(10);
data = i2c_read();
printf(lcd_putc,"dado convertido");
sprintf(cmd,"%lu",data);
printf(lcd_putc,":");
printf(lcd_putc,cmd);
}
}
nao sei se esta faltando um comando para o mcp de configuração(ja tentei alguns comandos de escrita,mas nao deu certo),pois o conversor nao responde de modo algum,alguem tem alguma ideia do que pode estar acontecendo?