Reply by CBFalconer February 12, 20072007-02-12
Jim Granville wrote:
> CBFalconer wrote: > <snip> >> >> Also watch out for the capacitance of the input pin. Using the 22k >> suggested above (22 x 10e3) and a capacitance of 5 pf (5 x 10e-9) >> the time constant is 100e-6, or 100 uS. For a 12 V signal to rise >> to 1/3 will take about 1/3 the TC, or about 30 uS. Also, slow rise >> times on input pins play havoc with internal logic and power >> dissipation. A divider is probably better controlled. > > Is getting ones Pico and Nano farads confused, as bad, or worse, than > top-posting ? ;)
Worse. That is my second mistake this decade. Must be getting old. At least the correct calculation shows that the effect is trivial. It's like the federal budget, 10e3 here, 10e3 there, and pretty soon you are talking about real effects. -- <http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt> <http://www.securityfocus.com/columnists/423> "A man who is right every time is not likely to do very much." -- Francis Crick, co-discover of DNA "There is nothing more amazing than stupidity in action." -- Thomas Matthews
Reply by Jim Granville February 12, 20072007-02-12
CBFalconer wrote:
<snip>
> > Also watch out for the capacitance of the input pin. Using the 22k > suggested above (22 x 10e3) and a capacitance of 5 pf (5 x 10e-9) > the time constant is 100e-6, or 100 uS. For a 12 V signal to rise > to 1/3 will take about 1/3 the TC, or about 30 uS. Also, slow rise > times on input pins play havoc with internal logic and power > dissipation. A divider is probably better controlled.
Is getting ones Pico and Nano farads confused, as bad, or worse, than top-posting ? ;) -jg
Reply by CBFalconer February 12, 20072007-02-12
Donald Harris wrote:
> "Tristan Mumford" <xtristan.xmumford@xgmail.xcom> wrote: >> Donald Harris wrote: >
... snip ...
>>> >>> If you only need to sample the presence or absence of the stepper >>> phases or polarity, just put a 22K series resistor in line to the >>> PIC pins. Most of the PIC pins have internal diodes to Vdd and >>> Vss. The resistor just limits the current in the diodes. Check >>> the data sheet to be sure that the pins you are using have both >>> the diodes. The limiting resistor makes such sampling even good >>> for 115VAC if you use a 5 Meg resistor. >> >> That i would have to check. It's been a while since I've used a >> 16f628a. Most things have been on somewhat larger uCs, but >> anything bigger would be overkill. >> >> True enough about the current limiting. It's the difference >> between a sample and a barbecue. > > The only I/O pin on the PIC16F628A that doesn't have both > protection diodes is the RA5/MCLR* pin. It only has the one to > Vss. > > Be careful of voltage dividers. If the ground connection is lost, > the magic smoke tends to escape and things don't work after that.
Also watch out for the capacitance of the input pin. Using the 22k suggested above (22 x 10e3) and a capacitance of 5 pf (5 x 10e-9) the time constant is 100e-6, or 100 uS. For a 12 V signal to rise to 1/3 will take about 1/3 the TC, or about 30 uS. Also, slow rise times on input pins play havoc with internal logic and power dissipation. A divider is probably better controlled. -- <http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt> <http://www.securityfocus.com/columnists/423> "A man who is right every time is not likely to do very much." -- Francis Crick, co-discover of DNA "There is nothing more amazing than stupidity in action." -- Thomas Matthews
Reply by Donald Harris February 11, 20072007-02-11
"Tristan Mumford" <xtristan.xmumford@xgmail.xcom> wrote in message 
news:45cfb70a$0$52924$c30e37c6@lon-reader.news.telstra.net...
> Donald Harris wrote: > >> >> "Tristan Mumford" <xtristan.xmumford@xgmail.xcom> wrote in message >> news:45cf2827$0$83724$c30e37c6@lon-reader.news.telstra.net... >>> Hello, >>> Sorry to be a nuisance but I'm afraid I'm a little stuck. >>> I need to sample 12v signals with a PIC uC. I'm not an engineer nor do I >>> pretend to be, and if I don't know the answer, or how to find it I ask >>> :) >>> >>> Anyway, I'll tell you the reason I need to do this. I need to decode >>> stepper >>> motor phases. I've already written most of the firmware for the uC, and >>> I >>> know how to implement the rest of the device bar this 12v matter. It's a >>> one-off thing for my own interest (initially anyway) so the simpler the >>> better. by simpler I mean cheaper. >>> >>> Any help with this would be greatly appreciated. Thankyou in advance to >>> all >>> those that do. >>> >>> Tristan. >>> >>> >> >> If you only need to sample the presence or absence of the stepper phases >> or >> polarity, just put a 22K series resistor in line to the PIC pins. Most >> of >> the PIC pins have internal diodes to Vdd and Vss. The resistor just >> limits >> the current in the diodes. Check the data sheet to be sure that the pins >> you are using have both the diodes. The limiting resistor makes such >> sampling even good for 115VAC if you use a 5 Meg resistor. >> > > That i would have to check. It's been a while since I've used a 16f628a. > Most things have been on somewhat larger uCs, but anything bigger would be > overkill. > > True enough about the current limiting. It's the difference between a > sample > and a barbecue. > > Thanks for your help! >
The only I/O pin on the PIC16F628A that doesn't have both protection diodes is the RA5/MCLR* pin. It only has the one to Vss. Be careful of voltage dividers. If the ground connection is lost, the magic smoke tends to escape and things don't work after that. Don
Reply by Tristan Mumford February 11, 20072007-02-11
Donald Harris wrote:

