0 Members and 1 Guest are viewing this topic.
#include <T6963.h>#include <T6963_Commands.h>#define CLK 13#define DAT 12T6963 lcd(240,128,6);void setup() { lcd.Initialize(); lcd.clearCG(); // Clear character generator area lcd.clearGraphic(); // Clear graphic area lcd.clearText(); pinMode(CLK,INPUT); pinMode(DAT,INPUT);}void loop() { for (byte y = 0; y < 128; y +=2){ for (byte x = 0; x < 192; x+=16){ for (byte b = 0; b < 8; b++){ //Grab a byte of pixels. Ideally you would alter the axe side to make this a single read. while (!digitalRead(CLK));{ byte c; c = digitalRead(DAT); c << 1; // shifts the pixel to the next slot. //The necessary clock delay while (digitalRead(CLK)); delayMicroseconds(1); //Needed for a stable connection, you could also use some asm("nop"); } } //This scales it to 2 bytes. byte write0 = (c & 0b10000000); byte write0 = (c & 0b10000000) >> 1; byte write0 = (c & 0b01000000); byte write0 = (c & 0b01000000) >> 1; byte write0 = (c & 0b00100000); byte write0 = (c & 0b00100000) >> 1; byte write0 = (c & 0b00010000); byte write0 = (c & 0b00010000) >> 1; byte write1 = (c & 0b00001000); byte write1 = (c & 0b00001000) >> 1; byte write1 = (c & 0b00000100); byte write1 = (c & 0b00000100) >> 1; byte write1 = (c & 0b00000010); byte write1 = (c & 0b00000010) >> 1; byte write1 = (c & 0b00000001); byte write1 = (c & 0b00000001) >> 1; //This section writes all the bytes, hopefully in the right places. lcd.GraphicGoTo(x,y); lcd.WriteData(write0); lcd.GraphicGoTo(x,y+1); lcd.WriteData(write0); lcd.GraphicGoTo(x+8,y); lcd.WriteData(write1); lcd.GraphicGoTo(x+8,y+1); lcd.WriteData(write1); //lcd.setPixel(x,y,c); //lcd.setPixel(x+1,y,c); //lcd.setPixel(x+1,y+1,c); //lcd.setPixel(x,y+1,c); } }}
u_int16 c = 0;for (byte b = 0; b < 8; b++){ while (!digitalRead(CLK)); c = c << 2; c |= digitalRead(DAT); while (digitalRead(CLK)); delayMicroseconds(1); }c *= 3; //the arduino features an "On-chip 2-cycle multiplier" :)//now the high byte of c is write0 and the low byte is write1
It would be slow as heck if it was sending data over the I/O port though. My custom link protocol can send max 2k every second. A color LCD of 320x240 with a color depth of 8 bits would be 76800 bytes. It would take 38.4 seconds to draw the entire screen. (add the time it would take for the arduino to that)
Well, we're still talking about a 96*64 screen here. That's only 768 bytes.