I just started using the nano every. I'm using Arduino 1.8.13 on Windows 10 x64.
I'm using the Arduino to read a shift register with the following bit of code:
bitWrite(PORTA,1,1);
bitWrite(PORTA,1,0);
for (int x=0;x<=7;x++) {
bitWrite(j1And3Data,x,bitRead(PORTD, 3));
PORTE = PORTE | 0b00001111;
PORTE = PORTE & 0b11110000;
}
Serial.println(j1And3Data, BIN);
It's giving me the following error message
no match for 'operator|' (operand types are 'PORT_t {aka PORT_struct}' and '')
So it's upset about the PORTE line, this code worked just fine on an UNO and I made sure to update my PORT letters to the correct ones for the Nano Every. I have tried this with register emulation turned on and turned off. I haven't been able to find much in the way of documentation for reading the pin on the ATMega4809, but clearly I'm doing something wrong.
I'm using digital pin 7 as my latch, so I set it high then low to store the current inputs. Then I read all eight bits from the shift register, using the data line (D14/A0), and pulsing my clock line after each read (digital pin 8).
Here is my full code:
uint8_t CtrlLatchPin = 7; // Global Latch Output pin for reading data from Controller
uint8_t j1ClockPin = 8; // Clock pulse Output Pin for Controller 1
uint8_t j1DataPin = 14; // Data Input pin from Controller 1
void setup() {
Serial.begin(115200);
// Configure Pin Modes
pinMode(CtrlLatchPin, OUTPUT);
pinMode(j1ClockPin, OUTPUT);
pinMode(j1DataPin, INPUT_PULLUP);
}
void loop() {
bitWrite(PORTA,1,1);
bitWrite(PORTA,1,0);
for (int x=0;x<=7;x++) {
bitWrite(j1And3Data,x,bitRead(PORTD, 3));
PORTE = PORTE | B00001111;
PORTE = PORTE & B11110000;
}
Serial.println(j1And3Data, BIN);
}