ADC_Get_Sample not working anymore

General discussion on mikroBasic PRO for AVR.
Post Reply
Author
Message
robert_d1968
Posts: 145
Joined: 14 Nov 2012 00:30
Location: China
Contact:

ADC_Get_Sample not working anymore

#1 Post by robert_d1968 » 11 Jul 2018 09:38

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

User avatar
petar.suknjaja
mikroElektronika team
Posts: 683
Joined: 05 Mar 2018 09:44
Location: Belgrade

Re: ADC_Get_Sample not working anymore

#2 Post by petar.suknjaja » 13 Jul 2018 09:10

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

robert_d1968
Posts: 145
Joined: 14 Nov 2012 00:30
Location: China
Contact:

Re: ADC_Get_Sample not working anymore

#3 Post by robert_d1968 » 14 Jul 2018 09:11

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.
Attachments
mikro_code.zip
(51.57 KiB) Downloaded 115 times

User avatar
petar.suknjaja
mikroElektronika team
Posts: 683
Joined: 05 Mar 2018 09:44
Location: Belgrade

Re: ADC_Get_Sample not working anymore

#4 Post by petar.suknjaja » 24 Jul 2018 16:22

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

Post Reply

Return to “mikroBasic PRO for AVR General”