Hi, am new to ATXmega as I am playing around with the atxmega256au. I intend controlling (open and close by input) of some SSR relay connected each to Port F of the microcontroller. This is a rough code belwo. Would love to know if am on the right track.

```
int main()
{
DDRF = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6);
int i;
scanf("%d",i);
switch (i) {
case 1.2:
PORTF = (1<<0)|(0<<1)|(0<<2)|(0<<3)|(0<<4)|(0<<5)|(0<<6);
break;
case 120:
PORTF = (0<<0)|(1<<1)|(0<<2)|(0<<3)|(0<<4)|(0<<5)|(0<<6);
break;
case 12:
PORTF = (0<<0)|(0<<1)|(1<<2)|(0<<3)|(0<<4)|(0<<5)|(0<<6);
break;
case 1.2:
PORTF = (0<<0)|(0<<1)|(0<<2)|(1<<3)|(0<<4)|(0<<5)|(0<<6);
break;
case 120:
PORTF = (0<<0)|(0<<1)|(0<<2)|(0<<3)|(1<<4)|(0<<5)|(0<<6);
break;
case 12u:
PORTF = (0<<0)|(0<<1)|(0<<2)|(0<<3)|(0<<4)|(1<<5)|(0<<6);
break;
case 1.2uA:
PORTF = (0<<0)|(0<<1)|(0<<2)|(0<<3)|(0<<4)|(0<<5)|(1<<6);
break;
default:
printf("no such selection");
}
return o;
}
```

```
int main()
{
DDRF = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6);
int i;
scanf("%d",i);
switch (i) {
case 1.2:
PORTF = (1<<0)|(0<<1)|(0<<2)|(0<<3)|(0<<4)|(0<<5)|(0<<6);
break;
case 120:
PORTF = (0<<0)|(1<<1)|(0<<2)|(0<<3)|(0<<4)|(0<<5)|(0<<6);
break;
case 12:
PORTF = (0<<0)|(0<<1)|(1<<2)|(0<<3)|(0<<4)|(0<<5)|(0<<6);
break;
case 1.2:
PORTF = (0<<0)|(0<<1)|(0<<2)|(1<<3)|(0<<4)|(0<<5)|(0<<6);
break;
case 120:
PORTF = (0<<0)|(0<<1)|(0<<2)|(0<<3)|(1<<4)|(0<<5)|(0<<6);
break;
case 12u:
PORTF = (0<<0)|(0<<1)|(0<<2)|(0<<3)|(0<<4)|(1<<5)|(0<<6);
break;
case 1.2uA:
PORTF = (0<<0)|(0<<1)|(0<<2)|(0<<3)|(0<<4)|(0<<5)|(1<<6);
break;
default:
printf("no such selection");
}
return o;
}
```

```
int main()
{
DDRF = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6);
int i;
scanf("%d",i);
switch (i) {
case 1.2:
PORTF = (1<<0)|(0<<1)|(0<<2)|(0<<3)|(0<<4)|(0<<5)|(0<<6);
break;
case 120:
PORTF = (0<<0)|(1<<1)|(0<<2)|(0<<3)|(0<<4)|(0<<5)|(0<<6);
break;
case 12:
PORTF = (0<<0)|(0<<1)|(1<<2)|(0<<3)|(0<<4)|(0<<5)|(0<<6);
break;
case 1.2:
PORTF = (0<<0)|(0<<1)|(0<<2)|(1<<3)|(0<<4)|(0<<5)|(0<<6);
break;
case 120:
PORTF = (0<<0)|(0<<1)|(0<<2)|(0<<3)|(1<<4)|(0<<5)|(0<<6);
break;
case 12u:
PORTF = (0<<0)|(0<<1)|(0<<2)|(0<<3)|(0<<4)|(1<<5)|(0<<6);
break;
case 1.2uA:
PORTF = (0<<0)|(0<<1)|(0<<2)|(0<<3)|(0<<4)|(0<<5)|(1<<6);
break;
default:
printf("no such selection");
}
return o;
}
```

```
int main()
{
DDRF = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6);
int i;
scanf("%d",i);
switch (i) {
case 1.2:
PORTF = (1<<0)|(0<<1)|(0<<2)|(0<<3)|(0<<4)|(0<<5)|(0<<6);
break;
case 120:
PORTF = (0<<0)|(1<<1)|(0<<2)|(0<<3)|(0<<4)|(0<<5)|(0<<6);
break;
case 12:
PORTF = (0<<0)|(0<<1)|(1<<2)|(0<<3)|(0<<4)|(0<<5)|(0<<6);
break;
case 1.2:
PORTF = (0<<0)|(0<<1)|(0<<2)|(1<<3)|(0<<4)|(0<<5)|(0<<6);
break;
case 120:
PORTF = (0<<0)|(0<<1)|(0<<2)|(0<<3)|(1<<4)|(0<<5)|(0<<6);
break;
case 12u:
PORTF = (0<<0)|(0<<1)|(0<<2)|(0<<3)|(0<<4)|(1<<5)|(0<<6);
break;
case 1.2uA:
PORTF = (0<<0)|(0<<1)|(0<<2)|(0<<3)|(0<<4)|(0<<5)|(1<<6);
break;
default:
printf("no such selection");
}
return o;
}
```

