Jim, where can I get the program OpenPort Thanks george -----Original Message----- From: pic microcontroller discussion list [mailto:PICLIST@MITVMA.MIT.EDU] On Behalf Of Jim Monteith Sent: Monday, October 27, 2003 8:52 AM To: PICLIST@MITVMA.MIT.EDU Subject: Re: [PIC:] safely driving a pic input from a PC Parallel port. I talk to PICs daily through the parallel port on windows 2000. For a manufacturing process, I created a program that writes the code to a PIC, and verifies it, also read and write from/to EEprom. The two keys here are using a drive program like OpenPort which gives you direct access to the parallel port, and then how you write to the port. You have to write to the port address which is usually 0x0378. Beyond this, it depends on what you want to do. You really need to study the pinout of the parallel port, and decide which pins you want to use. It's not that hard to do, and it is a very stable way to talk to the PIC. Jim -----Original Message----- From: pic microcontroller discussion list [mailto:PICLIST@MITVMA.MIT.EDU]On Behalf Of James Newton, webhost Sent: Friday, October 24, 2003 16:37 To: PICLIST@MITVMA.MIT.EDU Subject: [PIC:] safely driving a pic input from a PC Parallel port. I've been thinking about how things get connected between PC's and PIC's lately and overall what I can see is: USB: Nice! But not the lowest possible cost and not supported on some old PC's Also, requires some driver development on the PC side... not hard, but still. RS232: Nice... But you can run out of ports, some current laptops don't even have serial ports (!) and you have to do all the darn configuration on the PC to make sure all the settings are right. Has anyone been able to get a USB to RS232 adapter to work right? I can never get the PC application to see the port. Parallel: Sigh... NT and up driver problems (IF you don't simulate a printer with the PIC) but there are solutions for that. One the one port usually and I've seen laptops without parallel ports. USB to parallel adapters are really shaky... has anyone used one to talk to anything other than a printer? The two I've tried don't show up as LPT ports on the PC and so old applications don't see them. Of all the above, probably the most reliable, simple, and cheapest for us little guys is the parallel port (this is IMHO and I'm sure the point can be argued 20 ways from Sunday). So, if I want to put out something that people can setup from a PC, a temporary connection via the parallel port is probably best. Now the question is how do I keep people from bread boarding something that connects via my device that will blow up the PC (as well as me probably) when they screw up? I went on a hunt for parallel port isolation and, not being the most brilliant analog electronics engineer (ok, so I'm a complete moron in that area) I really don't seem to understand most of what I found. I understand that the port can sink 24mA and only source 2.6mA so obviously its a good idea to drive your loads from the port, through the load, then to +5v rather than ground. Safe current limiting can be had with a series resistor of 1.6k or more right? (4.2V / 2.6mA) But that doesn't leave much drive... so you can add a driver, but wouldn't it be better to prevent the pin from sourcing anything by putting a diode long with the resistor in series and then reducing the resistor to 175 or more ohms (4.2V / 24mA)? +5 | / \ / 220R 1N4148 \ >-o---,/\/\/'----|<-----o-----=> _|_/ //_\ 5.1V | GND A pull-up resistor is added to the output to drive TTL or other loads and a Zener could be added to ground to prevent over voltage or driving the pin in reverse. That seems to me to be a nice little, very low cost, easy to work with, circuit to provide some basic protection for kids or students to tack things onto. Not wanting to assume I have a clue, I searched the internet for other solutions. Tomi Engdahl says: "The following circuit uses two 1N4148 diodes to protect parallel port against higher than +5V signals and also against wrong polarity signals (power on the circuit is accidentally at wrong polarity. " Diode 1N4148 4.7K parallel >-|>|-+--\/\/\/--etc... port data | pin +-|<|-+ 1N4148 | parallel >-----------+ port ground | Ground "Adding even more safety idea: Replace the 1N4148 diode connected to ground with 5.1V Zener diode. That diode will then protect against over-voltage spikes and negative voltage at the same time. " Ok, he has his series diode in the exact opposite direction. Could somebody please tell me if I'm just being stupid? Other than that (and the much larger series resistor) the circuit is the same. I also found on piclist.com: "Another way to protect against over-voltage is to put a regular diode with the cathode on the signal line and the anode on the power supply line. Keep in mind that this will cause the power supply to receive the over-voltage and may result in damage to other components on the board." Standard diodes are cheaper... any reason why I can't put ONE Zener in the power supply and use regular diodes on the 8 pins? x8: +5 | +5 / _|_ \ _\ /_ / | 220R 1N4148 \ >-o---,/\/\/'----|<-----o-----=> x1: +5 _|_/ //_\ 5.1V | GND --- James Newton, webhost piclist.com (former Admin #3) jamesnewton@piclist.com 1-619-652-0593 fax:1-208-279-8767 PIC/PICList FAQ: http://www.piclist.com or .org -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body