Other Parts Discussed in Thread: ADS7138
Tool/software:
Hi everyone!
How to Use ADS7138 Autonomous Mode
After following the flowchart on page 25 of the datasheet, I noticed that when I set the threshold value lower than the current input voltage, the ALERT signal does not change. I also checked the EVENT_FLAG register, but no flags were triggered.
Could you please help me check if there is any issue with the following initialization steps? Thank you.
GR,
HC
static void ADS7138_Alert_Test_Init(void) { ads7138RegWrite.pinConfig.u8 = 0x00; ads7138RegWrite.autoSeqChSel.u8 = 0xFF; ads7138RegWrite.sequenceConfig.bits.SEQ_MODE = SET_AUTO; ads7138RegWrite.eventRgn.u8 = 0xFF; ads7138RegWrite.hysteresisCh[0].bits.HYSTERESIS = 0xF; ads7138RegWrite.hysteresisCh[0].bits.H_TH_LSB = 0xF; ads7138RegWrite.highThCh[0].H_TH_MSB = 0xFF; ads7138RegWrite.eventCountCh[0].bits.EVENT_COUNT = 0x00; ads7138RegWrite.eventCountCh[0].bits.L_TH_LSB = 0xD; ads7138RegWrite.lowThCh[0].L_TH_MSB = 0xFA; ads7138RegWrite.hysteresisCh[1].bits.HYSTERESIS = 0xF; ads7138RegWrite.hysteresisCh[1].bits.H_TH_LSB = 0x1; ads7138RegWrite.highThCh[1].H_TH_MSB = 0xAE; ads7138RegWrite.eventCountCh[1].bits.EVENT_COUNT = 0x00; ads7138RegWrite.eventCountCh[1].bits.L_TH_LSB = 0xE; ads7138RegWrite.lowThCh[1].L_TH_MSB =0xA3; ads7138RegWrite.hysteresisCh[2].bits.HYSTERESIS = 0x8; ads7138RegWrite.hysteresisCh[2].bits.H_TH_LSB = 0xF; ads7138RegWrite.highThCh[2].H_TH_MSB = 0x27; ads7138RegWrite.eventCountCh[2].bits.EVENT_COUNT = 0x00; ads7138RegWrite.eventCountCh[2].bits.L_TH_LSB = 0xE; ads7138RegWrite.lowThCh[2].L_TH_MSB = 0x24; ads7138RegWrite.hysteresisCh[3].bits.HYSTERESIS = 0x8; ads7138RegWrite.hysteresisCh[3].bits.H_TH_LSB = 0x8; ads7138RegWrite.highThCh[3].H_TH_MSB = 0x2B; ads7138RegWrite.eventCountCh[3].bits.EVENT_COUNT = 0x00; ads7138RegWrite.eventCountCh[3].bits.L_TH_LSB = 0x0; ads7138RegWrite.lowThCh[3].L_TH_MSB = 0x29; ads7138RegWrite.hysteresisCh[4].bits.HYSTERESIS = 0xA; ads7138RegWrite.hysteresisCh[4].bits.H_TH_LSB = 0xE; ads7138RegWrite.highThCh[4].H_TH_MSB = 0x3A; ads7138RegWrite.eventCountCh[4].bits.EVENT_COUNT = 0x00; ads7138RegWrite.eventCountCh[4].bits.L_TH_LSB = 0xC; ads7138RegWrite.lowThCh[4].L_TH_MSB = 0x35; ads7138RegWrite.hysteresisCh[5].bits.HYSTERESIS = 0xA; ads7138RegWrite.hysteresisCh[5].bits.H_TH_LSB = 0xB; ads7138RegWrite.highThCh[5].H_TH_MSB = 0x5E; ads7138RegWrite.eventCountCh[5].bits.EVENT_COUNT = 0x00; ads7138RegWrite.eventCountCh[5].bits.L_TH_LSB = 0x9; ads7138RegWrite.lowThCh[5].L_TH_MSB = 0x59; ads7138RegWrite.hysteresisCh[6].bits.HYSTERESIS = 0xA; ads7138RegWrite.hysteresisCh[6].bits.H_TH_LSB = 0xE; ads7138RegWrite.highThCh[6].H_TH_MSB = 0x3A; ads7138RegWrite.eventCountCh[6].bits.EVENT_COUNT = 0x00; ads7138RegWrite.eventCountCh[6].bits.L_TH_LSB = 0xC; ads7138RegWrite.lowThCh[6].L_TH_MSB = 0x35; ads7138RegWrite.hysteresisCh[7].bits.HYSTERESIS = 0xF; ads7138RegWrite.hysteresisCh[7].bits.H_TH_LSB = 0xF; ads7138RegWrite.highThCh[7].H_TH_MSB = 0xFF; ads7138RegWrite.eventCountCh[7].bits.EVENT_COUNT = 0x00; ads7138RegWrite.eventCountCh[7].bits.L_TH_LSB = 0xD; ads7138RegWrite.lowThCh[7].L_TH_MSB = 0xFA; ads7138RegWrite.alertChSel.u8 = 0xFF; ads7138RegWrite.alertPinConfig.bits.ALERT_DRIVE = PUSH_PULL; ads7138RegWrite.alertPinConfig.bits.ALERT_LOGIC = ACTIVE_LOW; ads7138RegWrite.opmodeConfig.bits.OSC_SEL = SET_HIGH_SPEED; ads7138RegWrite.opmodeConfig.bits.CLK_DIV = 0x00; ads7138RegWrite.generalConfig.bits.DWC_EN = SET_ENABLE ; ads7138RegWrite.sequenceConfig.bits.SEQ_START = SET_START; ads7138RegWrite.sequenceConfig.bits.SEQ_START = SET_START; ads7138RegWrite.opmodeConfig.bits.CONV_MODE = SET_AUTONOMOUS_MODE; ads7138RegWrite.generalConfig.bits.STATS_EN = SET_ENABLE; ads7138RegWrite.generalConfig.bits.CNVST = 1; TS_ADS7138_HANDLE ads7138TestWrite[ADS7138HANDLESIZE] = { { true, true, ADS7138_SERVICE_WRITE_PIN_CFG }, { true, true, ADS7138_SERVICE_WRITE_AUTO_SEQ_CH_SEL }, { true, true, ADS7138_SERVICE_WRITE_SEQUENCE_CFG }, { true, true, ADS7138_SERVICE_WRITE_EVENT_RGN }, { true, true, ADS7138_SERVICE_WRITE_HYSTERESIS }, { true, true, ADS7138_SERVICE_WRITE_HIGH_TH }, { true, true, ADS7138_SERVICE_WRITE_EVENT_COUNT }, { true, true, ADS7138_SERVICE_WRITE_LOW_TH }, { true, true, ADS7138_SERVICE_WRITE_HYSTERESIS }, { true, true, ADS7138_SERVICE_WRITE_HIGH_TH }, { true, true, ADS7138_SERVICE_WRITE_EVENT_COUNT }, { true, true, ADS7138_SERVICE_WRITE_LOW_TH }, { true, true, ADS7138_SERVICE_WRITE_HYSTERESIS }, { true, true, ADS7138_SERVICE_WRITE_HIGH_TH }, { true, true, ADS7138_SERVICE_WRITE_EVENT_COUNT }, { true, true, ADS7138_SERVICE_WRITE_LOW_TH }, { true, true, ADS7138_SERVICE_WRITE_HYSTERESIS }, { true, true, ADS7138_SERVICE_WRITE_HIGH_TH }, { true, true, ADS7138_SERVICE_WRITE_EVENT_COUNT }, { true, true, ADS7138_SERVICE_WRITE_LOW_TH }, { true, true, ADS7138_SERVICE_WRITE_HYSTERESIS }, { true, true, ADS7138_SERVICE_WRITE_HIGH_TH }, { true, true, ADS7138_SERVICE_WRITE_EVENT_COUNT }, { true, true, ADS7138_SERVICE_WRITE_LOW_TH }, { true, true, ADS7138_SERVICE_WRITE_HYSTERESIS }, { true, true, ADS7138_SERVICE_WRITE_HIGH_TH }, { true, true, ADS7138_SERVICE_WRITE_EVENT_COUNT }, { true, true, ADS7138_SERVICE_WRITE_LOW_TH }, { true, true, ADS7138_SERVICE_WRITE_HYSTERESIS }, { true, true, ADS7138_SERVICE_WRITE_HIGH_TH }, { true, true, ADS7138_SERVICE_WRITE_EVENT_COUNT }, { true, true, ADS7138_SERVICE_WRITE_LOW_TH }, { true, true, ADS7138_SERVICE_WRITE_HYSTERESIS }, { true, true, ADS7138_SERVICE_WRITE_HIGH_TH }, { true, true, ADS7138_SERVICE_WRITE_EVENT_COUNT }, { true, true, ADS7138_SERVICE_WRITE_LOW_TH }, { true, true, ADS7138_SERVICE_WRITE_ALERT_CH_SEL }, { true, true, ADS7138_SERVICE_WRITE_ALERT_PIN_CFG }, { true, true, ADS7138_SERVICE_WRITE_OPMODE_CFG }, { true, true, ADS7138_SERVICE_WRITE_SEQUENCE_CFG }, { true, true, ADS7138_SERVICE_WRITE_GENERAL_CFG }, {false, false, ADS7138_BlankFunc }, {false, false, ADS7138_BlankFunc }, {false, false, ADS7138_BlankFunc }, {false, false, ADS7138_BlankFunc }, {false, false, ADS7138_BlankFunc } };