PORTB,C,D Statements Dont compile

the below code lines w/PORT registers were compiling earlier and stopped compiling today and throwing errors: for the nano every board compilation. any help appreciated...

PORTB.DIR = 0x07 ;
PORTB.OUT = 0x0 ;

PORTC.DIR = 0x40 ;
PORTC.OUT = 0x0 ;

PORTD.DIR = 0x07 ;
PORTD.OUT = 0x0 ;

Did you change the emulation from None (ATMEGA4809) to ATMEGA328? Below compiles for "No emulation"

void setup()
{
  PORTB.DIR = 0x07 ;
  PORTB.OUT = 0x0 ;

  PORTC.DIR = 0x40 ;
  PORTC.OUT = 0x0 ;

  PORTD.DIR = 0x07 ;
  PORTD.OUT = 0x0 ;
}

void loop()
{
}

but throws an error when using the "328 emulation"

/tmp/arduino_modified_sketch_765088/sketch_mar21b.ino: In function 'void setup()':
sketch_mar21b:3:9: error: 'class PORTBClass' has no member named 'DIR'
   PORTB.DIR = 0x07 ;
         ^~~
sketch_mar21b:4:9: error: 'class PORTBClass' has no member named 'OUT'
   PORTB.OUT = 0x0 ;
         ^~~
sketch_mar21b:6:9: error: 'class PORTCClass' has no member named 'DIR'
   PORTC.DIR = 0x40 ;
         ^~~
sketch_mar21b:7:9: error: 'class PORTCClass' has no member named 'OUT'
   PORTC.OUT = 0x0 ;
         ^~~
sketch_mar21b:9:9: error: 'class PORTDClass' has no member named 'DIR'
   PORTD.DIR = 0x07 ;
         ^~~
sketch_mar21b:10:9: error: 'class PORTDClass' has no member named 'OUT'
   PORTD.OUT = 0x0 ;
         ^~~
exit status 1
'class PORTBClass' has no member named 'DIR'

PS
Next time, please post the error messages that you get.

See: Nano Every Board - TCB1 timer as I/P Pulse width Measurement Mode from Pin D3/Port PF5 - #12 by bbenji74

this worked now, but, how did the settings change on my projects on its own? very strange

I do not know. Maybe user error (you accidentally clicked it); that often happens to me when I use a mouse and don't pay enough attention. Maybe a board package update; you should be able to test that by downgrading/upgrading the package. Maybe a bug in the IDE.

I posted this question myself, I was referred to this:

No, you can’t protect yourself from updates like this.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.