Question & Answer

Classification: FAQ_CLASSIFICATION

Date: FAQ_DATE

Sending data from the XS Board to the PC

Q:

How can the XS40 board send data back to a PC? I'm sure I could figure it out, but does anyone have any experience with it so I don't have to reinvent the PC?

A:

You can use the cable provided with your board since it is connected to the XS40 board and to the parallel port of your PC. Some pins of the FPGA are attached to the DB-25 connector of the XS40, so these are the pins you have to use to send the information to the PC. Then, you will have to make a program to read the parallel port.

FPGA pin      DB-25 pin  
========      =========
70            15   (S3)       
77            13   (S4)
66            12   (S5)
69            10   (S6)

(Pin 75 can also be used but it is a special pin (TDO) so I think it's better to use the previous ones if you don't need more than 4 lines).

For instance, you can make a design with an output 'Z' located at pin 70 of the FPGA. Therefore, your program should read the value of pin 15 of your parallel port (line S3) and then you will have the value of 'Z'. If you are using Windows 95 or MS-DOS it is quite easy. For example, if you are programming in C, your program would be similar to this one:

#include <stdio.h>

void main()
{
   unsigned char status_port, Z;
   status_port=inportb(STATUS);

   /* Now, status_port is |/S7|S6|S5|S4|S3|*|*|*|, since you are
   interested in line S3, you should read the value of the 4th least
   significant bit */

   Z=(status_port >> 3) & 0x1;
   /* Now you have the value of Z */

   printf("Value of Z: 0x0\n", Z);
}

You can find more information about how to use the parallel port here:

- Ian Harries. Interfacing to the IBM-PC Parallel Printer Port. http://www.doc.ic.ac.uk/~ih/doc/par

- Craig Peacock. Interfacing the Parallel Port. http://www.geocities.com/SiliconValley/Bay/8302/parallel.htm

- Peter H. Anderson. Use of a PC Printer Port for Control and Data Acquisition. Dpt. of Electrical Engineering. Morgan State University. http://et.nmsu.edu/~etti/fall96/computer/printer/printer.html

 Answer provided by:

Ignacio de Miguel Jimenez (ignmig@tel.uva.es) Dpto. Teoria de la Senal y Comunicaciones e Ingenieria Telematica E.T.S.I. de Telecomunicacion | Universidad de Valladolid | Tel: +34.83 423000 ext. 25574 Campus Universitario "Miguel Delibes" | Fax: +34.83 423667 Camino del Cementerio S/N | 47011 Valladolid (SPAIN) |

webmaster@xess.com
© 1998-2008, XESS Corp.
All rights reserved.