Serial communication Module available to you
By Hyungbin Son

Download the code : serialtest.zip
A good RS232C information : http://www.arcelect.com/rs232.htm
Find out the pin assignment of the DB9 connector in the link above.

I have written a serial communication module for your lab kit. Using this module, your lab kit can communicate with the computer via COM ports.

Here, I demonstrate how you can do this with the provided code.

1. File description

serialtest.v : a top module demonstrating that the FPGA indeed communicates with the computer.
rs232c_receiver.v : receiver module. You simply hook this module up to a RxD (receive data) line of the serial cable and this will give you the 8-bit data.
rs232c_transmitter.v : transmitter module. You simply hook this module up to a TxD (transmit data) line of the serial cable and this will transmit the data you provide.
serialclk.v : a serial timer module. (ticks twice as fast as the serial data)
sync.v : simple sync module

2. Test Setup

a. Open Max+plus II
b. Press Ctrl+J
c. Name project to be serialtest
d. Compile and program it to 10k10.
e. Check the pin assignments.
AD0 : 10Mhz clk
AD2 : RxD
AD3 : TxD
AD4 : Reset
AD8~AD15 : Received Data (to be displayed on the HEX leds)
f. Since the voltage levels of RS232c (max -15V to 15V, min -3V to 3V) and TTL (0V and 5V) are different and the signals are inverted (RS232C positive corresponds to TTL 0V, RS232C negative corresponds to TTL 5V), the signal should be inverted through a special IC or two OP amps. The picture below shows how to do it.

The two ICs are OP amp 356. The datasheet is here

g. And wire the signals to the Computer.

h. Open a serial communication program.

Press Cancel

Choose the COM port depending on which COM port you plugged in your DB9 connector.

The setting must be exactly the same as above.
Of course, you can modify the Verilog to have different settings

Type in 'a'
You should see 'a'+1 = 'b' reflecting back.

And on the HEX display, you should see the ASCII code of 'a' = 97 = 61(HEX).

You can try 'A'

And on the HEX display, you should see the ASCII code of 'A' = 65 = 41(HEX).