Forum Discussion
Altera_Forum
Honored Contributor
14 years agoThanks for your help
I got this working # include <stdio.h> # include <unistd.h> # include "altera_avalon_pio_regs.h" # include "system.h" int main(void){ int val; //IOWR_ALTERA_AVALON_PIO_DATA(GPIO_1_BASE,0x0000); //printf( " GPIO default values are set at 0 \n"); IOWR_ALTERA_AVALON_PIO_SET_BITS(GPIO_1_BASE,0x0003); val = IORD_ALTERA_AVALON_PIO_DATA(GPIO_1_BASE); IOWR_ALTERA_AVALON_PIO_DATA(LEDR_BASE, val); usleep(10000000); IOWR_ALTERA_AVALON_PIO_CLEAR_BITS(GPIO_1_BASE, 0x0001); val = IORD_ALTERA_AVALON_PIO_DATA(GPIO_1_BASE); IOWR_ALTERA_AVALON_PIO_DATA(LEDR_BASE, val); //set latch //printf(" GPIO 1st bit set to 1\n"); // IOWR_ALTERA_AVALON_PIO_CLEAR_BITS(GPIO_0_BASE,0x1000);//oe enable // IOWR_ALTERA_AVALON_PIO_CLEAR_BITS(GPIO_0_BASE,0x200);//clear latch }