µTasker Forum
µTasker Forum => NXPTM M522XX, KINETIS and i.MX RT => Topic started by: Faustino on September 11, 2009, 10:40:23 PM
-
Hello
Hi, I want to know how I can configure the ADC for run simultaneously converters A and B with all interrupts disabled, exist a sample code for use de ADC?
Best regards.
-
I am sorry I searched in the forum and I found my answer, I saw the SP7 and ADC topic , and now I am answering how can I configure all the chanels …
and then when I put results.sADC_value[0] y get the value of channel 0 and when I put results.sADC_value[7] y get 7 channel.
-
Hi
Ensure that #define SUPPORT_ADC is active (in app_hw_m5223x.h) to activate ADC support.
Then enable the demo in ADC_Timers.h (assuming V1.4 project) - TEST_ADC
The configuration in fnConfigureADC() shows several possibilities, also with threshold triggers.
If you want it to simply configure and free run, use
ADC_SETUP adc_setup; // interrupt configuration parameters
adc_setup.int_type = ADC_INTERRUPT; // identifier when configuring
adc_setup.int_adc_bit = 0; // ADC bit 0
adc_setup.int_adc_int_type = 0;
adc_setup.int_adc_mode = (ADC_CONFIGURE_ADC | ADC_CONFIGURE_CHANNEL | ADC_SEQUENTIAL_MODE | ADC_SINGLE_ENDED | ADC_LOOP_MODE | ADC_START_OPERATION);
adc_setup.int_adc_speed = (unsigned char)(ADC_SAMPLING_SPEED(5000000));// 5MHz sampling (must be between 100kHz and 5MHz)
fnConfigureInterrupt((void *)&adc_setup); // configure ADC
This configures ADC0 input. The ADC module required will be automatically powered.
To configure other inputs too, repeat with .int_adc_bit set as required.
This will free-run and the result can either be read directly from the ADC registers or collected by calling with
ADC_SETUP adc_setup; // interrupt configuration parameters
ADC_RESULTS results;
adc_setup.int_type = ADC_INTERRUPT; // identifier
adc_setup.int_adc_mode = (ADC_READ_ONLY | ADC_GET_RESULT);
adc_setup.int_adc_bit = 0;
adc_setup.int_adc_result = &results;
fnConfigureInterrupt((void *)&adc_setup);
This collects just the value from ADC0 - to collect all values the mode parameter ADC_ALL_RESULTS can be used.
It is often useful to run the demo in the uTasker simulator so that you can see the low level configuration used with this technique in case you prefer to just use the low level code required.
Regards
Mark
-
Hi Mark
Thanks a lot, this Works perfectly.
Now I have been trying to put the value into the web page but I don’t know exactly how to do it I created a case y: in fnInsertString() function.
I create the variable buffer... into the function
unsigned char buffer[]={"hola"};
case 'y':
{
cPtr=(CHAR *)&buffer[0];
return cPtr;
}
I try it, and put in html file £vy0 and I can’t see the characters hola…
I would like to know how to put the adc value, but first i want to know how it is working, what i am doing wrong?
Best Regards
-
Hi
You should find all details in this thread: http://www.utasker.com/forum/index.php?topic=94.0
Regards
Mark