Forum Discussion
Altera_Forum
Honored Contributor
13 years ago --- Quote Start --- I am stil having the same problem...... I cannot connect UART to my HyperTerminal :( . I am trying to use JTAG-to-Avalon Memory Tutorial and see what happens :( Thanks --- Quote End --- Try this code /* * uart.c * * Created on: Feb 8, 2013 * Author: krishnakumar */ # include <stdio.h> # include <unistd.h> # include "system.h" # include "alt_types.h" # include "sys/alt_stdio.h" # include "pheripheral_comm.h" # include "string.h" # include "altera_avalon_pio_regs.h" # include "altera_avalon_uart.h" # include "altera_avalon_uart_regs.h" int ReadAddData(int); int uart_1(void) { int Address = 0; int Data = 0; alt_putstr("Enter Address : "); Address = ReadAddData(5); if((Address < (int)PIO_0_BASE) || (Address > (int)PIO_0_BASE+0xF))//|| (Address >= PIO_0_BASE-0x50-0x1)) { alt_putstr("Wrong Address for LED\n"); return 0; } WRITE_CHAR_TO_HYPERTERMINAL('\n'); alt_putstr("Enter Data : "); Data = ReadAddData(2); WRITE_CHAR_TO_HYPERTERMINAL('\n'); IOWR_ALTERA_AVALON_PIO_DATA(Address, Data); return 0 ; }