> From: Ed Todd > > We've amanged from a PIC (16C57) into a PC parallel port in standard mode. > We use 5 input lines (including 1 IRQ line) and 2 output, though I forget > which preceise lines we use. We have a simple protocol: > > 1. PIC places 4 bits on input lines to PC. > 2. PIC raises IRQ line > 3. PC IRQ handler takes 4 bits of data and raises an output line (we call > it a strobe line) > 4. PIC sees strobe line rise, places other 4 bits on input lines and clears > IRQ line > 5. PC sees IRQ line drop, takes next 4 bits, clears strobe line, ends IRQ > processing > > We use the second output line to test for PIC presence on the port: if the > PIC sees that line go high, it sends a couple of test bytes to the PC. > > Our application is complex and code cannot be shared: our PIC is gathering > data full time in a time critical operation and communicates with the PC in > limited time during certain phases of the operation. I can get the LPT > line names we use tomorrow when I'm back in the office if anyone needs > them. > I don't know what 'amanged' means, but a similar technique was used by me in 1-bit form to communicate between a PC and a PIC. Just toggling the IRQ line (as is done above) for each bit seems more efficient than strobing it. Naturally, one doesn't have to use interrupts on the PC if polling is adequate for the application. By the bye, I do everything using 3 or 4 PIC pins: Clock (input to PIC) Handshake (output from PIC) Data (input/output) Hard reset (optionally attached to !MCLR pin to grab the PIC's attention in no uncertain terms). All pins are tied to the respective parallel port pin by 1K resistance. In addition, the data pin is tied to a P/P output _and_ a P/P input pin by separate resistors (common point at the PIC pin). This allow the PIC to input from the PC by setting its pin to high impedance. Otherwise, the PIC can blast away with its own data without regard to the P/P data pin. This also allows a crude form of 'plug and play' because (if the PIC allows it) the PC can read its own data signal back (i.e. loopback) once the PIC unit is plugged in. If anyone is interested I could give some more detailed info on this technique. I have used it successfully in two projects so far - GPIRS (Peter Crowcroft where are you?) and a programmable remote control. Regards, SJH Canberra, Australia