Posted: Sat Dec 04, 2021 6:48 pm Post subject: Re: Attiny 417 output failure
nobner wrote:
finally i found the solution:
It is the name of the variable "RED_PAU".
Which is truly nonsense.
Quote:
When i replace it with some other name (like "nonsense", or any other name), programm works bug-free.
I've compiled two - except different names RED_PAU & nonsense - otherwise identical versions of your code, the resulting hex-files were identical included the last byte.
Alas you did not tell the truth.
If you had posted not shreds but complete code, one would have been able to notice that you not only replace, but instead you've additionally dim'd a new variable called "nonsense".
And this in fact did the trick.
You did not read the help:
Quote:
GETADC
Syntax Xtiny
var = GETADC()
var = GETADC(channel)
var = GETADC(ADC , channel)
Var
The variable that is assigned with the A/D value. This should be a Word or other 16 bit variable.
It was simply a memory overrun, the high byte of GetADC for white overwrote Red_PAU.
The additionally dim'd "nonsense" was unaffected, because RED_PAU acted as buffer and made you believe the name-giving was the culprit.
Dimension all ADC-values as Word or integer as required and you're good.
for normal AVR the data type is not important but for xmega/xtiny it has to be a word/integer because the target variable is assigned using a pointer.
i will add a warning. _________________ Mark
Posted: Fri Dec 10, 2021 4:30 pm Post subject: Attiny 417 output failure
@MWS: Yes, you are right, now RED_PAU works also - thank's for explanation.
I didn't realize, that using "word"-variables is necessary, although i'm using the ADC in 8-bit mode.
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