Пример #1
0
void LCD12864::selectCS1(void) {
  digitalWrite(this->EN, 1);   
delayns();
  digitalWrite(this->CSEL1, 1);   
delayns();
  digitalWrite(this->EN, 0);   
}
void LCD12864RSPI::WriteByte(int dat)
{
    digitalWrite(latchPin, HIGH);
    delayns();
    shiftOut(dataPin, clockPin, MSBFIRST, dat);
    digitalWrite(latchPin, LOW);
}
Пример #3
0
void LCD12864::setPins(uint8_t tRS, uint8_t tRW, uint8_t tD7, uint8_t tD6, uint8_t tD5, uint8_t tD4, uint8_t tD3, uint8_t tD2, uint8_t tD1, uint8_t tD0) {
digitalWrite(EN,1);  
delayns();

  digitalWrite(RS, tRS);   
  digitalWrite(RW, tRW);   
  digitalWrite(D7, tD7);   
  digitalWrite(D6, tD6);   
  digitalWrite(D5, tD5);   
  digitalWrite(D4, tD4);   
  digitalWrite(D3, tD3);   
  digitalWrite(D2, tD2);   
  digitalWrite(D1, tD1);   
  digitalWrite(D0, tD0);   
delayns();
  digitalWrite(EN, 0);   
delayns();

}
void LCD12864RSPI::Initialise()
{
    pinMode(latchPin, OUTPUT);     
    pinMode(clockPin, OUTPUT);    
    pinMode(dataPin, OUTPUT);
    digitalWrite(latchPin, LOW);
    delayns();

    WriteCommand(0x30);        //功能设定控制字
    WriteCommand(0x0c);        //显示开关控制字
    WriteCommand(0x01);        //清除屏幕控制字
    WriteCommand(0x06);        //进入设定点控制字
}
Пример #5
0
void LCD12864::Initialise(void) {
this->checkAND[7]= B00000001;
this->checkAND[6]   = B00000010;
this->checkAND[5] = B00000100;
this->checkAND[4]  = B00001000;
this->checkAND[3]  = B00010000;
this->checkAND[2]  = B00100000;
this->checkAND[1]  = B01000000;
this->checkAND[0]  = B10000000;


   pinMode(CSEL1, OUTPUT);    
//   pinMode(this->CSEL2, OUTPUT);    
   pinMode(RS, OUTPUT);     
   pinMode(RW, OUTPUT);    
   pinMode(EN, OUTPUT);     
   pinMode(D0, OUTPUT);      
   pinMode(D1, OUTPUT);    
   pinMode(D2, OUTPUT);   
   pinMode(D3, OUTPUT);      
   pinMode(D4, OUTPUT);      
   pinMode(D5, OUTPUT);      
   pinMode(D6, OUTPUT);      
   pinMode(D7, OUTPUT);      

delayns();
selectCS1();
delayns();



  // 5FH
 setPins(0,0,0,1,0,1,1,1,1,1);
  // 34H
  setPins(0,0,0,0,1,1,0,1,0,0);
//30H
setPins(0,0,0,0,1,1,0,0,0,0);

//01h
setPins(0,0,0,0,0,0,0,0,0,1);

//06h
setPins(0,0,0,0,0,0,0,1,1,0);

//0ch
setPins(0,0,0,0,0,0,1,1,0,0);

//try for gfx
setPins(0,0,1,0,1,1,1,1,1,1);



delayns();
delayns();


 setPins(0,0,0,0,1,1,0,1,0,0); // 8BIT Mode-4 ext gfx mode
setPins(0,0,0,0,0,0,0,0,1,0); // Vertical scroll
//  setPins(0,0,1,0,0,0,0,0,0,0); // SET 0,0

delayns();
delayns();


setPins(0,0,1,0,0,0,0,0,0,0); // SET DDRAM Y
setPins(0,0,1,0,0,0,0,0,0,0); // SET DDRAM X

// Clear the Screen



for (int j = 128; j <= 160; j++) {
for (int i = 0; i <= 256; i+=8) {
  setPins(1,0,0,0,0,0,0,0,0,0);
}

VectorConverter(j); // lets get the binary from the dec
setPins(0,0,this->temp[0],this->temp[1],this->temp[2],this->temp[3],this->temp[4],this->temp[5],this->temp[6],this->temp[7]); // SET DDRAM Y
setPins(0,0,1,0,0,0,0,0,0,0); // SET DDRAM X


}

this->currentXpos = 0; // Starting coordinate lEFT of screen
this->currentYpos = 128; // // Starting coordinate TOP of screen



}