- Sun Nov 30, 2008 4:14 am
#60268
Random wrote:screen is designed for 2.8V and 5V is above what you really should use but works, 3.3V is a better match and will work fine.
Random wrote:Just to clarify, the comment about 5V refers to the input signals, I wouldn't want to try running the thing on 5V VCC. Your best bet is a 2.8V VCC and a logic level converter or a microchip running at 2.8V, but 3.3V works for VCC and 5V or below works for the input signals. The screen may be damaged over time by this, so if you can go for the closest to 2.8V.
Random wrote:the pins on that small LCD are numbered 1 to 33 going left to right with the screen facing you.
pin3 goes to the 3.3V on the arduino
pin 23 goes to CS which is arduino pin 10
pin 24 goes to MOSI which is arduino pin 11
pin 25 goes to SCK which is arduino pin 13
pin 31 and 32 go to ground
pin 27 is RESET and goes to 3.3V
pin 26 is dclk and goes to ground
you can check that you've got the pins the right way around as 31 and 32 will both be connected to the ground plane (continuous copper section) on the right hand side. the components on the flexible PCB should be facing upwards.
Random wrote: Heya,
I do have the sketch, this one makes a ball bounce around the screen some although it's pretty badly laid out - if you can't make sense of a part of it, just ask.
Code: Select all#define INDEX 0x00 #define DATA 0x02 #define IDBYTE 0x74 unsigned short initcode[] = { 0x00, 0x0001, 0xFFFF, 20, 0x08, 0x0303, 0x02, 0x0500, 0x01, 0x010B, 0x0B, 0x4001, 0x30, 0x0000, 0x31, 0x0000, 0x32, 0x0000, 0x33, 0x0401, 0x34, 0x0707, 0x35, 0x0707, 0x36, 0x0707, 0x37, 0x0104, 0x38, 0x0004, 0x39, 0x0004, 0x41, 0x0280, 0x42, 0x8300, 0x43, 0x9F9F, 0x11, 0x0001, 0x12, 0x0008, 0x13, 0x100E, 0x10, 0x0044, 0x12, 0x0018, 0x40, 0x0000, 0x41, 0x0000, 0x42, 0x5F00, 0xFFFF, 40, 0x13, 0x300C, 0xFFFF, 60, 0x10, 0x4340, 0xFFFF, 100, 0x21, 0x0004, 0x44, 0x8304, 0x45, 0x7F00, 0x07, 0x0205, 0xFFFF, 40, 0x07, 0x0227, 0xFFFF, 1, 0x03, 0x1030, 0x0D, 0x3336, 0x07, 0x1237, 0xFFFF, 0xFFFF, }; void setup() { DDRB = (1<<PB3)|(1<<PB5)|(1<<PB2); SPCR = (1<<SPE)|(1<<MSTR)|(0<<SPR0)|(0<<SPR1); SPSR = (1<<SPI2X); } void transmit( char data ) { SPDR = data; while(!(SPSR & (1<<SPIF))) ; } void write_reg( unsigned short index, unsigned short data ) { PORTB = PORTB & ~(1<<PB2); transmit(IDBYTE|INDEX); transmit(0x00); transmit(index); PORTB = PORTB | (1<<PB2); PORTB = PORTB & ~(1<<PB2); transmit(IDBYTE|DATA); transmit(data>>8); transmit(data); PORTB = PORTB | (1<<PB2); } void loop() { int i, x, y; long int pixel = 0; char out1, out2, pdata; for( i = 0;;i += 2 ) { if( initcode[i] == 0xFFFF && initcode[i+1] == 0xFFFF ) break; if( initcode[i] == 0xFFFF ) delay(initcode[i+1]); else write_reg( initcode[i], initcode[i+1] ); } delay( 10 ); write_reg(0x44, 0x7F00); write_reg(0x45, 0x5F00); write_reg(0x23, 0x0000); write_reg(0x24, 0x0000); write_reg(0x21, 0x0000); PORTB = PORTB & ~(1<<PB2); transmit( IDBYTE|INDEX ); transmit( 0x00 ); transmit( 0x22 ); PORTB = PORTB | (1<<PB2); PORTB = PORTB & ~(1<<PB2); transmit( IDBYTE|DATA ); int a,b,u,v,r,g,bl; a=50; b=30; u=3; v=2; randomSeed(analogRead(0)); for(;;) { i=0; a+=u; b+=v; r=(int)random(0,32); g=(int)random(0,64); bl=(int)random(0,32); if( a<5 || a>121 ) u=-u; if( b<5 || b>89 ) v=-v; for( y = 0; y < 96; y++ ) { for( x = 0; x < 128; x++ ) { if( (x-a)*(x-a) + (y-b)*(y-b) < 49 ) { transmit((r<<3)|(g>>3)); transmit((g<<5)|bl); } else { transmit(0); transmit(0); } } } } PORTB = PORTB | (1<<PB2); delay( 1000 ); pinMode( 13, OUTPUT ); digitalWrite( 13, HIGH ); for(;;) {} pinMode( 13, OUTPUT ); digitalWrite( 13, LOW ); }
Last edited by mrtool on Mon Dec 01, 2008 5:21 am, edited 1 time in total.