> > "Tristan Mumford" <xtristan.xmumford@xgmail.xcom> wrote in message > news:45cf2827$0$83724$c30e37c6@lon-reader.news.telstra.net... >> Hello, >> Sorry to be a nuisance but I'm afraid I'm a little stuck. >> I need to sample 12v signals with a PIC uC. I'm not an engineer nor do I >> pretend to be, and if I don't know the answer, or how to find it I ask :) >> >> Anyway, I'll tell you the reason I need to do this. I need to decode >> stepper >> motor phases. I've already written most of the firmware for the uC, and I >> know how to implement the rest of the device bar this 12v matter. It's a >> one-off thing for my own interest (initially anyway) so the simpler the >> better. by simpler I mean cheaper. >> >> Any help with this would be greatly appreciated. Thankyou in advance to >> all >> those that do. >> >> Tristan. >> >> > > If you only need to sample the presence or absence of the stepper phases > or > polarity, just put a 22K series resistor in line to the PIC pins. Most of > the PIC pins have internal diodes to Vdd and Vss. The resistor just > limits > the current in the diodes. Check the data sheet to be sure that the pins > you are using have both the diodes. The limiting resistor makes such > sampling even good for 115VAC if you use a 5 Meg resistor. >
That i would have to check. It's been a while since I've used a 16f628a. Most things have been on somewhat larger uCs, but anything bigger would be overkill. True enough about the current limiting. It's the difference between a sample and a barbecue. Thanks for your help! -- -----> http://members.dodo.com.au/~izabellion1/tristan/index.html <----- ===== It's not pretty, it's not great, but it is mine. =====
Reply by Tristan Mumford February 11, 20072007-02-11
Gary Reichlinger wrote:

> On Mon, 12 Feb 2007 01:28:47 +1100, Tristan Mumford > <xtristan.xmumford@xgmail.xcom> wrote: > >>Hello, >>Sorry to be a nuisance but I'm afraid I'm a little stuck. >>I need to sample 12v signals with a PIC uC. I'm not an engineer nor do I >>pretend to be, and if I don't know the answer, or how to find it I ask :) > > The usual method to sample voltages above the power supply level > (and reference voltage) is to use a voltage divider. You can probably > find more information on this by doing a web search, but basically it > is just 2 resistors connected in series. The voltage at the contact > between the resistors is a fraction of the original voltage according > to the value of the resistors. For example, if you connect a 10K > resistor to the high voltage and a 5k resistor to ground, the voltage > at the contact of the 2 resistors is 1/3 of the original voltage > (5/(10+5)). Of course, like any ADC connection, you may need > capacitors to control noise and must take into account the amount of > current used by the ADC in setting the value of the resistors.
Oh yeah. That makes sense. I've worked with analog, and digital, but have never really known how to combine the two :) I guess i should shoot for the lowest reliable current though. Still that's dead easy, small and cheap. thanks for that! -- -----> http://members.dodo.com.au/~izabellion1/tristan/index.html <----- ===== It's not pretty, it's not great, but it is mine. =====
Reply by Tristan Mumford February 11, 20072007-02-11
Spehro Pefhany wrote:

