"AT+ADC?" processing


#1

I am using the Q2687 on Fastrack supreme. i connect the output voltage of a temperature sensor to the AUX-ADC.
I use the command :
adl_atCmdCreate(“AT+ADC?”, FALSE, (adl_atRspHandler_t)ADCHandler, “+ADC:”, NULL);

and in the handler:
void ADCHandler(adl_atResponse_t *param)
i print the param->StrData on the UART. I get the following result:
+ADC: 3944,0,817,655.
817 is the 817millivolts i connected to the AUX-ADC. I want to get this value from the string, convert it to volts by dividing by 1000 and then i have to use a certain formula to convert it to degrees celsius. Can someone tell me how to extract the 817 from the param->StrData string.


#2

This is just a standard string-parsing exercise:

  • Reading from the left, the number you require is between the 2nd and 3rd commas;
  • If you prefer to read from the right, it’s between the 1st and 2nd commas.

Alternatively, look at the string functions specifically for processing AT Comands & responses listed in the “Basic Features” section of the ADL User Guide


#3

I’ve looked at the AT strings service i am confused between the adl_strGetIDExt function and the adl_strGetResponseExt function. which one do i have to use?


#4

That’s not the “Basic Features”, though - is it?

I mean the wm_str… functions

As I said, it’s just a standard string-parsing exercise - so you don’t have to use anything special at all beyond the standard features of the ‘C’ programming language and its standard library…


#5

Can i use this function ?

/***************************************************************/
/
Function : wm_strGetParameterString /
/
-------------------------------------------------------------------------
/
/
Object : Returns the parameter string at Position /
/
/
/
Return : ascii * NULL if not found /
/
Address of the begin of string parameter /
/
/
/
-------------------------------------------------------------------------
/
/
Variable Name |IN |OUT|GLB| Utilisation /
/
--------------------±–±--±–±---------------------------------------
/
/
dst | | x | | String to return /
/
--------------------±–±--±–±---------------------------------------
/
/
src | x | | | String to analyse /
/
--------------------±–±--±–±---------------------------------------
/
/
Position | x | | | Parameter position /
/
--------------------±–±--±–±---------------------------------------
/
/***************************************************************************/
ascii * wm_strGetParameterString ( ascii * dst, const ascii * src, u8 Position );

#endif /* WM_STDIO_H */


#6

Does the description fit your requirement?

Have you looked at the examples in the ADL User Guide?