PHP код:
// lcd pins connected to corresponding lcd pins
#define RS (4)
#define RESET (17)
#define CS (16)
#define CLK (13)
#define DAT (11)
void setup() {
// set output pins
pinMode(RESET, OUTPUT);
digitalWrite(RESET,LOW);
pinMode(CS, OUTPUT);
digitalWrite(CS,HIGH);
pinMode(RS, OUTPUT);
pinMode(CLK, OUTPUT);
pinMode(DAT, OUTPUT);
/**************************
*
* init starts here
*
**************************/
delay(100); // wait a bit for everything to settle down... who knows
digitalWrite(CS, HIGH);
digitalWrite(RS, HIGH);
digitalWrite(RESET, LOW);
delay(50);
digitalWrite(RESET, HIGH);
delay(50);
digitalWrite(CS,LOW);
unsigned char LCD_init_masiv[70][3] ={
{0x74,0x00,0x00}, //1 block
{0x76,0x00,0x01},
{0x74,0x00,0x07},
{0x76,0x00,0x00},
{0x74,0x00,0x02},
{0x76,0x04,0x00},
{0x74,0x00,0x04},
{0x76,0x00,0x00},
{0x74,0x00,0x0C},
{0x76,0x00,0x01},
{0x74,0x00,0x0D},
{0x76,0x06,0x16},
{0x74,0x00,0x1E},
{0x76,0x10,0x10}, //2 block
{0x74,0x00,0x03},
{0x76,0x00,0x0C},
{0x74,0x00,0x0E},
{0x76,0x2D,0x1F},
{0x74,0x00,0x0D},
{0x76,0x06,0x16},
{0x74,0x00,0x01},
{0x76,0x02,0x15},
{0x74,0x00,0x0F},
{0x76,0x00,0x00},
{0x74,0x00,0x0B},
{0x76,0x00,0x00},
{0x74,0x00,0x11},
{0x76,0x00,0x00}, //3 block
{0x74,0x00,0x06},
{0x76,0x00,0x00},
{0x74,0x00,0x05},
{0x76,0x00,0x30},
{0x74,0x00,0x14},
{0x76,0xAF,0x00},
{0x74,0x00,0x15},
{0x76,0x00,0x00},
{0x74,0x00,0x16},
{0x76,0x83,0x00},
{0x74,0x00,0x17},
{0x76,0xAF,0x00},
{0x74,0x00,0x20},
{0x76,0x00,0x00}, //4 block
{0x74,0x00,0x30},
{0x76,0x00,0x00},
{0x74,0x00,0x31},
{0x76,0x04,0x00},
{0x74,0x00,0x32},
{0x76,0x02,0x07},
{0x74,0x00,0x33},
{0x76,0x07,0x00},
{0x74,0x00,0x34},
{0x76,0x00,0x05},
{0x74,0x00,0x35},
{0x76,0x07,0x03},
{0x74,0x00,0x36},
{0x76,0x07,0x07}, //5 blocl
{0x74,0x00,0x37},
{0x76,0x00,0x07},
{0x74,0x00,0x3A},
{0x76,0x12,0x00},
{0x74,0x00,0x3B},
{0x76,0x00,0x09},
{0x74,0x00,0x07},
{0x76,0x00,0x05},
{0x74,0x00,0x07},
{0x76,0x00,0x25},
{0x74,0x00,0x07},
{0x76,0x00,0x27},
{0x74,0x00,0x07},
{0x76,0x00,0x37}
};
int i;
for(i=0;i<=69;i++){
shiftOut(DAT, CLK, MSBFIRST, (LCD_init_masiv[i][0] >> 8));
shiftOut(DAT, CLK, MSBFIRST, LCD_init_masiv[i][0]);
shiftOut(DAT, CLK, MSBFIRST, (LCD_init_masiv[i][1] >> 8));
shiftOut(DAT, CLK, MSBFIRST, LCD_init_masiv[i][1]);
shiftOut(DAT, CLK, MSBFIRST, (LCD_init_masiv[i][2] >> 8));
shiftOut(DAT, CLK, MSBFIRST, LCD_init_masiv[i][2]);
}
// were done, display doesnt need to listen anymore
digitalWrite(CS, HIGH);
pinMode(13, OUTPUT);
}
void loop() {
// blink onboard led to signal end of init
digitalWrite(13,HIGH);
delay(250);
digitalWrite(13,LOW);
delay(250);
}
У меня Arduino UNO, питание для подсветки беру внешнее 10В, а для питания самого дисплея эти же 10В через стабилизатор 3,3В. Согласование с Arduino через делители.