This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

adc module with lpc2148

hi

i am using ads1255 module with lpc2148 

i can able to configure spi and it is checked with loop test

now i am sending commands to register with data for baudrate from uC to ads module and it is setting and configured

i have then checked the number of samples in data ready pin and it is changed

now i am reading baudrate value from register and it is working only sometimes and unpredictable

so having doubt in initial configurations

please anyone send sample code with someother uC also

I am attaching my code for reference

void ads_1255_channel_function(void)

{

//    SPI_WriteByte(ADS125X_CMD_RESET);DelayMicro(100);//    SPI_WriteByte(ADS125X_CMD_SDATAC);DelayMicro(100);

    ADS125X_DRDY_Wait();

              spiTx[0] = (ADS125X_CMD_WREG|ADS125X_REG_MUX);// 1st command byte

              spiTx[1] = 0;// 2nd command byte = bytes to be read -1

    spiTx[2] = (ADS125X_MUXP_AIN4|ADS125X_MUXN_AIN0);

    SPI_WriteByte(spiTx[0]);DelayMicro(1);

    SPI_WriteByte(spiTx[1]);DelayMicro(1);

    SPI_WriteByte(spiTx[2]);DelayMicro(10);

}

void ads_1255_channel_read_function(void)

{

    ADS125X_DRDY_Wait();

    SPI_WriteByte(ADS125X_CMD_SYNC);DelayMicro(10);

    ADS125X_DRDY_Wait();

    SPI_WriteByte(ADS125X_CMD_WAKEUP);DelayMicro(40);   

              spiTx[0] = ADS125X_CMD_RDATA; // 1st command byte

              spiTx[1] = 0;// 2nd command byte = bytes to be read -1

    ADS125X_DRDY_Wait();

    SPI_WriteByte(spiTx[0]);DelayMicro(10);

    ADS125X_DRDY_Wait();

    SPI_WriteByte(spiTx[1]);DelayMicro(10);

    data_rate_u8=SPI_ReadByte();DelayMicro(10);

    sprintf(ext_int_str,"%05x",data_rate_u8);

    LedDisplay(ext_int_str,0,0);Delay1sec(2);

}

Thanks

R Sridhar