Hi Julian!
uint8_t portB = PORTB;
error: initializer element is not constant
Hast du es schon mit Typumwandlung versucht?
uint8_t portb = (uint8_t)PORTB; liefert das gleiche Ergebnis.
Okay. Ich habe einen letzten Lösungsvorschlag. Dann weiß ich auch nicht mehr weiter.
// global
uint8_t portb;
uint8_t* a(void)
{
portb = PORTB;
return &portB;
}
In C ist es nur erlaubt, globale Variablen mit Konstanten zu initialisieren. Ich hoffe, dass ich da keinen Mist erzähle. Warum dein Code dabei Probleme macht, ist mir zwar rätselhaft, aber theoretisch müssten wir das Problem mit obigem Code ja um(ge[1])schifft haben.
MfG H☼psel
[1] Ich find´ sowas witzig. =)
--
"It's amazing I won. I was running against peace, prosperity, and incumbency."
George W. Bush speaking to Swedish Prime Minister unaware a live television camera was still rolling, June 14, 2001
Selfcode: ie:% fl:( br:> va:) ls:& fo:) rl:? n4:& ss:| de:] js:| ch:? sh:( mo:) zu:)
"It's amazing I won. I was running against peace, prosperity, and incumbency."
George W. Bush speaking to Swedish Prime Minister unaware a live television camera was still rolling, June 14, 2001
Selfcode: ie:% fl:( br:> va:) ls:& fo:) rl:? n4:& ss:| de:] js:| ch:? sh:( mo:) zu:)