-----Original Message----- From: Buell Smelt To: PICLIST@MITVMA.MIT.EDU Date: 31 March 1998 22:13 Subject: Beginner Input and Output Questions Hi Nathan, Lets take a couple of your questions in a step by step fashion:- > >I have a 5V lamp, and I do not know how much current it needs. You say lamp! Do you mean LED Or LAMP that is lamp as in filament lamp. Is there >anyway to figure this out with a multimeter? Let's say it uses 50 >milliamps. Yes, measure the resistance of the filament, now apply Ohms Law. Here once again we assume its a filament lamp were are talking about, cos if its an LED this don t work, and anyway an LED will only draw something in the order of 10 to 25 milliamps. Once you have the resistance of the lamp, divide the voltage the lamp will be running at by the resistance and you have the current. Of course, if you know the wattage of the lamp, divide that by the voltage to give you the current i.e., lets say the lamp is 2 watts that equates to some 400ma. If memory serves me right, the output of a pic is good for 25ma, that means you would need the output of 16 i/o's to drive the lamp, if you were not exceeding the total permissible output load of the pic! >I could then hook it up to two outputs to drive it; correct? Errr, No >Of course I could also drive it with a transistor, YES >such as a 2N2222 or a >2N7000 right? How does one choose the right transistor for the right >output (ie this transistor is good for this small lamp and this one is >good for this motor). > See note below. >Regarding Inputs... > >I'd like to have sensors hooked up to some of my PIC projects. Let's say >I am using a photoresistor. Normally I'd think to use a CMOS comparator. >IS there a good cheap comparator that works with the PIC (I've never >worked with a comparator, just know them in theory, so a part name would >be helpful)? Do PICs have any built in comparator features or is there a >better way to do this which I am overlooking? > >Ok, That's all. I know that these are relatively simple questions which >should be obtainable all over the place, but I assure you've I've been >around and looking, and have found unsatisfactory->no answers, so I felt >like this list would be a good place to get the answers. One more thing, >is there a web based interface to this list's archives? > >Thanks a lot a lot a lot. > >Nathan Hendler > Ive been using this list for over a year now, and I find it and extremely useful reference point for learning about Pic programming and use. Also there are many useful ideas floating about as regards ancillary equipment and attachments. However Nathan, your questions seem to be far more basic than Pic programming. How good an understanding do you have of electronics. Its easy to copy or write some fairly simple code to make some LED's respond to a input signal, but if you don t know how to spec the value of base current and voltage for a particular transistor you re going to have the bugger of a time getting anything more complicated to work. Been there, done that, and its not that much fun. Me thinks a book like Malcolm Plant's Basic Electronics, or any one of the thousand or so other books like this would be a good place to start. Philip Martin Now a VPOP non smoker!"%$#"$# :-)