Hi, I'm looking to integrate a FPGA based program into a PC based application. I understand i need to write a serial interfacing code on the FPGA side and an API on the PC side,considering i intend to use a RS 232 serial interface bet'n the PC and the FPGA board. I need help regarding the PC side API programming.I'll be using a 'C' program and would like to call the FPGA based functions. Can anyone suggest how i go about this?any references?
As I understand you need help writing a program in C to communicate with the serial port?! Then you'd better ask this question on a newsgroup related to the software programming not a FPGA or Verilog news group! Also you will need to provide some more information; at least the OS under which you are going to run your program.
You may want to find a good terminal emulator program rather than trying to write your own. The last time I write code for a serial port (under windows) it was a real PITA. But then you may be using a decent OS. But under any OS, you will be talking to the driver, not the serial port.
If you have to write a program, try searching on the web for source code for a terminal emulator or similar project. There are lots of open source projects out there.
--
Rick "rickman" Collins
rick.collins@XYarius.com
It would depend on your operating system. If it is Windows, then there are a couple helpful documents in Microsoft's MDSN site. Search for "Serial Communications C" or something like that. It will probably take
Coding serial communication for DOS is simple since you can control the port registers directly, however it's not easy task in windows unless you familiar with C/C++, win32 API, MFC...if you own a VSC++ develope studio, there's some good examples, check for the project TTY
Is serial interface a must? There are relatively cheap development boards available with either Ethernet or USB interface. Might be easier to start with and lot more bandwidth, too! Depends of course on your requirements, hobby project?
Depends on what OS you are running on the PC. If Linux look for ioperm (just google), if windows look for inpout32.dll. There are probably a lot of other choices, but these worked for me. The downside is that a Linux program using ioperm has to be run as root or setuid root, which of couse is a security risc. /NS
In Free download section you can find the Windows API Documentation. I havn't check if this document have the API descriptions for serial port but I guess it should be in it. Even if it doesn't it is still a good reference for Windows programming. Note: Not suitable for .NET environment.
is serial communication a must? If not you could use the PC parallel port (parport macro and associated software) and transfer data at 500KBytes/sec, no special semiconductors needed. Free sources available. see:
formatting link
formatting link
formatting link
with best regards,
Peter Seng
############################# SENG digitale Systeme GmbH Im Bruckwasen 35 D 73037 Goeppingen Germany tel +7161-75245 fax +7161-72965 eMail snipped-for-privacy@seng.de net
// // open serial line // hCom = CreateFile(argv[argc-1], GENERIC_READ | GENERIC_WRITE, 0, /* comm devices must be opened w/exclusive-access */ NULL, /* no security attrs */ OPEN_EXISTING, /* comm devices must use OPEN_EXISTING */ 0, /* not overlapped I/O */ NULL /* hTemplate must be NULL for comm devices */ );
Thanks to all. i'm using a win2000 system. but guess the same serial port code should work for all Win based systems. Martin,i've actualy written similar code after posting here last. Thanks for your code(your's much neater :) ) i figured serial communication to be the easiet of all PC-FPGA communication ,I could implement hence the choice.I intend to "graduate" to others in due course of time.
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here.
All logos and trade names are the property of their respective owners.