Searching \ for 'Err, this is SO confusing =(' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/index.htm?key=err+confusing
Search entire site for: 'Err, this is SO confusing =('.

Truncated match.
PICList Thread
'Err, this is SO confusing =('
1999\04\05@192509 by IMDNICE12

picon face
Dear Geniuses,

This is my attempt to help get the list back on topic. I received my samples
from Maxim, the MAX187, it's a 12-Bit Serial ADC. Anyways, I get so
discouraged over the idea of 3-Wire interfaces. I'm coming here as a last
resort, I've tried MANY search engines on this topic, but the sites I come up
with are hard to understand. I think it's due to my lack of knowledge in
electronics. Ok, I'll get to the point. What I want to do is use a Cds Cell
for light measurement (duh) using an ADC. But this is where I get stuck. I've
read and understand the general operation of the 3-wire bus, BUT, I'm not
sure as to how exactly it's done. I want to interface this ADC to my parallel
port so that way I can test it, and learn it.  I know most of you guys (and
gals) can implement this protocol in a PIC with no problem, but for me, I
feel like I would be doing it blindly. I usually use VB, and I use the
debugger window to output data recv'd on the printer port. It all comes down
to this...is there a simple way to use the parallel port to control this ADC?
I know that once I master the operation on a parallel port, that I could
easily master it on the PIC (because I don't have to worry about inverted
signals). And another (I know I'll owe ya guys big for all these questions)
question, if I use pullups, how is it possible to bring a line LOW if it's
being pulled up to Vdd? I could go on and on with questions, but many of them
I feel I could answer myself with a little more study, but these questions
are the toughies. If I ever strike it rich with an idea, I'll make sure and
send a check to you guys =)

It's hard to express appreciation in words....but,

THANK YOU,

Tim H.

1999\04\05@195418 by wagnerl

picon face
Tim, if you can control individually 2 pins (output) of the PC parallel
port, and read a third pin as input, then you are able to make it works.

The procedure is simple;

1) Max187 pin 1 and 3 to +5Vdc, pin 4 with a cap 1-10uF to ground, pin 5
to ground, analog input (up to +5Vdc) to pin 2.  

2) Connect one Parallel port output pin to Max187 pin 7 (CS), and
another to pin 8 (SCLK). The parallel port input pin goes to Max187 pin
6 (DOUT).

3) At parallel port set output CS up and output SCLK down.

4) Now set CS output pin DOWN (ground). It starts the Max187 internal
conversion sequence.

5) Read Max187 pin 6 (DOUT), it would be low level, wait it to comes up,
it means the Max187 conversion is done (It can take ±9us).

6) Now you need a sequence of 16 loops to generate the SCLK pulses to
get the serial data out of the Max187. Just flip up, and then flip down
the SCLK at the parallel port, then read pin DOUT. This would be the
first bit, high order bit.  Repeat SCLK up and down more 15 times,
reading the DOUT pin.

7) Max187 would supply you the 12 conversion bits at the first 12
failing SCLK pulses, the last 4 bits will be zeros, just ignore them.
If the Max187 16 bits output is 0001 1001 0100 0000, just ignore the
last four, your reading value would be 194 in hexadecimal.

8) it is not imperative to send 16 SCLK pulses, you can abort it right
after the 13th SCLK bit, raising CS pin.

I think this will works.  You can contact me directly if needed.

Wagner.

1999\04\05@195829 by wagnerl

picon face
Tim, about the pullups... think of it just as an elastic rubber band
pulling something up, you can easily pull it down to ground with your
hand because the "pull up" is elastic and weak, right?  The same with
the pull up resistors, they just pull Vdd level to that pin, but another
low level signal stronger than what the resistor is doing would pull
that pin voltage to ground...  The pull up voltage offered by pull up
resistors (5k or more Ohms) is somehow weak and any circuit output pin
(like the PIC output port pins or PC parallel output pins) can take it
easily to ground if that pin is programmed low level.

Wagner.

1999\04\06@100310 by Dmitry Kiryashov

flavicon
face
Hi Tim. Here is my two cents ;-)

