The DE2-115's serial port provides a way to communicate with other DE2-115 boards and computers (and other devices with serial ports). A DE2-115 board can connect to one other device through a serial cable (null-modem cable if connected to another DE2-115; straight-through serial cable if connected to a computer). Or it can connect to one or more devices through wireless XBee modules.
The serial port controller handles the low-level details of receiving and sending data across the serial port. The serial port controller is implemented in serial_receive.v, serial_receive_fifo.v, and serial_send.v.
E100 programs receive data from the serial port by using device registers serial_receive_command, serial_receive_response, and serial_receive_data. serial_receive_command and serial_receive_response implement the standard I/O protocol. There are no command parameters. The response parameter is serial_receive_data, which contains an 8-bit value.
E100 programs send data to the serial port by using device registers serial_send_command, serial_send_response, and serial_send_data. serial_send_command and serial_send_response implement the standard I/O protocol. The command parameter is serial_send_data, which contains an 8-bit value. There are no response parameters.
The serial port controller will buffer 1024 bytes of received data if the E100 program doesn't read it right away. If this buffer fills up, the serial port controller will drop new data until space frees up in the buffer.
Use the following connection parameters if you want to connect the serial port to a computer or an XBee module: 8 data bits, no parity bit, 1 stop bit, 115200 baud, no flow control.
ase100 simulates the serial port controller accurately enough for you to test your device driver and to run assembly-language programs. ase100 can connect to a hardware serial port on the computer it's running on. If your computer lacks a serial port, use a USB-serial adapter. To connect to a hardware serial port, enter the name of the serial port when prompted (e.g., COM1 on Windows, /dev/ttyS0 or /dev/ttyUSB0 on Linux) when prompted.
ase100 can also connect two simulated DE2-115 boards via a virtual serial cable. To connect to a virtual serial cable, enter your uniqname when prompted, then run a second instance of ase100 and enter the same uniqname.
Write a device driver for the serial send controller that a program can call to write the ASCII value for a character to the serial port. Then, write a test program that sends a message to the serial port. The message should be stored as an array of ASCII values, with the length of the array specified by another variable.
Write a device driver for the serial receive controller that a program can call to read data sent to the serial port by another computer. Then, write a test program that reads a password from the serial port and compares it to the correct password. The correct password should be stored in an array, with the length of the array specified by another variable. If the password is correct, light up the green LEDS. If the password is wrong, light up the red LEDs.