Altera_Forum
Honored Contributor
14 years agocreate software for Altere PIO 's
this is my code below,
its self explanatory, i am unable to get the IOWR_ALTERA_AVALON_PIO_SET_BITS(base) to work as the output is confirming it. My PIO is set to 1 # define ALT_MODULE_CLASS_GPIO_0 altera_avalon_pio # define GPIO_0_BIT_MODIFYING_OUTPUT_REGISTER 1 CODE::: # include <stdio.h> # include <unistd.h> # include "altera_avalon_pio_regs.h" # include "system.h" # include <strings.h> // Time in microseconds to wait for switch debounce int main(void) { printf("Simple\n"); // print a message to show that program is running int data1 = 0x00000309; int val,val2; //while(1){ IOWR_ALTERA_AVALON_PIO_DATA(GPIO_0_BASE,data1); val = IORD_ALTERA_AVALON_PIO_DATA(GPIO_0_BASE); printf("previous value = %x \n",val); IOWR_ALTERA_AVALON_PIO_SET_BITS(GPIO_0_BASE+4, 0x02); val2 =IORD_ALTERA_AVALON_PIO_DATA(GPIO_0_BASE); printf("value after setting the bit = %x " , val2); //} } -----------------OUTPUT------------------ Simple previous value = 309 value after setting the bit = 309