Following up on this thread .. Panasonic R191 I have a similar printer that needs a similar interface. In trying to validate the protocol, I've managed to get this far. But something still isn't right/complete. Could it be a parity bit missing?
Code
void write_byte(char b) {
int bits = 8;
int ackbit = 0;
int timeout = 0;
//state = LOW; // Set flag
while(digitalRead(ACK_IN) == LOW); // Wait until it is high
digitalWrite(CS_OUT, LOW);
delay(1);
while(bits--) {
digitalWrite(DAT_OUT, ( b >> (8-bits) & 0x01 ) ? HIGH : LOW );
delay(10);
while(digitalRead(ACK_IN) == LOW); // Wait until it is high
digitalWrite(CLK_OUT, HIGH);
while(digitalRead(ACK_IN) == HIGH); // Wait until it is LOW
delay(5);
digitalWrite(CLK_OUT, LOW);
while(digitalRead(ACK_IN) == LOW); // Wait until it is high
}
digitalWrite(CS_OUT, HIGH);
delay(10);
}
Alles anzeigen