Skip to content

Instantly share code, notes, and snippets.

@avr-programmierung
Created May 14, 2019 09:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save avr-programmierung/9dbea7d84cfd67df8971e48d3c5fabc4 to your computer and use it in GitHub Desktop.
Save avr-programmierung/9dbea7d84cfd67df8971e48d3c5fabc4 to your computer and use it in GitHub Desktop.
ATmega88 @ 8MHz 10
/* code010.c ATmega88 @ 8MHz */
#include <avr/io.h>
uint8_t x=7, y;
int main(void)
{
/*** Hier die Abfrage in der „Normalform“ ***/
if( (x <= 6) || (x >= 8) ) // Wenn x <= 6 ODER x >= 8 --> also wenn x != 7
{
y = 1; // y = 1, wenn x != 7
}
else
{
y = 2; // y = 2, wenn x = 7
}
/*** Hier die Abfrage in der Kurzschreibweise ***/
y = ( (x <= 6)||(x >= 8) ) ? 1:2; // Ist x <= 6 ODER x >= 8 ? Wenn ja,dann y=1, ansonsten y=2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment