‘PORTD’ was not declared in this scope (Nano)

Echoing an earlier topic of similar title, but I am trying to use a Nano BLE to work with a touchscreen that was designed to work with an UNO. The examples that come with it are tuned to that and related processors. And so I try to compile my touchscreen's simplest example and it tells me

‘PORTD’ was not declared in this scope

for the following code:

void Lcd_Writ_Bus(unsigned char d)
 PORTD = (PORTD & B00000011) | ((d) & B11111100); 
 PORTB = (PORTB & B11111100) | ((d) & B00000011); 
 *(portOutputRegister(digitalPinToPort(LCD_WR))) &=  ~digitalPinToBitMask(LCD_WR);
 *(portOutputRegister(digitalPinToPort(LCD_WR)))|=  digitalPinToBitMask(LCD_WR);

So I understand that a newer board/processor is going to be differently organized. How can I translate this operation to be appropriate for my board? And don't worry, I am not afraid of hacking bits.

"Nano" or "Nano Every"?
Ahhh, "Nano BLE".

PORTD is just for the '328-based I/O boards.

The NanoBLE uses a different scheme, P0. and P1. and so on, and they may not have figured 'port manipulation' in the mix.

1 Like

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