Forum Discussion

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

how to set i/O

i have set one i/o pin to bidirectional(tri-state) I/O port,and finished the hardware compile.

but in the nios II IDE ,how to set the bidirectional(tri-state) I/O port to out por

!

the following is my code (the name of pio is ADATA)

int main()

{//dir=0;

//IOWR_ALTERA_AVALON_PIO_DATA(LEVELCONTROL_BASE,1);

IOWR_ALTERA_AVALON_PIO_DIRECTION(ADATA_BASE,0XFFFF);

//alt_irq_register(TIMER_0_IRQ,0, handle_Timer0_interrupts);

//IOWR_ALTERA_AVALON_TIMER_PERIODL(TIMER_0_BASE, 0X1F40);

//IOWR_ALTERA_AVALON_TIMER_CONTROL(TIMER_0_BASE, 7);

IOWR_ALTERA_AVALON_PIO_DATA(ADATA_BASE, 0XFFFF);

while (1) {;}

}!

but when i test the value of the pio ,there is no value(even i set IOWR_ALTERA_AVALON_PIO_DATA(ADATA_BASE, 0)

why ??

thanks! http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/sad.gif

3 Replies

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

    Hi, I am having the same problem from time to time.

    Usually it starts working after re-generation of the system in SOPC builder and Quartus, sometimes try changing the location of the pin in SOPC and moving it back again. Hope it will work, I would also like to know why this is happening.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    but i cannot output the data by the bidir port!

    how could it output the data?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    originally posted by wbqyy@Dec 15 2005, 09:43 PM

    but i cannot output the data by the bidir port!

    how could it output the data?

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

    --- quote end ---

    --- Quote End ---

    I had the same problem - no data at the output, recompilation as I described in previous post helped it...