This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/TMS570LS1224: how to read two ADC at a time

Part Number: TMS570LS1224
Other Parts Discussed in Thread: HALCOGEN

Tool/software: Code Composer Studio

Hi,

I already done ADC reading by using in built light sensor which is connected with ADC pin number 6. The value is showing in Serial monitor also using SCI.

Now i want to read two ADC at a time. Like, one ADC is inbuilt light sensor and another one is a 5V analog sensor which is connected with Pin 1 in Hal. Below is the my CCS main code for reading inbuilt light sensor using ADC. What changes i should do for adding one more ADC reading. Please help me on this.

int main(void)
{
/* USER CODE BEGIN (3) */
/* Initialize RTI driver */
gioInit();
rtiInit();
sciInit();

/* Set high end timer GIO port hetPort pin direction to all output */
gioSetDirection(hetPORT1, 0xFFFFFFFF);
/* Enable RTI Compare 0 interrupt notification */

//rtiEnableNotification(rtiNOTIFICATION_COMPARE0);
rtiEnableNotification(rtiNOTIFICATION_COMPARE1);

/* Enable IRQ - Clear I flag in CPS register */
/* Note: This is usually done by the OS or in an svc dispatcher */
_enable_IRQ();
/* Start RTI Counter Block 0 */
rtiStartCounter(rtiCOUNTER_BLOCK0);
// rtiStartCounter(rtiCOUNTER_BLOCK1);

/* Run forever */
while(1);
/* USER CODE END */

return 0;
}


/* USER CODE BEGIN (4) */
void rtiNotification(uint32 notification)
{
adcInit();


/* Toggle GIOB[1] */
gioSetPort(gioPORTB, gioGetPort(gioPORTB) ^ 2);
gioSetPort(gioPORTB, gioGetPort(gioPORTB) ^ 4);


adcData_t adc_data[2];
adcData_t * adc_data_ptr = &adc_data;
unsigned int NumberOfChars, value;
adcStartConversion(adcREG1, adcGROUP1);
while(!adcIsConversionComplete(adcREG1, adcGROUP1));
adcGetData(adcREG1, 1U, adc_data_ptr);
value = (unsigned int)adc_data_ptr->value;
NumberOfChars = ltoa(value, (char *)command);
sciSend(scilinREG, 23, (unsigned char *)"Light sensor value 0x");
sciSend(scilinREG, NumberOfChars, command);
sciSend(scilinREG, 2, (unsigned char *)"\r\n");
//sciReceive(scilinREG, 1, (unsigned char *)&command);


}

void sciNotification(sciBASE_t *sci, unsigned flags)
{
sciSend(sci, 1, (unsigned char *)&command);
sciReceive(sci, 1, (unsigned char *)&command);
}
void esmGroup1Notification(int bit)
{
return;
}
void esmGroup2Notification(int bit)
{
return;
}


/* USER CODE END */