我在我的FPGA中包含了一个UART组件,我编写了这个示例代码来输出一个字符(我想测试它是否工作):
#include <alt_types.h>
#include <altera_avalon_pio_regs.h>
#include <altera_avalon_uart_regs.h>
#include <sys/alt_irq.h>
#include <sys/alt_alarm.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include "system.h"
int main(void)
{
int filed;
int x=0;
unsigned char c=5;
filed = open ("dev/uart_0", O_RDWR| O_NOCTTY );
while (x<10){
write (filed, &c,1);
x++;
}
}我正在使用实时读取输出,但是没有出现任何帮助吗?thx
发布于 2015-03-10 13:24:17
谢谢大家,我做了一次修改,每件事都做得很好,没有写:filed = open ("dev/uart_0", O_RDWR| O_NOCTTY );,我写了filed = open ("dev/uart_0", O_RDWR);,我真的不知道为什么,如果有人有答案,请告诉我:)
https://stackoverflow.com/questions/28947220
复制相似问题