Quantcast
Channel: Data converters
Viewing all articles
Browse latest Browse all 27325

Forum Post: RE: ADS1248: SPI communication in continously conversion mode for RTD PT100 thermo measurement

$
0
0
Hi Bob, thanks a lot for your help so far. I set up the register's of the ADS1248 now with the following code: //Initialisation of the ADS1248 pin_LO(ChipSelect); SPI1_Write(0x40); //Write to register Adress MUX0 WREG|IDAC0 SPI1_Write(0x00); //Bytes to be written - 1 SPI1_Write(0x01); //Burn-out current source off /Pos Input: AIN0 (default)/Neg Input:AIN1 (default) pin_HI(ChipSelect); pin_LO(ChipSelect); SPI1_Write(0x41); //Write to register VBIAS WREG|VBIAS SPI1_Write(0x00); //Bytes to be written - 1 SPI1_Write(0x00); //BIAS voltage disabled pin_HI(ChipSelect); pin_LO(ChipSelect); SPI1_Write(0x42); //Write to register MUX1 WREG|MUX1 SPI1_Write(0x00); //Bytes to be written - 1 SPI1_Write(0x20); //Internal oscillator in use / Internal reference is always on / REFP0 and REFN0 reference inputs selected pin_HI(ChipSelect); pin_LO(ChipSelect); SPI1_Write(0x43); //Write to register SYS0 WREG|SYS0 SPI1_Write(0x00); //Bytes to be written - 1 SPI1_Write(0x20); //PGA = 4 / DR = 5 SPS pin_HI(ChipSelect); pin_LO(ChipSelect); SPI1_Write(0x4A); //Write to register IDAC0 WREG|IDAC0 SPI1_Write(0x00); //Bytes to be written - 1 SPI1_Write(0x06); //IDAC0: 1mA DOUT/DRDY = DOUT pin_HI(ChipSelect); pin_LO(ChipSelect); SPI1_Write(0x4B); //Write to register IDAC1 WREG|IDAC1 SPI1_Write(0x00); //Bytes to be written - 1 SPI1_Write(0x89); //IDAC1:IEXC1 IDAC2:IEXC2 pin_HI(ChipSelect); pin_LO(ChipSelect); SPI1_Write(0x44); //Write to register 0FC0 WREG|0FC0 SPI1_Write(0x00); //Bytes to be written - 1 SPI1_Write(0x00); //reset offset calibration pin_HI(ChipSelect); pin_LO(ChipSelect); SPI1_Write(0x45); //Write to register OFC1 WREG|OFC1 SPI1_Write(0x00); //Bytes to be written - 1 SPI1_Write(0x00); //reset offset calibration pin_HI(ChipSelect); pin_LO(ChipSelect); SPI1_Write(0x46); //Write to register OFC2 WREG|OFC2 SPI1_Write(0x00); //Bytes to be written - 1 SPI1_Write(0x00); //reset offset calibration pin_HI(ChipSelect); pin_LO(ChipSelect); SPI1_Write(0x4C); //Write to register GPIOCFG WREG|GPIOCFG SPI1_Write(0x00); //Bytes to be written - 1 SPI1_Write(0x00); //all used as analog inputs pin_HI(ChipSelect); pin_LO(ChipSelect); SPI1_Write(0x4D); //Write to register GPIODIR WREG|GPIODIR SPI1_Write(0x00); //Bytes to be written - 1 SPI1_Write(0x00); //all used as analog inputs pin_HI(ChipSelect); pin_LO(ChipSelect); SPI1_Write(0x4E); //Write to register GPIODAT WREG|GPIODAT SPI1_Write(0x00); //Bytes to be written - 1 SPI1_Write(0x00); //all used as analog inputs pin_HI(ChipSelect); I checked with the RREG command if the registers are correct setted up: pin_LO(ChipSelect); SPI1_Write(0x20); //read register MUX0 SPI1_Write(0x00); //bytes to be read - 1 SPI1_Write(0xFF); //data readout with NOPS pin_HI(ChipSelect); pin_LO(ChipSelect); SPI1_Write(0x21); //read register VBIAS WREG|VBIAS SPI1_Write(0x00); //Bytes to be read - 1 SPI1_Write(0xFF); pin_HI(ChipSelect); pin_LO(ChipSelect); SPI1_Write(0x22); //Read register MUX1 WREG|MUX1 SPI1_Write(0x00); //Bytes to be read - 1 SPI1_Write(0xFF); pin_HI(ChipSelect); pin_LO(ChipSelect); SPI1_Write(0x23); //Read register SYS0 WREG|SYS0 SPI1_Write(0x00); //Bytes to be read - 1 SPI1_Write(0xFF); pin_HI(ChipSelect); pin_LO(ChipSelect); SPI1_Write(0x2A); //Read register IDAC0 WREG|IDAC0 SPI1_Write(0x00); //Bytes to be read - 1 SPI1_Write(0xFF); pin_HI(ChipSelect); pin_LO(ChipSelect); SPI1_Write(0x2B); //Read register IDAC1 WREG|IDAC1 SPI1_Write(0x00); //Bytes to be read - 1 SPI1_Write(0xFF); pin_HI(ChipSelect); pin_LO(ChipSelect); SPI1_Write(0x24); //Read register 0FC0 WREG|0FC0 SPI1_Write(0x00); //Bytes to be read - 1 SPI1_Write(0xFF); pin_HI(ChipSelect); pin_LO(ChipSelect); SPI1_Write(0x25); //Read register OFC1 WREG|OFC1 SPI1_Write(0x00); //Bytes to be read - 1 SPI1_Write(0xFF); pin_HI(ChipSelect); pin_LO(ChipSelect); SPI1_Write(0x26); //Read register OFC2 WREG|OFC2 SPI1_Write(0x00); //Bytes to be read - 1 SPI1_Write(0xFF); pin_HI(ChipSelect); pin_LO(ChipSelect); SPI1_Write(0x2C); //Read register GPIOCFG WREG|GPIOCFG SPI1_Write(0x00); //Bytes to be read - 1 SPI1_Write(0xFF); pin_HI(ChipSelect); pin_LO(ChipSelect); SPI1_Write(0x2D); //Read register GPIODIR WREG|GPIODIR SPI1_Write(0x00); //Bytes to be read - 1 SPI1_Write(0xFF); pin_HI(ChipSelect); pin_LO(ChipSelect); SPI1_Write(0x2E); //Read register GPIODAT WREG|GPIODAT SPI1_Write(0x00); //Bytes to be read - 1 SPI1_Write(0xFF); pin_HI(ChipSelect); I checked the answer of the RREG commands and the registers seems to be correct settep up now :) Now I am recieving data which is not anymore jumping to 0xFF all the time and is stable. But in the second when i touch my PT100 it changes the value to 0xFFFF. Could it be that this has to do something with the gain of the PGA ? I am using 820 ohm resistor with 1% as a reference. I am reading out the data with a function wich is triggered on the DRDY output of the ADS1248 when it changes the state. Could it be that i need to trigger the function only on high states so I need to check if the DRDY changes from Low to High state ? Right now I am using in the function to get the data only 3 NOP'S, is it necessary to use the RDATAC command ? pin_LO(ChipSelect); spi1_ReadBlock(str_Ptr(rawdata), 3);//read 3 bytes from SPI and store it in the array rawdata pin_HI(ChipSelect); I added low pas filters on the reference inputs and also on the PT100 inputs i added the shematic: (Please visit the site to view this file) I checked the application note for the filter you refered me. I dont understand it completely but it was written that the cut of frequencies should differ not so much between the filter of the Analog input and the reference input. I tried the values in the example and i calculated for the -3dB cutoff frequencie: analog input f(80°)=255,6Hz and f(-20°)=256,4Hz and for the reference input 288,4Hz. Is it possible to use this values ? best regards

Viewing all articles
Browse latest Browse all 27325

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>