-
First attempt to drive the LCD
04/23/2017 at 08:27 • 0 commentsThe screen needs a -18V power supply for the LCD and 5V for the logic, so I'm using one from a DVD player.
After connecting the power supply, the display resurrected and showed some noise
The very first arduino code used digitalWrite, it was extremely slow, so after investigating about using the ATMega328 registers I came up with this code:
#define S_LOW (PORTB&=(~(1<<5))); #define S_HIGH (PORTB|=(1<<5)); #define CP1_LOW (PORTB&=(~(1<<1))); #define CP1_HIGH (PORTB|=(1<<1)); #define CP2_LOW (PORTB&=(~(1<<0))); #define CP2_HIGH (PORTB|=(1<<0)); void setup() { pinMode(13,OUTPUT); // S pinMode(9,OUTPUT); //CP1 pinMode(8,OUTPUT);//CP2 //Only 2 out of 4 pixels should be drawn analogWrite(3,200); analogWrite(4,200); } void loop() { S_HIGH CP1_HIGH asm("nop");asm("nop"); CP1_LOW asm("nop");asm("nop"); S_LOW for(int y=0;y<240;y++){ CP1_HIGH asm("nop");asm("nop"); CP1_LOW for(int bx=0;bx<80;bx++){//4 pixel block CP2_HIGH asm("nop");asm("nop"); //send pixels here CP2_LOW asm("nop");asm("nop"); } } }
Great, it shows 2 pixels per block as expected, but I need to figure out why some lines are missing (maybe EMI?)
So that's all for today, next task: Fill the entire screen with pixels and then map an array to the screen.