سلام دوستان ، من برای lcd گرافیکی مدل ts12864A-2 یه کتابخونه نوشتم توی keil جواب میده اما روی هدربرد 1768 جواب نمیده!!! کسی میتونه مشکلو پیدا کنه؟
-------------------------
[left]#include <lpc17xx.h>
/////
#include "font.h"

#define DataDir LPC_GPIO2->FIODIR
#define DataSet LPC_GPIO2->FIOSET
#define DataClr LPC_GPIO2->FIOCLR

#define CTRLDir LPC_GPIO0->FIODIR
#define CTRLSet LPC_GPIO0->FIOSET
#define CTRLClr LPC_GPIO0->FIOCLR
/////////////
void delay(int cnt)
{
int c;
for(c=0;c<cnt;c++);
}

/////////////////////
void trigger()
{
LPC_GPIO0->FIOMASK=0x1b;
CTRLSet=0x04;
delay(100);
CTRLClr=0x04;
delay(100);
LPC_GPIO0->FIOMASK=0x00;
}
////////////////////////
void CmdWrite(unsigned char cmd)
{
//CTRLClr=cmd;
CTRLSet=0x00;
DataClr=0xff;
DataSet=cmd;
trigger();

}
///////////////
void GLCD_WriteData(unsigned char data)
{
DataClr=0xff;

CTRLSet=0x01;
DataSet=data;
trigger();
//DataClr=data;
}
///////////////////

void Selectpage(unsigned char p)
{
LPC_GPIO0->FIOMASK=0x07;
if (p==0){
CTRLClr=0x18;
CTRLSet=0x08;
}
else {
CTRLClr=0x18;
CTRLSet=0x10;
}
LPC_GPIO0->FIOMASK=0x00;
}

////////////////////////
void Gotopage(unsigned char pnum,unsigned char line)
{
unsigned char Cursorpos=0x40;
if(pnum==0)
{
Selectpage(0);
}
else{
Selectpage(1);
}

CmdWrite(line|0xb8);
CmdWrite(Cursorpos);
}
/////////////
void set_cursor(unsigned char pnum,unsigned char line,unsigned char cursorposition)
{
unsigned char ln,Cursorpos;
if(pnum==0)
{
Selectpage(0);
}
else{
Selectpage(1);
}
ln=line|0xb8;
Cursorpos=cursorposition|0x40;
CmdWrite(ln);
CmdWrite(Cursorpos);
}
/////////
void Clear(){
unsigned char line,cursor;
for(line=0;line<1;line++)
{
Gotopage(0,line);
for(cursor=0;cursor<1;cursor++)
{
if(cursor==64){
Gotopage(1,line);
}
GLCD_WriteData(0x00);
}
Gotopage(0,0);
}
}
/////////////
unsigned char GLCD_ReadByteFromROMMemory(char * ptr)
{
return *(ptr);
}

//////////////
void GLCD_WriteChar(char charToWrite)
{
int i;
charToWrite -= 32;
for(i = 0; i < 5; i++)
{
GLCD_WriteData(GLCD_ReadByteFromROMMemory((char *)((int)font5x8 + (5 * charToWrite) + i)));
}
}
///////////////

void GLCD_WriteString(char *stringToWrite)
{
while(*stringToWrite)
GLCD_WriteChar(*stringToWrite++);
}
//////////////
///////////
void GLCD_Init()
{
Selectpage(0);
CmdWrite(0x3f);
Selectpage(1);
CmdWrite(0x3f);
//delay(10);
Selectpage(0);
CmdWrite(0xc0);
Selectpage(1);
CmdWrite(0xc0);
Clear();
}
/////////////////
int main()
{
CTRLDir=0x1f;
DataDir=0xff;
DataClr=0xff;
CTRLClr=0x1f;
GLCD_Init();
//Gotopage(0,0);
//set_cursor(0,0,0);
GLCD_WriteChar('A'
}