This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

help me about EMIF port data read on c6713 platform.

Hi Friends

                  I am working newly on C6713 platform. I have interfaced 320x240 graphical LCD with c6713 through EMIF port.

With my program, i can write anything into GLCD, but i can't read data from GLCD. I have got sample program for read data function, but their used input(GLCD_DB0, GLCD_DB1, GLCD_DB2,..... GLCD_DB7 etc) , but this input function & GLCD_DB are unknown for me & i could not understand , how i define this GLCD_DB address for EMIF to read data from LCD.

I have given my sample code below....

---------------------

#define ADDRESS 0xA0000000 // header declaration
#define GBLCTL 0x01800000 // header declaration
#define CE2 0x01800010 // header declaration
int *output1=(int *)ADDRESS; // header declaration

*ce2=0x22A28A22; // Define it into the main function.

-------

-------------------------
void GLCD_SetPixel(unsigned int x,unsigned int y, int color)
{
unsigned char tmp=0;
unsigned int address = ((0x04 << 8) + 0xB0)+(40*y)+(x/8)
................//////SED1335_GRAPHICSTART + (40 * y) + (x/8);
GLCD_SetCursorAddress(address);
glcd_cmd(0x43);
tmp =GLCD_ReadData();

if(color)
tmp |= (1 << (7 - (x % 8)));
else
tmp &= ~(1 << (7 - (x % 8)));

GLCD_SetCursorAddress(address);
glcd_cmd(0x42); //GLCD_WriteCommand(0x42);
glcd_dat(tmp); //GLCD_WriteData(tmp);
}
-----
unsigned char GLCD_ReadData()
{
int i=0;
char temp;
*output1=0x00190000;
temp=takedata();
for(i=15;i>0;i--); //delay
*output1=0x001E0000;
return temp;
}
-----
int takedata(void)
{
int data=0;
data += input (GLCD_DB0);
data += input (GLCD_DB1) * 2;
data += input (GLCD_DB2) * 4;
data += input (GLCD_DB3) * 8;
data += input (GLCD_DB4) * 16;
data += input (GLCD_DB5) * 32;
data += input (GLCD_DB6) * 64;
data += input (GLCD_DB7) * 128;

RETURN data;
}
----------------------------------------
Hope that the above my program target description will help you to understand my problem. i have GLCD_SetCursorAddress(), glcd_cmd(), glcd_dat() function. but i don't have glcd_readdata function.
So i will try to build this function my self. but input(GLCD_BD) function are undefine & i don't understand how i make it.

kindly help me ..

 

Regards

Gopal Sarkar

Kolkata, India

 

 

  • Hi Gopal,

    I do not understand your question. I am not an expert on using the GLCD so I do not know what a read entails. From the EMIF's point of view a read is as simple as this:

    unsigned int *ptr;
    int temp = 0;
    ptr = (unsigned int *)0xA0000000; 
    temp = *ptr;
    As you can see this is nothing fancy, and will read 32-bits from the first address of CE2.

    If the GLCD requires something more fancy to read data then you will need to follow that device's datasheet when setting up the read function. I hope this is a useful starting point, but if you still have more questions please follow up by telling me what exactly you need to do to read from that device.

    *edit* fixed the cast data type

  • Hi

    Thank you for your kind response. I have sent you my target sample program part where have this 3 lines define below ..

    GLCD_SetCursorAddress(address); /// specified LCD cursor address.
    glcd_cmd(0x43); // Comman for read data.
    tmp =GLCD_ReadData(); //// bythsi function, read data on the particular address.

    ----------------------------------

    My question is that how i read data/value through EMIF(0xA0000000) port of this particular address location. I remain that it is 8 bit data. I have checked with your sample code, but have not got result.

    I am waiting for your reply ..

    Regards

    Gopal Sarkar

    Kolkata, India

     

  • To read a byte instead of a word see the changed code below:

    char *ptr; 
    char temp = 0;
    ptr = (char *)0xA0000000; // You might need to change this to equal address?
    temp = *ptr;
  • Hi  Tim Harror

    I have used your code for my read function but have not got any result. Hope that your code is right. but during run time, if i want to print temp variable content, it does not  show any value(tested with printf("%c",temp ) or print("%d",temp);). My Read function code has been given below. Kindly check it.

    -----------------------------------------------------------------------------

    int *output1=(int *)0xA0000000;  // define header

    unsigned char GLCD_ReadData()
    {

        unsigned int i=0;

       char *ptr; 

       char temp=0;
        *output1=0x00190000;    // A0 high .. reset and RD low for LCD.
         ptr = (char *)0xA0000000;

        temp = *ptr;

       printf("%c \n",temp);            // Optional to check temp content ..............

        for(i=15;i>0;i--);                  // Delay
        *output1=0x001E0000;    // RD disable ..for LCD
        return temp;
     }

    ---------------------------------------------------------------------

    Wish your great cooperation.

    Regards

    Gopal Sarkar

    Kolkata ...............

     

  • Maybe we should look more closely at how the the LCD works. The code snippet I gave you is a very basic C pointer scheme so I am sure it works. What I do not know is if pointing to the CE2 address space and performing a read is sufficient for the LCD with which you are communicating.