Skip to content

Instantly share code, notes, and snippets.

@jboone
Created May 13, 2013 18:50
Show Gist options
  • Save jboone/5570497 to your computer and use it in GitHub Desktop.
Save jboone/5570497 to your computer and use it in GitHub Desktop.
Arduino sketch to manipulate Noritake Graphic DMA parallel interface.
const int pin_led = 13;
const int pin_wr = 8;
const int pin_rdy = 9;
void write_byte(const uint8_t c) {
while( (PINB & 2) == 0 );
PORTB &= 0xfe; // /WR=0
PORTD = c;
PORTB |= 0x01; // /WR=1
__asm("nop");
__asm("nop");
__asm("nop");
//__asm("nop");
//__asm("nop");
//__asm("nop");
}
void setup() {
pinMode(pin_led, OUTPUT);
digitalWrite(pin_led, LOW);
pinMode(0, OUTPUT);
pinMode(1, OUTPUT);
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(pin_wr, OUTPUT);
digitalWrite(pin_wr, HIGH);
pinMode(pin_rdy, INPUT);
write_byte(0x0C);
}
void loop() {
static uint8_t d = 0;
//while( digitalRead(pin_rdy) == LOW );
while(true) {
pinMode(pin_led, HIGH);
/*
write_byte(0x1f);
write_byte(0x28);
write_byte(0x66);
write_byte(0x11);
write_byte(0x80); // xL
write_byte(0x01); // xH
write_byte(0x04); // yL
write_byte(0x00); // yH
write_byte(0x01); // g
*/
write_byte(0x02);
write_byte(0x44);
write_byte(0x00);
write_byte(0x57);
write_byte(0x01);
for(uint_fast16_t x1=0; x1<384; x1+=192) {
write_byte(0x02); // STX
write_byte(0x44);
write_byte(0x00); // DAD
write_byte(0x46);
write_byte(0x00); // aL
write_byte((x1 * 4) >> 8); // aH
write_byte(0x00); // sL
write_byte(0x03); // sH
for(uint_fast16_t x=x1; x<x1+192; x++) {
for(int_fast16_t y=0; y<4; y++) {
write_byte((x + d) & 0xff);
}
}
}
//delay(500);
pinMode(pin_led, LOW);
//delay(500);
d += 1;
}
}
@jboone
Copy link
Author

jboone commented Jul 27, 2020

@the88g I'm sorry, I don't. I haven't touched this project in many years, and it worked fine at the time.

My only thought is you have a performance issue. I was using some form of original Arduino, based on the slow-as-molasses Atmel AVR8 microcontroller. Whatever you're using is probably far faster. This code has no handshaking or throttling, so if it's sending too fast for the panel to accept, the panel will just do random things -- or, quite possibly nothing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment