Hi guys,
i am trying to read the values of a ultrasonic sensor using tms570lc4357 .It is a 3 pin ultrasonic sensor .
This is my code
int main(void)
{
/* USER CODE BEGIN (3) */
int q,n;
sciInit();
adcInit();
adcData_t p;
while(1)
{
adcStartConversion(adcREG1,adcGROUP1);
adcGetData(adcREG1,1U,&p);
q=(unsigned int)p.value;
n=ltoa(q, (unsigned char*)command);
sciSend(sciREG1, 8, (unsigned char *)"VALUE = ");
sciSend(sciREG1, n, command);
sciSend(sciREG1, 2, (unsigned char *)"\r\n");
}
The ultrasonic is connected to adin_26 pin on the board and i have enables adc and sci in halcogen. I have assigned a FIFO size of 1 bit and data resolution of 8 bits. Adc trigger event is set at rising edge and the trigger mode is hardware mode and the HW trigger source is event.
I am not able to find out the mistakes.