µTasker Forum
µTasker Forum => NXPTM M522XX, KINETIS and i.MX RT => Topic started by: Faustino on September 25, 2009, 09:04:01 PM
-
Hi Mark
I have a problem with the server. The server breaks down when I use this task especially when I use fnbufferdec function, only work mybe 20 sec and reset the server.
I hope you can help me
Best Regards
this is the code that I am using:
CHAR fabuffer[1];
CHAR *faptrBuffer=fabuffer;
void fnMyFirstTask(TTASKTABLE *ptrTaskTable)
{
int iADC_delay = -1;
ADC_SETUP adc_setup; // interrupt configuration parameters
ADC_RESULTS results;
adc_setup.int_type = ADC_INTERRUPT; // identifier when configuring
adc_setup.int_adc_bit = 0;
adc_setup.int_adc_result = &results;
adc_setup.int_adc_mode = (ADC_READ_ONLY | ADC_GET_RESULT | ADC_ALL_RESULTS);
do {
fnConfigureInterrupt((void *)&adc_setup); // get result
iADC_delay++;
} while (results.ucADC_status[0] == ADC_RESULT_NOT_READY); // 'poll until the result is ready
if (results.ucADC_status[0] != ADC_RESULT_NOT_READY) {
fnDebugMsg("ADC value = ");
faptrBuffer = fnBufferDec((results.sADC_value[0]>>6), 2, faptrBuffer);
fnDebugDec((results.sADC_value[0]>>6), 2);
fnDebugMsg("\r\n");
fnDebugMsg("Wait = ");
fnDebugDec(iADC_delay, 0); // display the wait count value
fnDebugMsg("\r\n");
}
else {
fnDebugMsg("ADC not ready\r\n");
}
}
-
Hi
Could you explain what you mean with "server"? Are you sending the results via Telnet or a serial interface?
How fast is the task being called to perform the measurements? Is it possible that the amount of data is too much for the output to keep up with?
Regards
Mark
-
Thanks for answer me
Sorry I am trying to show the ADC data into the webpage... I am not using serial interface I left this lines because this was the example code that you gave me and works very well. Then I used the ADC example and I tried to convert the value and put in a buffer with the function fnbufferdec, after that I put the buffer in an xml file created in the file http.c. This works fine but only for some seconds, I can see the value once time and then the web page cannot be refresh and in the demo board turn on the Ethernet leds such as link, spd, act.
thank you and I am sorry for my bad english.
Best regards
-
Hi
CHAR fabuffer[1];
Is it a problem with the fact that this buffer is only one byte long and so the result being put into it by fnBufferDec() may well write past the end of the buffer and corrupt something? Try with CHAR fabuffer[20]; which should be long enough for any decimal value.
Regards
Mark