RS232 looks like a straightforward way to interface the two devices.
You have to get the baud rate the same at each end, connect appropriate pins and deal with th eincoming data - s "simple matter of programming " :-).
Data output:
It sounds like the EZ1 can be persuaded to output RS232 data continually
Data input:
Page 42 of the DE2 users manual and
pages 26 & 27 of the DE2 Getting Started Guide
show how to configure an RS232 interface using the onboard PS/2 socket.
They advise that:
The DE2 Board uses the standard 9-pin D-SUB connector for RS-232
communications between PC and the board.
The transceiver chip used is MAX232.
For detailed information on how to use the chip, users can refer to the spec under C:\DE2\Datasheet\RS232. <- Probably on the supplied CD ROM
Figure 3.11 shows the related schematics.
The pin assignment of the associated interface is shown in Table 3.9.
As long as you do NOT have a "brown dot part" then the EZ1 Sonar can be easily configured to calculate range repeatedly and to output the results as a continual sequence of R232 strings. ie
TX – , When the *BW is open or held low, the TX output delivers
asynchronous serial with an RS232 format, except voltages are 0-
Vcc.
The output is
-an ASCII capital “R”,
-followed by three ASCII
character digits representing
-the range in inches up to a maximum
of 255,
-followed by a carriage return (ASCII 13).
The baud rate is
9600, 8 bits, no parity, with one stop bit.
Although the voltage of 0-
Vcc is outside the RS232 standard, most RS232 devices have
sufficient margin to read 0-Vcc serial data.
If standard voltage
level RS232 is desired, invert, and connect an RS232 converter
such as a MAX232.
*Brown dot parts: When BW pin is held high the TX output
sends a single pulse, suitable for low noise chaining (no serial data)
You can either use the provided core or write your own.
The C bit is probably for use with a processor core, so you almost certainly don't have to use it with C. What the core is written in doesn't matter either as it's only the function you care about.
You need to either use a soft core processor and connect using whatever bus system Altera provide (and maybe use C), or write your own module and connect to the necessary "pins" on the module to control it. In the datasheet you linked to it gives details on the registers for control and data. You would access these through the address and data ports on the module.
It may be useful to find an example RS232 to give you an idea of what is necessary. Take your time, if you are new to this as it may take quite a while to get up to speed.
Pong P Chu's "FPGA Prototyping with Verilog Examples" is a pretty good book, it starts from the beginning and works up to things like UART implementation with example code, etc. Also I'm sure Altera have loads of examples on their site (probably the DE2 board comes with some too)
Here is a decent run through of writing a UART in Verilog. It is a few pages long so you have to click on the "next" link at the bottom of each page. At the end it has a link for the full code.
Note that in order to design something you need to have a good idea of how it works, otherwise you are flying blind. If you are not familiar with the inner workings of UART then have a read up on this too (the above link goes into some detail)
Best Answer
This should get you started!
http://groups.google.com/group/comp.arch.fpga/msg/f4ef5805dbafbcc9