The RS-232 UART (Universally Asynchronous Receiver-Transmitter) is a serial protocol UART, allowing for a connection between a terminal and the DE2 Board. It is configured for 8-bit data, one stop bit, odd parity, and a baud rate of 115,200.
Device | RS-232 UART | |||||||||
Configuration | Two 32-bit mapped registers | |||||||||
Input/Output | Either | |||||||||
Address Base | 0x10001010 | |||||||||
Address Map |
| |||||||||
Initialization | None | |||||||||
Interrupts |
| |||||||||
Hardware Setup | Plug the serial cable into the serial outlet on the DE2 Board (also see Notes) | |||||||||
Reference | Full documentation from Altera. Section 2.5 of the DE2 Media Computer Manual |
To communicate through the RS-232, you must set up a terminal to
send and receive characters. Open the Conport program (in the lab, this can be found on the network drive, X:\TTERMPRO, as ttermpro.exe),
ensure that the Baud Rate is set to 115200 (for the default system, or
whatever your baud rate is in a custom system), and ensure that it is
communicating through CON1.
POLL: movia r7, 0x10001010 /* r7 now contains the base address */ ldhio r2, 2(r7) /* Load from the UART */ beq r2, r0, POLL /* If this is 0 (branch true), data is not valid */ ldwio r2, 0(r7)
#define RS232_UART_DATA ((volatile int*) 0x10001010) #define RS232_UART_CONTROL ((volatile int*) (0x10001010+4)) int main() { unsigned char hwld[] = {'H','e','l','l','o',' ','W','o','r','l','d','\0'}; unsigned char *pOutput; pOutput = hwld; while(*pOutput) //strings in C are zero terminated { //if room in output buffer if((*RS232_UART_CONTROL)&0xffff0000 ) { //then write the next character *RS232_UART_DATA = (*pOutput++); } } }