Hello, i´m working with the ads1247 and a microcontroller pic 18f4550 and i have a problem. First i program the ads registers with the following values:
mux0=0x01
VBIAS=0X00
mux1= 0x60
SYSO=0x71
IDAC0=0X07
IDAC1=0X01
I want to work with a rtd in three wire connection with hardware compensation, therefore the ads´s pin are conected in the following way:
DVDD=5V, DGND=GND, CLK=GND, RESET=5V, REFP0=REFN0=RBIAS, VREFOUT connected to a .2.2uF capacitor and thisone connected to VREFCOM, VREFCOM=GND, AIN0 and AIN1 connected to RTD, AVSS=GND, AVDD=5V, (START, CS, DRDY, DOUT, DIN, SCLK) connected to the microcontroller.
The thing is that after i write the registers i´m able to read them and i can see they are correctly loaded. After this i start a conversion and when the start´s bit returns to 0' all the registers are erased lather if the start´s bit returns to 1' i can read again the correctly values of the registers. Even if the START is allways in 1' the only data that received the pic is 128 in the MSB of the data conversion. If i want to messure the RBIAS voltage using a voltimeter the same thing happen again (all the register are erased). I am reading the data (registers values and temperature convertion) in a lcd display connected to the pic. Next i attached the firmware of the pic in c language.
#INCLUDE <18F4550.H>
#fuses INTRC_IO,PUT,VREGEN,NOWDT,NOPROTECT,NOLVP,NODEBUG
#use delay(clock=4000000)
#use spi (master, bits=8 , di= pin_b0, do= pin_c7, clk=pin_b1, msb_first , force_sw)
#include <lcdpf.c>
#define cs pin_a0
#define start pin_a3
#define ready pin_a1
int dato_spi1[]={5,6,7}, dato_spi2[3];
float dato;
int i,j,k,l,m,n,flag=1;
void start_ads()
{
output_low(cs);
spi_xfer(0x06); //Reset
delay_ms(3);
spi_xfer(0x16); //SDATAC
spi_xfer(0x40);
spi_xfer(0x03);
spi_xfer(0b00000001);
spi_xfer(0b00000001);
spi_xfer(0b01100000);
spi_xfer(0b01110001);
spi_xfer(0x4A);
spi_xfer(0b00000001);
spi_xfer(0b00000111);
spi_xfer(0b00000001)
output_HIGH(cs);
}
void main ()
{
lcd_init();
output_HIGH(cs);
set_tris_a(0b00000010);
set_tris_c(0);
set_tris_b(0b00000001);
start_ads();
while (1)
{
output_low(cs);
delay_ms(10);
spi_xfer(0x20);
spi_xfer(0x03);
i=spi_xfer(0xff);
j=spi_xfer(0xff);
k=spi_xfer(0xff);
l=spi_xfer(0xff);
spi_xfer(0x2A);
spi_xfer(0x01);
m=spi_xfer(0xff);
n=spi_xfer(0xff);
delay_ms(10);
output_high(START);
Delay_ms(1);
output_low(START);
Delay_us(30);
spi_xfer(0x12);
delay_ms(300);
dato_spi1[0]=spi_xfer(0xFF);//MSB
dato_spi1[1]=spi_xfer(0xFF);//MID BYTE
dato_spi1[2]=spi_xfer(0xFF);//LSB
output_high(cs);
lcd_gotoxy(1,1);
printf(lcd_putc,"mux %2x te %2.2f ",i,dato);
lcd_gotoxy(1,2);
printf(lcd_putc,"mux %2x te %2u ",j,dato_spi1[0]);
lcd_gotoxy(1,3);
printf(lcd_putc,"mux %2x %2x mux %2u ",k,m,dato_spi1[1]);
lcd_gotoxy(1,4);
printf(lcd_putc,"mux %2x %2x mux %2u ",l,n,dato_spi1[2]);
output_low(pin_a2);
}
}
Sorry for my bad english, i´m from Argentina. I hope you can helpme. Best regards