Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Arduino Mega2560 and GetADC() with Channel 8 to 15

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-ARDUINO
View previous topic :: View next topic  
Author Message
Micha

Bascom Member



Joined: 03 Oct 2006
Posts: 57

germany.gif
PostPosted: Fri Apr 03, 2015 7:49 pm    Post subject: Arduino Mega2560 and GetADC() with Channel 8 to 15 Reply with quote

Hello

I use BascomAVR in Version 2.0.7.8 (Fullversion).
Now I testing Arduino Mega2560 Board with bascom and have found out a misstake about GetADC.

In Bascom-Help is written to use the Command GetADC(0,32) then read ADC on channel 8.
The Value 32 is the Offset for channel 8 an Single-End ADC.

But this Command does not work. Only GetADC(32) read the ADC in Single-End Mode.

Could it be that there is the help not correct?
Or does the Command GetADC(Channel,[Offset]) not work?

The Command GetADC(channel,Offset) does not set the MUX-Bit 5 in ADCSRB.3.

Thanks for Info!

Micha.
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5921
Location: Holland

blank.gif
PostPosted: Fri Apr 03, 2015 9:31 pm    Post subject: Reply with quote

it appears to be a bug. but i will check it. getadc() started with chips that had only 8 channels. later other options were added like with the offset. but the offset was too hard to use for some. so later an option was added to use one channel parameter for all modes. so without checking, i think they both work. i did look and see you get different result indeed. so i will check it. could be a problem in the dat file too.
_________________
Mark
Back to top
View user's profile Visit poster's website
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5921
Location: Holland

blank.gif
PostPosted: Fri Apr 03, 2015 9:49 pm    Post subject: Reply with quote

i checked it and it is indeed a bug. you get it for normal AVR when using the offset with numeric values when the mux5 bit must be set (m1280,m2560). i changed it.
_________________
Mark
Back to top
View user's profile Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-ARDUINO All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum