LPT Port Assumptions for TOPIC ============================== David Tait david.tait@man.ac.uk http://www.man.ac.uk/~mbhstdj INTRODUCTION This short file describes the assumptions made about the printer port (LPT) hardware used to control the TOPIC programmer. It seems that these assumptions may not be correct for some PCs. In particular new PCs equipped with enhanced ports as defined in the recent IEEE 1284 standard. These ports should be capable of working in standard printer port mode - "compatibility mode" - but it appears some are more compatible than others. Unfortunately, where I assume a particular printer line is controlled by an open-collector (O/C) driver it seems some ports use "totem-pole" drivers instead (the former can only sink current but the latter can both sink and source current). The differences mean that the TOPIC hardware may not work on these systems without modification. ASSUMPTIONS It is assumed that the INIT line is controlled by an open- collector driver. This is not too critical but if INIT is actually controlled by a totem-pole output it may be necessary to reduce R4 from 1k to 470 ohms or even lower. Just check that the output of the LM317L reaches +13.5V when INIT is low. It is assumed that the STROBE and AUTOF lines are controlled by open-collector drivers. This is handy because they drive RB6 and RB7 which are Schmitt trigger inputs in programming mode; the O/C drivers are better able to reach the input high threshold of nominally 4V. If the O/C assumption is wrong here it's unlikely to be a problem as new ports will probably have an adequate high output voltage (that's because they are usually implemented using CMOS VLSI). I don't use the LPT data lines (totem-pole outputs) to drive RB6 and RB7 as doing so might mean TOPIC will not work with an old port based on traditional TTL. It is assumed that SEL (actually SELECTIN) is controlled by an open-collector driver. This line has two functions. It is used to check whether the programmer is plugged into the PC: As SEL is connected to the BUSY input on the TOPIC board the line can be toggled and the effect on BUSY monitored and thus used to verify the programmer is attached. The second function is more subtle and is explained along with the description of the next assumption. I'll leave a discussion of the consequences of SEL really being a totem-pole output until later. It is assumed that the BUSY input has an internal pull-up resistor. This assumption is necessary because BUSY is connected to RB7 via a diode and RB7 can only pull BUSY low. You might ask why the diode is required - if it wasn't fitted there would be no need to assume BUSY has a pull-up. OK, let's assume there is no diode between BUSY and RB7. When reading from the PIC everything is fine but consider what happens when writing to the PIC. I have already said that I assume AUTOF has an O/C driver and, to prevent damage when the PIC is running with RB7 enabled as an output, it is connected to RB7 via a 1k resistor. When AUTOF is high RB7 is connected to +5V via the combination of the 1k resistor and the AUTOF pull-up and it is also connected to +5V via the BUSY pull-up; this pretty well guarantees RB7 is high. Now, when AUTOF is low RB7 is grounded via the 1k resistor but it is still connected to +5V via the BUSY pull-up. This means the voltage at RB7 depends on the value of the BUSY pull-up - if the pull-up is 4.7k the voltage will be around 0.9V and will be even greater if the pull-up has a lower resistance. This value is too close to the low threshold for comfort. By adding the diode the voltage drops slightly but could still be too high. However, remember SEL is also connected to BUSY; by programming SEL low the influence of the BUSY pull-up is removed (this is the real reason for using the diode: without it programming SEL low would simply short RB7 to ground). When reading from the PIC the SEL line is pulled high. But consider what happens if SEL really has a totem-pole output. In this case SEL will "fight" with RB7 when trying to read from the PIC. It is likely that the PIC will win (it has a fairly beefy output driver) but this is not a good situation. To get around this SEL can be made into a pseudo O/C driver by adding another diode; the diode replaces the SEL/BUSY short with the cathode connected to SEL and the anode to BUSY: | SEL ------------+ +------------ RB7 | | | | --- --- new diode / \ / \ existing diode --- --- | | | | BUSY ------------+ ---------+ Although I assume BUSY has a pull-up it doesn't really matter if it doesn't because, provided it is O/C, SEL will. However if the diode is added as described above then BUSY _must_ have a pull-up. If it doesn't, a resistor (say 4.7k) from BUSY to +5V should be fitted to the TOPIC board. SUMMARY If the TOPIC board doesn't work with your LPT port try: 1) changing R4 from 1k to 470 ohms; 2) adding a diode between SEL and BUSY. If it still doesn't work add a 4.7k resistor from BUSY to +5V. If it still doesn't work let me know (tell me you've read this document). ACKNOWLEDGEMENTS Thanks to Kalle Reunanen for his comments about the value of R4. Thanks to Bob Parker for telling me about the "extra diode" fix. V-0.0 19/Feb/97