1 #ifndef SOPC_H_
2  #define SOPC_H_
3
4 #include "system.h"
5
6  #define _LEDG
7
8 typedef struct
9 {
10 unsigned long int DATA;
11 unsigned long int DIRECTION;
12 unsigned long int INTERRUPT_MASK;
13 unsigned long int EDGE_CAPTURE;
14
15 }PIO_STR;
16
17
18
19
20 #ifdef _LEDG
21  #define LEDG ((PIO_STR *)(PIO_LEDG_BASE | 1<<31))
22  #endif
23
24  #endif /*SOPC_H_*/
25  

 

其中21行是将地址最高位置1。

 

1 #define LEDG ((PIO_STR *)(PIO_LEDG_BASE | 1<<31))

 

分析:查看system.h中

 

#define PIO_LEDG_BASE 0x00041000

 

最高位为0,在sopc.h中把基址最高位置1,编译程序,LED显示正常,解决上一篇文章问题。在此多谢.COM 缺氧®的博文[笔记].浅析在Nios II中的两种寄存器映射方法的异同.[C][Nios II]指点。