> On Mon, 12 Feb 2007 01:28:47 +1100, the renowned Tristan Mumford > <xtristan.xmumford@xgmail.xcom> wrote: > >>Hello, >>Sorry to be a nuisance but I'm afraid I'm a little stuck. >>I need to sample 12v signals with a PIC uC. I'm not an engineer nor do I >>pretend to be, and if I don't know the answer, or how to find it I ask :) >> >>Anyway, I'll tell you the reason I need to do this. I need to decode >>stepper motor phases. I've already written most of the firmware for the >>uC, and I know how to implement the rest of the device bar this 12v >>matter. It's a one-off thing for my own interest (initially anyway) so the >>simpler the better. by simpler I mean cheaper. >> >>Any help with this would be greatly appreciated. Thankyou in advance to >>all those that do. >> >>Tristan. > > Could you provide a bit more information on exactly what you are > trying to do? > > It sounds like you have a stepper driver and wish, for some reason, to > detect (measure?) the voltages going to the motor coils.
Sure. I might as well say exactly what it is. As people may or may not be familiar with, the apple ]['s disk ][ controller provides fairly raw signals to the floppy drive. I'm making an interface for connecting a 3-1/2" PC floppy drive to the preexisting controller. It is intended to be a drop-in replacement. Essentially no skills required to install and no firmwar patches etc needed for it to work. Although a special formatting program will be required. My initial idea was to modify a preexisting 3-1/2" drive. However i quickly discovered it was impossible because the 5-1/4" drives use unipolar steppers, and the 3-1/2" drives use a bipolar stepper. The uC logic handles the directional translation to direction and step signals, and a few other features. So anyway, the firmware is mostly done. it needs optimising before it will be usable though. There is a usable amount of time to do the processing and step the 3-1/2" drive's head. I hope this answers your question. Tristan. -- -----> http://members.dodo.com.au/~izabellion1/tristan/index.html <----- ===== It's not pretty, it's not great, but it is mine. =====
Reply by Donald Harris February 11, 20072007-02-11
"Tristan Mumford" <xtristan.xmumford@xgmail.xcom> wrote in message 
news:45cf2827$0$83724$c30e37c6@lon-reader.news.telstra.net...
> Hello, > Sorry to be a nuisance but I'm afraid I'm a little stuck. > I need to sample 12v signals with a PIC uC. I'm not an engineer nor do I > pretend to be, and if I don't know the answer, or how to find it I ask :) > > Anyway, I'll tell you the reason I need to do this. I need to decode > stepper > motor phases. I've already written most of the firmware for the uC, and I > know how to implement the rest of the device bar this 12v matter. It's a > one-off thing for my own interest (initially anyway) so the simpler the > better. by simpler I mean cheaper. > > Any help with this would be greatly appreciated. Thankyou in advance to > all > those that do. > > Tristan. > >
If you only need to sample the presence or absence of the stepper phases or polarity, just put a 22K series resistor in line to the PIC pins. Most of the PIC pins have internal diodes to Vdd and Vss. The resistor just limits the current in the diodes. Check the data sheet to be sure that the pins you are using have both the diodes. The limiting resistor makes such sampling even good for 115VAC if you use a 5 Meg resistor. Don
Reply by Gary Reichlinger February 11, 20072007-02-11
On Mon, 12 Feb 2007 01:28:47 +1100, Tristan Mumford
<xtristan.xmumford@xgmail.xcom> wrote:

>Hello, >Sorry to be a nuisance but I'm afraid I'm a little stuck. >I need to sample 12v signals with a PIC uC. I'm not an engineer nor do I >pretend to be, and if I don't know the answer, or how to find it I ask :)
The usual method to sample voltages above the power supply level (and reference voltage) is to use a voltage divider. You can probably find more information on this by doing a web search, but basically it is just 2 resistors connected in series. The voltage at the contact between the resistors is a fraction of the original voltage according to the value of the resistors. For example, if you connect a 10K resistor to the high voltage and a 5k resistor to ground, the voltage at the contact of the 2 resistors is 1/3 of the original voltage (5/(10+5)). Of course, like any ADC connection, you may need capacitors to control noise and must take into account the amount of current used by the ADC in setting the value of the resistors.
Reply by Spehro Pefhany February 11, 20072007-02-11
On Mon, 12 Feb 2007 01:28:47 +1100, the renowned Tristan Mumford
<xtristan.xmumford@xgmail.xcom> wrote:

>Hello, >Sorry to be a nuisance but I'm afraid I'm a little stuck. >I need to sample 12v signals with a PIC uC. I'm not an engineer nor do I >pretend to be, and if I don't know the answer, or how to find it I ask :) > >Anyway, I'll tell you the reason I need to do this. I need to decode stepper >motor phases. I've already written most of the firmware for the uC, and I >know how to implement the rest of the device bar this 12v matter. It's a >one-off thing for my own interest (initially anyway) so the simpler the >better. by simpler I mean cheaper. > >Any help with this would be greatly appreciated. Thankyou in advance to all >those that do. > >Tristan.
Could you provide a bit more information on exactly what you are trying to do? It sounds like you have a stepper driver and wish, for some reason, to detect (measure?) the voltages going to the motor coils. Best regards, Spehro Pefhany -- "it's the network..." "The Journey is the reward" speff@interlog.com Info for manufacturers: http://www.trexon.com Embedded software/hardware/analog Info for designers: http://www.speff.com