[quote:8a509126eb="pgill"]...because i couldnt find any in both: the datasheet and the helpfile.[/quote:8a509126eb]
The helpfile called by F1 differs slightly from the Bascavr.pdf in Bascom's pdf-folder within Bascom's home-directory.
I prefer the pdf, as I feel it's easier to look things up.
But both sources quote:
[quote:8a509126eb]The ADCSRB register contains a bit named MUX5 that must be set when a channel higher then 7 is used. The compiler (lib routine) will handle this automatic. This is true for new chips like Mega1280, Mega2560 and probably other new chips with 100 pins.[/quote:8a509126eb]
In the ATMega32U4 datasheet it's under Analog to Digital Converter --> ADC Register Description.
That means, if the ATMegaU4 doesn't belong to above mentioned chips, you can't address single ended channel 9 with GetADC(9), instead you have to set MUX5.
Normally it can be done this way, also from the help:
[code:1:8a509126eb]W = Getadc(1, 32)[/code:1:8a509126eb]
If that won't work for you, try this:
[code:1:8a509126eb]ADCSRB.MUX5 = 1
W = GetADC(1)[/code:1:8a509126eb]
You also have the option to try it out in the simulator and look up the registers ADMUX and ADCSRB, then you'll see what happens.
I use also AVR-Studio for that purpose.
↧