Forum Discussion
Altera_Forum
Honored Contributor
20 years agoUsing IORD - IOWR
Hi,
I want to write down some value to my control register. Here are the steps : 1. Define component's macros which are done in SOPC Builder # define MY_IORD(base , offset) IORD(base , offset)# define MY_IOWR(base , offset , data) IOWR(base , offset , data) 2. Use in NIOS IDE MY_IOWR(base , 0 , 0x1); return_value = MY_IORD(base , 0); -------------------------- After execution , I learnt that my return_value is 0 instead of 1. Why do I get this error ? My reference : "n2sw_nii5v2.pdf" , pg 131/242 Thanks in advance, Quan5 Replies
- Altera_Forum
Honored Contributor
What are you writing to? Memory? Custom periperhal?
- Altera_Forum
Honored Contributor
set PIO DIR ?
# define inport(base) IORD(base, 0) # define outport(base, data) IOWR(base, 0, data)# define get_pio_dir(base) IORD(base, 1) # define set_pio_dir(base, data) IOWR(base, 1, data) - Altera_Forum
Honored Contributor
Hi Slacker ,
I have a component and try to control it through the NIOS C program. I have been trying to write to a control register that I defined for my component. For ex : I have a counter. Here are the files I have to make : (1) Hardware files counter_task_logic.v counter_regs.v counter_avalon_interface.v (2) Software files counter_regs.h (/inc) counter_routines.h (/HAL/inc) counter_routines.c (/HAL/src) (3) Test Hardware file counter_test.c Then I packaged my counter to SOPC with (1) and (2) and used NIOS IDE to create program to check my counter. I tried to follow the instruction in the reference I gave you some days ago but it seemed to me that it didn't work as I expected. Could you tell me where my problem is ? Thanks, Quan - Altera_Forum
Honored Contributor
Hi makasete,
Sorry , It is not very clear about your idea. Would you please tell me about it more clearly? Thank you so much, Quan - Altera_Forum
Honored Contributor
--- Quote Start --- originally posted by quan1328@Jul 14 2006, 05:43 PM could you tell me where my problem is ?thanks,
quan
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=16922)
--- quote end ---
--- Quote End --- Perhaps, an error in your hardware design? Why don't you run a simulation and see what's happening in your hardware? Other than that, I don't have enough visibility into what you're trying to do to help you any further. Good luck! - slacker