Announcements

Help us improve the Power & Sensing Selection Guide. Share feedback

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Not applicable
after I use ADC001 to store the analog signal into channel A memory, how do get the data that I have stored?

I like to get the data directly through USB so that I can plot the data to mathlab.

Thanks guys!
0 Likes
5 Replies
Travis
Employee
Employee
First solution authored Welcome! 500 replies posted
Hi,

You can use the below API.


void ChannelA_ISR(void)
{
status_t status;
uint8_t EvtStatus;

status = ADCCH001_GetResultEvtFlag(&ADCCH001_Handle0, &EvtStatus);
if((status == DAVEApp_SUCCESS) && (EvtStatus == 0x01))
{
//Do something
status = ADCCH001_GetResult(&ADCCH001_Handle0, &Result_ChA);

status = ADCCH001_ClearResultEvtFlag(&ADCCH001_Handle0);
IO004_TogglePin(IO004_Handle0); // P1.3

}
}
0 Likes
Not applicable
Travis wrote:
Hi,

You can use the below API.


void ChannelA_ISR(void)
{
status_t status;
uint8_t EvtStatus;

status = ADCCH001_GetResultEvtFlag(&ADCCH001_Handle0, &EvtStatus);
if((status == DAVEApp_SUCCESS) && (EvtStatus == 0x01))
{
//Do something
status = ADCCH001_GetResult(&ADCCH001_Handle0, &Result_ChA);

status = ADCCH001_ClearResultEvtFlag(&ADCCH001_Handle0);
IO004_TogglePin(IO004_Handle0); // P1.3

}
}


sorry for replying back so late.
I'm not sure how/where to get the data after using this API.
Thanks for the reply once again
0 Likes
Travis
Employee
Employee
First solution authored Welcome! 500 replies posted
The ADC result is copied to "Result_ChA". This is a variable you had to create in advance.
0 Likes
Not applicable
int WaveOnOff=1;
int main(void)
{
// status_t status; // Declaration of return variable for DAVE3 APIs (toggle comment if required)

DAVE_Init(); // Initialization of DAVE Apps


while(1)
{

}
return 0;
}

void ERU_ISR (void)
{
uint32_t status;

//Reads Status Flag
status = RD_REG(ERU001_Handle0.ERURegs->EXICON[ERU001_Handle0.InputChannel],ERU_EXICON_FL_Msk , ERU_EXICON_FL_Pos);

if(status)
{
IO004_TogglePin(IO004_Handle0); //Toggle LED P1.0
ERU001_ClearFlag(ERU001_Handle0); // Clears the Status Flag

if(WaveOnOff)
{
DACWG001_Start(&DACWG001_Handle0);
ADC001_EnableBackGroundEvent(&ADC001_Handle0);
WaveOnOff = 0;
}
else
{
DACWG001_Stop(&DACWG001_Handle0);
ADC001_DisableBackGroundEvent(&ADC001_Handle0);
WaveOnOff = 1;
}

}
}

void ChannelA_ISR(void)
{
status_t status;
uint8_t EvtStatus;

status = ADCCH001_GetResultEvtFlag(&ADCCH001_Handle0, &EvtStatus);
if((status == DAVEApp_SUCCESS) && (EvtStatus == 0x01))
{
//Do something
status = ADCCH001_GetResult(&ADCCH001_Handle0, &Result_ChA);

status = ADCCH001_ClearResultEvtFlag(&ADCCH001_Handle0);
IO004_TogglePin(IO004_Handle0); // P1.3

}
}



This is the whole set of Main.c code and these are the errors

../Main.c:57:1: warning: implicit declaration of function 'ADCCH001_GetResultEvtFlag' [-Wimplicit-function-declaration]
../Main.c:57:37: error: 'ADCCH001_Handle0' undeclared (first use in this function)
../Main.c:57:37: note: each undeclared identifier is reported only once for each function it appears in
../Main.c:61:1: warning: implicit declaration of function 'ADCCH001_GetResult' [-Wimplicit-function-declaration]
../Main.c:61:49: error: 'Result_ChA' undeclared (first use in this function)
../Main.c:63:1: warning: implicit declaration of function 'ADCCH001_ClearResultEvtFlag' [-Wimplicit-function-declaration]
make: *** [Main.o] Error 1
0 Likes
Travis
Employee
Employee
First solution authored Welcome! 500 replies posted
Did you actually include the ADC apps? Errors / warning is giving you a hint that these are missing.
0 Likes