Stuart Broad wrote: > > >Hello to all who responded about my EPP port problems, > > > >I finally fixed my problem, and it was a very simple one: my routine was > >not fast enough. The EPP port has about a 10uS timeout timer on most PCs. > >If the PIC doesn't ack the PC's data strobe within 10uS, it finishes the > >cycle right then and there. My PIC routene was taking about 15uS to > >create the ack. When I lowered it to about 5uS, it worked fine. > > > I have used a hardware method to overcome this feature by attaching > set/reset latch between the STROBE and WAIT/BUSY lines of a printer port. > Connect the STROBE line to the set of the latch and the WAIT/BUSY line to > the latch output. The EPP interface is not suited very well to connecting a software-driven peripheral to your PC. Investigate ECP mode, this is much more suitable because of its use of interlocked handshake. You also get a FIFO of usually 16 bytes which improves performance. Contrary to public misconceptions, you don't need to use DMA when you're using ECP -- you can add DMA code if and when you want a higher data rate and/or lower CPU overhead. In interlocked handshake, the two devices acknowledge *both* edges of the control signals; this allows for slow peripherals. Here is what it might look like if both strobe and acknowledge signals are active low: Source strobe ~~~~~~~~~~\_______________________/~~~~~~~~~~~~~~~~~ event 1 2 3 4 Destination ack ~~~~~~~~~~~~~~~~~~~~~~~~~~~~\__________________/~~~~ Event 1: Source (can be host or peripheral) wants to send some data, and asserts its strobe signal Event 2: After a while (depending on how often the destination polls the strobe line) the destination acknowledges the asserted strobe by asserting the ack signal. Now is probably a good time to latch the data as well. Event 3: The source notices the asserted ack signal and negates the strobe signal Event 4: After a while the destination negates the ack signal. If you want your device to comply to IEEE1284, then you better read the standard. There is an elaborate negotiation sequence required before you can switch to EPP or ECP modes -- failure to do this negotiation may cause your PC to blow up its parallel port or your PIC. This is perhaps not important for a hobby project that you're only going to use on one PC, but if you bring your device to a friend and blow up his parallel port he won't be amused. The standard is about $100 and available from the IEEE. Frank ------------------------------------------------------------------------ Frank A. Vorstenbosch Phone: 0181 - 636 3000 Electronics and Software Engineer Mobile: 0976 - 430 569 Eidos Technologies Ltd., Wimbledon, London Email: fav@eidos.co.uk