|
额 这是第一次接触这个,我按照网上的教程配置了一个CPU点亮LED,以下是程序:
/*
* "Hello World" example.
*
* This example prints 'Hello from Nios II' to the STDOUT stream. It runs on
* the Nios II 'standard', 'full_featured', 'fast', and 'low_cost' example
* designs. It runs with or without the MicroC/OS-II RTOS and requires a STDOUT
* device in your system's hardware.
* The memory footprint of this hosted application is ~69 kbytes by default
* using the standard reference design.
*
* For a reduced footprint version of this template, and an explanation of how
* to reduce the memory footprint for a given application, see the
* "small_hello_world" template.
*
*/
#include "stdio.h"
#include "unistd.h"
#include "system.h"
#define _LED 1
typedef struct
{
unsigned long int DATA;
unsigned long int DIRECTION;
unsigned long int INTERRUPT_MASK;
unsigned long int EDGE_CAPTURE;
}PIO_STR;
#ifdef _LED
#define LED((PIO_STR *)PIO_LED_BASE)
#endif
int main()
{
int i;
while(1)
{
for(i=0;i<8;i++){
LED->DATA=1<<i;
usleep(50000);
}
}
return 0;
}
但在编译时 提示 LED没有定义?求高手解答! |
阿莫论坛20周年了!感谢大家的支持与爱护!!
知道什么是神吗?其实神本来也是人,只不过神做了人做不到的事情 所以才成了神。 (头文字D, 杜汶泽)
|