Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
18 years ago

using PIOs to communicate with an LCD controller

Hi everyone. Karthik here.

I am using an LCD controller to communicate with the optrex lcd module and i want to send the data to the controller from the nios processor thru pios. can anyone tell me where i can find information about the macros defined in the altera_avalon_pio_regs.h header file. i am using the following code to do this but im not getting any transitions on the pios (on the scope)

# include "stdio.h"# include "system.h"# include "altera_avalon_pio_regs.h"# include "alt_types.h"

int main (void)

{

alt_u8 data[15]={0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x50,0x51,0x52,0x53,0x54,

0x55};

alt_u8 reset;

alt_u8 we;

volatile int ack;

volatile int i;

reset = 1;

do

{

ack = IORD_ALTERA_AVALON_PIO_DATA(LCD_ACK_PIO_BASE);

}while (!(ack));

we=1;

while(1)

{

for(i=0;i<16;i++)

{

IOWR_ALTERA_AVALON_PIO_DATA(LCD_DATA_PIO_BASE,data[i]);

ack = IORD_ALTERA_AVALON_PIO_DATA(LCD_ACK_PIO_BASE);

while (!(ack));

}

i=0;

}

return (0) ;

}

2 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    May i ask what reason do you have for not including the Optrex IP via SOPC? Wouldnt that be alot easier?

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    originally posted by tembridis@Mar 26 2007, 07:09 PM

    may i ask what reason do you have for not including the optrex ip via sopc? wouldnt that be alot easier?

    <div align='right'><{post_snapback}> (index.php?act=findpost&pid=22513)

    --- quote end ---

    --- Quote End ---

    Thanks a lot for ur reply.

    I was trying to interface the lcd through a controller because i wanted to verify the working of the LCD Controller (designed by me). And i had made some errors in the code. I got rid of them and my controller seems to be working fine.

    Thanks a lot again.

    Karthik