> And another (I know I'll owe ya guys big for all these questions) question, if
> I use pullups, how is it possible to bring a line LOW if it's being pulled up
> to Vdd?

Pullups usually used in bus shared environments, for instance you need
to read some
wire and to drive it in some other time. For this purpose you clear some
bit in PIC
TRIS (bcf TRISx,your_pin - don't forget about current data bank ;-) and
set the same
bit in PORT latch(bsf PORTx,your_pin) After these manipulations ;-) you
pull-up your
pin. If TRIS bit is low you'll drive bus wire low. From the other hand
if TRIS is high
you're able to read bus wire(read directly from PORTx,your_pin). This
trick is used
for instance in I2C bus and many others.

WBR Dmitry.

1999\04\06@133136 by Nigel Goodwin

flavicon
picon face
In message <spam_OUT9de4f92f.243a9ffcTakeThisOuTspamaol.com>, Tim Hamel <.....IMDNICE12KILLspamspam@spam@AOL.COM>
writes
{Quote hidden}

I would suggest you buy a book about PC interfacing, I've just bought
one which includes various ADC routines (although not the MAX187) - you
can also download the source code from their web site.

'PC Interfacing using Centronics, RS232 and Game Ports' by Pei An
ISBN 0 2405 1448 3
http://www.bh.com

However, I have recently seen a project somewhere for using a MAX187 via
a parallel port - but I can't remember where :-(.
--

Nigel.

       /--------------------------------------------------------------\
       | Nigel Goodwin   | Internet : nigelgspamKILLspamlpilsley.demon.co.uk     |
       | Lower Pilsley   | Web Page : http://www.lpilsley.demon.co.uk |
       | Chesterfield    | Official site for Shin Ki Ju Jitsu         |
       | England         |                                            |
       \--------------------------------------------------------------/

1999\04\06@202736 by Steve Tomes

flavicon
face
At 10:03 AM 4/6/99 -0400, you wrote:
>Hi Tim. Here is my two cents ;-)
>
>> And another (I know I'll owe ya guys big for all these questions)
question, if
>> I use pullups, how is it possible to bring a line LOW if it's being
pulled up
>> to Vdd?

For what it's worth....

       Think of electricity/current..as water........
If you have a bucket with a valve filling it that is 1/4 open...it will
slowly fill up......
If the bucket has a drain valve and it is full open....it will empty the
bucket..even though it is being filled...but only 1/4 flow....]
the full open drain will cause the bucket to empty...
close the drain valve and the bucket will fill!!!!

1999\04\07@185438 by IMDNICE12

picon face
Thanks for the code! VB is a bit easier for me to understand than C.

