Page 1 of 1

ADC_Get_Sample not working anymore

Posted: 11 Jul 2018 09:38
by robert_d1968
Hello there, I had a project I did using the ATmega 8L about two years ago.

I had to use:

Code: Select all

   'ADMUX = 0X00    '- Select external reference (Aref), left justify the result and set chanel 0 as default
   'ADCSRA = 0xCE   '- ADC Enable, Start conversion, no auto trigger, Clear interupt flag, enable interupt, pre scaler set to 64 = 125,000 Khz
to set up the ADC for a custom value, then the

Code: Select all

ADC_Get_Sample(0)     '- Acquire analog value from channel 0 (Current Sensor) Max = 0x03FF
Was used to read the adc values with out disrupting ADMUX and ADCSRA settings.

It looks like now the ADC_Get_Sample is used in XMEGA series now.

It no longer works in my project, instead it shows:

Code: Select all

ADC_Init()  ' Initialize ADC module with default settings
and Read_ADC(#) as how to read the ADC.

Well the reason I had to go the original way, was to avoid the use of ADC_Init() as it always messes up my custom ADC settings.

Now that ADC_GET_Sample no longer works for me and ADC_Init() can't be used for it's non suitability, what is left now to use instead of adc_get_sample?

I want to keep the adc setup as it was before and still read it.

Any ideas?

Thanks for any help you can provide,

Robert

Re: ADC_Get_Sample not working anymore

Posted: 13 Jul 2018 09:10
by petar.suknjaja
Hi Robert,

What version of mikroBasic are you using?
Could you send us code for review, or at least the minimum working code that demonstrates the issue?

Kind regards,
Petar

Re: ADC_Get_Sample not working anymore

Posted: 14 Jul 2018 09:11
by robert_d1968
Hello there,

I'm using version 7.0.1 I think it's the newest one...

I will zip up the project and send it to you, where do I send it too?

Thanks,

Robert

Attached to this post is the code that wont read the ADC with ADC_Get_Sample, it's not complete but it should be able to read the ADC values.

Re: ADC_Get_Sample not working anymore

Posted: 24 Jul 2018 16:22
by petar.suknjaja
Hi Robert,

We had some previous project in the queue, I'm really sorry for delayed response.
I will review the code and let you know what I've found out.

Kind regards,
Petar