```
int main()
{
DDRF = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6);
int i;
scanf("%d",i);
switch (i) {
case 1.2:
PORTF = (1<<0)|(0<<1)|(0<<2)|(0<<3)|(0<<4)|(0<<5)|(0<<6);
break;
case 120:
PORTF = (0<<0)|(1<<1)|(0<<2)|(0<<3)|(0<<4)|(0<<5)|(0<<6);
break;
case 12:
PORTF = (0<<0)|(0<<1)|(1<<2)|(0<<3)|(0<<4)|(0<<5)|(0<<6);
break;
case 1.2:
PORTF = (0<<0)|(0<<1)|(0<<2)|(1<<3)|(0<<4)|(0<<5)|(0<<6);
break;
case 120:
PORTF = (0<<0)|(0<<1)|(0<<2)|(0<<3)|(1<<4)|(0<<5)|(0<<6);
break;
case 12u:
PORTF = (0<<0)|(0<<1)|(0<<2)|(0<<3)|(0<<4)|(1<<5)|(0<<6);
break;
case 1.2uA:
PORTF = (0<<0)|(0<<1)|(0<<2)|(0<<3)|(0<<4)|(0<<5)|(1<<6);
break;
default:
printf("no such selection");
}
return o;
}
```

```
int main()
{
DDRF = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6);
int i;
scanf("%d",i);
switch (i) {
case 1.2:
PORTF = (1<<0)|(0<<1)|(0<<2)|(0<<3)|(0<<4)|(0<<5)|(0<<6);
break;
case 120:
PORTF = (0<<0)|(1<<1)|(0<<2)|(0<<3)|(0<<4)|(0<<5)|(0<<6);
break;
case 12:
PORTF = (0<<0)|(0<<1)|(1<<2)|(0<<3)|(0<<4)|(0<<5)|(0<<6);
break;
case 1.2:
PORTF = (0<<0)|(0<<1)|(0<<2)|(1<<3)|(0<<4)|(0<<5)|(0<<6);
break;
case 120:
PORTF = (0<<0)|(0<<1)|(0<<2)|(0<<3)|(1<<4)|(0<<5)|(0<<6);
break;
case 12u:
PORTF = (0<<0)|(0<<1)|(0<<2)|(0<<3)|(0<<4)|(1<<5)|(0<<6);
break;
case 1.2uA:
PORTF = (0<<0)|(0<<1)|(0<<2)|(0<<3)|(0<<4)|(0<<5)|(1<<6);
break;
default:
printf("no such selection");
}
return o;
}
```

```
int main()
{
DDRF = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6);
int i;
scanf("%d",i);
switch (i) {
case 1.2:
PORTF = (1<<0)|(0<<1)|(0<<2)|(0<<3)|(0<<4)|(0<<5)|(0<<6);
break;
case 120:
PORTF = (0<<0)|(1<<1)|(0<<2)|(0<<3)|(0<<4)|(0<<5)|(0<<6);
break;
case 12:
PORTF = (0<<0)|(0<<1)|(1<<2)|(0<<3)|(0<<4)|(0<<5)|(0<<6);
break;
case 1.2:
PORTF = (0<<0)|(0<<1)|(0<<2)|(1<<3)|(0<<4)|(0<<5)|(0<<6);
break;
case 120:
PORTF = (0<<0)|(0<<1)|(0<<2)|(0<<3)|(1<<4)|(0<<5)|(0<<6);
break;
case 12u:
PORTF = (0<<0)|(0<<1)|(0<<2)|(0<<3)|(0<<4)|(1<<5)|(0<<6);
break;
case 1.2uA:
PORTF = (0<<0)|(0<<1)|(0<<2)|(0<<3)|(0<<4)|(0<<5)|(1<<6);
break;
default:
printf("no such selection");
}
return o;
}
```

```
int main()
{
DDRF = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6);
int i;
scanf("%d",i);
switch (i) {
case 1.2:
PORTF = (1<<0)|(0<<1)|(0<<2)|(0<<3)|(0<<4)|(0<<5)|(0<<6);
break;
case 120:
PORTF = (0<<0)|(1<<1)|(0<<2)|(0<<3)|(0<<4)|(0<<5)|(0<<6);
break;
case 12:
PORTF = (0<<0)|(0<<1)|(1<<2)|(0<<3)|(0<<4)|(0<<5)|(0<<6);
break;
case 1.2:
PORTF = (0<<0)|(0<<1)|(0<<2)|(1<<3)|(0<<4)|(0<<5)|(0<<6);
break;
case 120:
PORTF = (0<<0)|(0<<1)|(0<<2)|(0<<3)|(1<<4)|(0<<5)|(0<<6);
break;
case 12u:
PORTF = (0<<0)|(0<<1)|(0<<2)|(0<<3)|(0<<4)|(1<<5)|(0<<6);
break;
case 1.2uA:
PORTF = (0<<0)|(0<<1)|(0<<2)|(0<<3)|(0<<4)|(0<<5)|(1<<6);
break;
default:
printf("no such selection");
}
return o;
}
```

#include <avr/io.h>

int main() {

DDRF = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6);

int i;

scanf("%d",i);

switch (i) {

case 1:

PORTF = (1<<0)|(0<<1)|(0<<2)|(0<<3)|(0<<4)|(0<<5)|(0<<6);

break;

case 12:

PORTF = (0<<0)|(1<<1)|(0<<2)|(0<<3)|(0<<4)|(0<<5)|(0<<6);

break;

case 14:

PORTF = (0<<0)|(0<<1)|(1<<2)|(0<<3)|(0<<4)|(0<<5)|(0<<6);

break;

case 22:

PORTF = (0<<0)|(0<<1)|(0<<2)|(1<<3)|(0<<4)|(0<<5)|(0<<6);

break;

PS: just a rough code