About the Reply To thing, it's an AOL thing, I can't control it, UNLESS, I
were to use and external mail program, but AOL is too security conscious to
allow that =( I do apologize for this.

Tim H.

In a message dated 99-04-07 10:03:44 EDT, you write:

> Tim, I noticed that you had your "Reply To" field set to your personal
>  email address. Please avoid this as the purpose of this group is to share
>  ideas. I'm re-posting my reply to the public list.

1999\04\29@171927 by John Payson

flavicon
face
|Tim, about the pullups... think of it just as an elastic rubber band
|pulling something up, you can easily pull it down to ground with your
|hand because the "pull up" is elastic and weak, right?  The same with
|the pull up resistors, they just pull Vdd level to that pin, but another
|low level signal stronger than what the resistor is doing would pull
|that pin voltage to ground...  The pull up voltage offered by pull up
|resistors (5k or more Ohms) is somehow weak and any circuit output pin
|(like the PIC output port pins or PC parallel output pins) can take it
|easily to ground if that pin is programmed low level.

Nice analogy, one I'd (for whatever reason) not heard before.  Another
couple analogies:

[1] The keys on a typical keyboard have springs in them which keep the
   keys raised when you are not pushing them.  If you activly push down
   on a key, however, it's easy to overcome the spring and force it to
   make contact.  If the springs were absent, the keys would droop down
   and could intermittently make contact even when you weren't pushing
   them.  You could be sure that if you pushed down on a key it would
   register as pressed, and if you manually held a key up it would reg-
   ister as released, but if you weren't touching the key it could act
   as either.

[2] In many busses [mass-transit vehicles], the bus drivers attempt to
   save time by not stopping at locations where no passengers wish to
   board or disembark.  To allow passengers on the bus to indicate that
   they wish to stop at the next location, there is a pull-cord on
   either side of the bus just below the luggage rack.  Any passenger
   who wishes to signal the driver to stop may pull the cord, overcom-
   ing spring tension and causing a bell to ring.

   The electronic equivalent to this arrangement is a "wired-or" bus:
   any device which is capable of pulling down the bus can cause it
   to be pulled low.  This type of arrangement is used very frequently
   in microprocessor systems to allow any of several devices to signal
   to the CPU that they need attention.  Once the signal is received,
   the CPU will still have to determine who wanted attention, but such
   polling only needs to be done when at least one device needs atten-
   tion.  Most of the time, when nobody needs attention, the CPU can
   simply execute the main code without having to poll anything.

1999\04\30@105851 by John Payson

flavicon
face
IMDNICE12@aol.com [SMTP:.....IMDNICE12KILLspamspam.....aol.com] wrote:
|I REALLY appreciate your analogy, it was even more helpful than the rubber
|band (I'm not slamming his analogy). I realize now, the exact purpose. The
|resistor limits the voltage to a point where it's at a logic high, but it can
|still be pulled low, thus leaving the input at a known state....I GOT IT =)
|
|I hope you forgive my lack of knowledge here, but where do open-collector
|inputs come into play?
|
|Thanks again for the oh-so-easy to understand analogy(ies)

The term "open-collector input" is rather a misnomer; the term is used to
describe a digital output.  In the case of PIC port pin RA4, what's sign-
ificant is that the output driver on the pin is open-collector; this does
have some effects on use of the pin as an input, however.

An open-collector (or open-drain) output is one which can pull a pin low
or leave it floating, but which cannot pull the pin high.  For such an
output to be useful, something else (such as a pull-up resistor) must pull
the pin high.  Such outputs are generally useful in three cases:

-1- There is a signal wire which may be pulled low by more than one
    device.  A device which isn't pulling the line low should not pre-
    vent other devices from doing so.

-2- An output which switches high and low will be limitted to switching
    voltages between the supply rails; a normal PIC output can't switch
    anything over about 5.5 volts (assuming a 5.5v supply).  An open-
    collector output, combined with a pull-up to a higher voltage, can
    switch a higher voltage (within the breakdown limits of the device--
    about 10-12 volts for the PIC RA4; more on some other devices).

-3- When driving certain kinds of devices like LED's or relays, what's
    important is not the voltage on the output pin but the amount of
    current it can sink.  If you have a series string of 8 2.0v LED's
    along with a suitable current-dropping resistor, running off a 24v
    supply, the LED's are only going to glow if current is being pulled
    through them.  If such a string were driven from port pin RA4, it
    would be good to provide a zener or similar device to protect ag-
    ainst the port pn exceeding 10 volts or so, but what's significant
    is not so much the voltage on RA4 as the current flowing into it.

1999\04\30@121900 by Mark Willis

flavicon
face
The GOOD news is that AOL users know how TO set their reply-to address
to point to themselves, folks - they just cannot choose otherwise.
That's a good by-product of this <G>

 (Also, actually, SPAMmers do use other mail programs - to send through
non-AOL mail servers, and I guess to send SPAM inside AOL, from what I
hear.  Just honest regular users aren't allowed to do this <G>)

 Good to see some newer/less experienced users getting help here, I
like it <G>

 Mark

Tim Hamel wrote:
> <snipped>
> About the Reply To thing, it's an AOL thing, I can't control it, UNLESS, I
> were to use and external mail program, but AOL is too security conscious to
> allow that =( I do apologize for this.
>
> Tim H.

1999\04\30@132525 by Tim Hamel

picon face
In a message dated 4/30/99 9:19:19 AM Pacific Daylight Time,
EraseMEmwillisspam_OUTspamTakeThisOuTNWLINK.COM writes:

> The GOOD news is that AOL users know how TO set their reply-to address
>  to point to themselves, folks - they just cannot choose otherwise.
>  That's a good by-product of this <G>
>
>    (Also, actually, SPAMmers do use other mail programs - to send through
>  non-AOL mail servers, and I guess to send SPAM inside AOL, from what I
>  hear.  Just honest regular users aren't allowed to do this <G>)
>
>    Good to see some newer/less experienced users getting help here, I
>  like it <G>
>
>    Mark
>

And the BAD thing about AOL is the spam. I've sort of put together an
independent study on SPAM. I figured it out! When you go into a chat room,
there's usually one or two "Name Retrievers" who collect your name, and stick
on the list, then they leave. How I figured it out was...I haven't been into
a chat room for a LONG time, and my spam has reduced dramatically. And
regarding the Reply To part. If I could change it, believe me I would! I do
apologize for the hassle it causes =(  I also VERY much enjoy this list. It
has kick-started me from just knowing that I had a 16C84 in my hand, to being
able to implement (in something, I don't know yet!). I can't express enough
appreciation to you all.

Thank you again,

Tim H.

More... (looser matching)
- Last day of these posts
- In 1999 , 2000 only
- Today
- New search...