Altera_Forum
Honored Contributor
13 years agocounter design using sopc builder
Hi, I had created a new component counter and also its slave interface by writing the hdl code and then included as a component using new component wizard in sopc builder.I then exported the output external to nios-ii using LED as PIO. System generation is also successful.But the only problem i am facing is how to initiate the counter using NIOS-II SBT ECLIPSE tool and how to initialise the on-chip memory.I included my c code.please verify the code and tell me the modifications.
Thank you in advance c code:# include<io.h># include<system.h># include<stdio.h># define LED_DATA_BASE 0X00002000# define IORD_LED_DATA(LED_DATA_BASE,OFFSET) alt_main() { int i; for(i=0;i<=3;i++) { IORD_LED_DATA(LED_DATA_BASE,i); } } //whether the code above is correct for a 4-bit counter controlled using nios-ii