Shop OBEX P1 Docs P2 Docs Learn Events
ReadPin — Parallax Forums

ReadPin

Nicholas BottNicholas Bott Posts: 12
edited 2007-01-10 04:58 in General Discussion
This is probably going to sound really stupid; but, I can't seem to get a pin to read when I send positive current to it. I'm not even sure if that's the approach I should be using. Here is my scenario:

I wrote a nifty class for the littleStepU component. While the component is in operation it sends a busy signal. The busy signal is a 5v load on a busy pin on the component. I need to be able to read this value when it's high. I tried setting a microcontroller pin for input and using ReadPin - I think the code is good; but my circuit is bad.

Can you describe a basic circuit to read from that busy pin? Note: the busy pin shares the same circuit as the stamp, it's not isolated.

Also, Peter (since you'll probably be the one who answers this), your help with the DC-16 class was invaluable when I wrote a class to communicate with the littleStepU component, so thanks a lot for your help!

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2007-01-10 04:58
    If that busy pin outputs a low (0V) or high (5V) signal, then you
    can directly, or via a 1k resistor, connect the busy pin to a javelin i/o pin.
    If the busy pin happens to be an open collector, then you need a pullup
    resistor to 5V. This pullup may also be present in case it is not an
    open collector.
    The circuit that should work in all cases:

    ····························+5V
    ···························· |
    ···························[noparse][[/noparse]10k]
    ·····························|
    device busy pin o----[noparse][[/noparse]1k]----+
    o javelin i/o pin
    device gnd o
    o javelin gnd

    In your javelin program use

    CPU.setInput(CPU.pin0);
    CPU.readPin(CPU.pin0);

    regards peter
Sign In or Register to comment.