From 3ddf43156ecd0e1268ff4a471a7d12550fc1fbaf Mon Sep 17 00:00:00 2001 From: "Daniele Verducci (ZenPenguin)" Date: Sun, 29 Nov 2020 12:29:54 +0100 Subject: [PATCH] Maybe found bug in arduino terminal --- arduino/arduino_terminal/arduino_terminal.ino | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/arduino/arduino_terminal/arduino_terminal.ino b/arduino/arduino_terminal/arduino_terminal.ino index acee5c5..d8a281c 100644 --- a/arduino/arduino_terminal/arduino_terminal.ino +++ b/arduino/arduino_terminal/arduino_terminal.ino @@ -39,13 +39,12 @@ void loop() { } void onClk() { - if (PINB & B00000100 == B00000100) { // If EN is HIGH (clock pulse finished) - // Clock pulse finished, return to high impedance state - DDRD = B00000010; - DDRB = B00000000; - } else { + // In any case, return to high impedance state + DDRD = B00000010; + DDRB = B00000000; + if (PIND & B00000100 == B00000000) { // EN is LOW: Clock pulse started - if (PIND & B00001000 == B00001000) { // WR is HIGH (Pat80 wants to Read (we send data)) + if (PINB & B00001000 == B00001000) { // WR is HIGH (Pat80 wants to Read (we send data)) DDRD = DDRD | B11111000; // Port D (arduino pins 3 to 7) is output. In or to preserve serial pins and interrupt pin DDRB = B00000111; // Port B (0,1,2) = pins 8,9,10 output // Split byte to two parts