Shop OBEX P1 Docs P2 Docs Learn Events
Reading the state of a BS2 pin from SX — Parallax Forums

Reading the state of a BS2 pin from SX

BobHBobH Posts: 33
edited 2006-07-17 21:12 in General Discussion
Pretty new to the SX chip and I'm stymied by a problem that should be pretty easy. All I want to do is have an SX pin monitor the state of a BS2 pin. No interrupts needed or anything complicated I just need to be able to determine if the BS2·pin is high or low.

Been trying but can't seem to get it to work. Any help would be appreciated. Using SX/B and a SX28 chip

Thanks
Bob

Comments

  • Kevin WoodKevin Wood Posts: 1,266
    edited 2006-07-16 19:51
    How are you trying to do this? I think you only have a few basic options:

    1. Monitor the voltage in such a way that when the pin goes high, it places the 5v on a line into the SX, and the SX detects this.

    2. Create some form of comms protocol between the SX - BS2, so that when the BS2 pin goes high it sets a status flag. Transmit the value of the flag to the SX from the BS2.

    3. Use some form of sensor set-up, such as an led and a photodetector. When the BS2 pin goes high, the led lights up, and the detector registers this. Other sensors could be used, but the idea is the same.
  • BobHBobH Posts: 33
    edited 2006-07-16 20:13
    My attempts so far revolve around number 1. Basically I've been just trying to get an SX pin to mirror the state of the BS2 pin.
  • Dave HeinDave Hein Posts: 6,347
    edited 2006-07-16 21:55
    It's still not clear what you are trying to do.· It sounds like you want the SX to either monitor an input pin on the BS2, or an output pin on the BS2.· The output pin is trivial.· You just tie the output pin on the BS2 to a pin configured as an input on the SX.

    If you are trying to monitor an input to the BS2 you could tie the BS2 and SX inputs together and hope that have the same logic thresholds.· It may be better for the BS2 to read its input pin, and then put the result out on another pin that is tied to the SX.

    Dave
  • BobHBobH Posts: 33
    edited 2006-07-17 15:01
    Baiscally just now trying to get it to monitor an output pin on the BS2. I'm sure it should be simple but I can't seem to accomplish it.

    I'm trying to use the SX chip to run two servos on pins RB1 and RB2. No problem with that code.

    Now I'm just trying to have the BS2 send a signal to turn on and off the servo routine. Using an active high (or an actove low) switch connected to RC7 works but as soon as I use the BS2 as the switch it doesn't work. They are on seperate power supplies but the grounds are tied.

    I'm sure I'm missing something very simple here but it's driving me crazy. A code snippet and/or a wiring diagram would be very much appreciated.

    Thank you for your time.

    Bob
  • NateNate Posts: 154
    edited 2006-07-17 15:19
    Actually, if you were to attach your wiring diagram and code, you would probably get a faster reply.



    Nate


    Post Edited (Nate) : 7/17/2006 3:25:55 PM GMT
  • Dave HeinDave Hein Posts: 6,347
    edited 2006-07-17 17:09
    Bob,

    It sounds like the SX is working correctly, since it works OK with a switch driving the input pin. The problem must with the BS2. You should verify that the BS2 is driving the output pin correctly by checking it with a voltmeter or put an LED with a series resistor on the output pin.

    Dave
  • BobHBobH Posts: 33
    edited 2006-07-17 21:04
    Ok. Figured it out. I was defining the pin directions incorrectly.

    I'm very new to the SX chip but slowly working it out.

    Thanks for the help.

    Bob
  • BeanBean Posts: 8,129
    edited 2006-07-17 21:12
    Bob, not to beat-up on a newbie but, that's why it's important to post your code.
    We probably could have had it figured out in a couple minutes.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com

    "Remember, you are unique, just like everyone else." Unknown.
    ·
Sign In or Register to comment.