Shop OBEX P1 Docs P2 Docs Learn Events
State of logic in the propeller pins. — Parallax Forums

State of logic in the propeller pins.

SONIC the HedgehogSONIC the Hedgehog Posts: 321
edited 2012-02-14 16:05 in Propeller 1
Earlier today I was reading about tristate logic gates and found what I thought might be a great use in making effective use of four-push button switches and a DTDP switch. Basically I was thinking this, I wanted the propeller to recognize and respond correctly when the pins went low, and when they went high. The four switches I am using have two pins, and one goes to a pin on the propeller, while the other goes to the DTDP which can be moved to change the switches from low to high, and basically I was curious. Does the propeller have tristate logic, or does it just go high and low?

Comments

  • HShankoHShanko Posts: 402
    edited 2012-02-13 20:11
    If one changes the pin state to INPUT, it then is effectively in 'tri-state' high-impedance state. Thus one can make a pin output HI, output LO and output 'float'.
  • SONIC the HedgehogSONIC the Hedgehog Posts: 321
    edited 2012-02-14 04:08
    How would one make the output float?
  • LeonLeon Posts: 7,620
    edited 2012-02-14 04:12
    Make it an input, as Harley said.
  • SONIC the HedgehogSONIC the Hedgehog Posts: 321
    edited 2012-02-14 04:13
    Ahhhhh, I get it now! Thanks for helping out!
  • cavelambcavelamb Posts: 720
    edited 2012-02-14 10:38
    Earlier today I was reading about tristate logic gates and found what I thought might be a great use in making effective use of four-push button switches and a DTDP switch. Basically I was thinking this, I wanted the propeller to recognize and respond correctly when the pins went low, and when they went high. The four switches I am using have two pins, and one goes to a pin on the propeller, while the other goes to the DTDP which can be moved to change the switches from low to high, and basically I was curious. Does the propeller have tristate logic, or does it just go high and low?

    Hi Sonic,

    Can you sketch this circuit out?
    The description sounds a bit odd and it might help clarify things if you could draw what you are thinking...

    A DPDT switch is basically two switches in physical parallel.
    But DPDT has more that two pins.
    Two pins only would more likely be a SPST

    Richard
  • SONIC the HedgehogSONIC the Hedgehog Posts: 321
    edited 2012-02-14 10:43
    cavelamb wrote: »
    Hi Sonic,

    Can you sketch this circuit out?
    The description sounds a bit odd and it might help clarify things if you could draw what you are thinking...

    A DPDT switch is basically two switches in physical parallel.
    But DPDT has more that two pins.
    Two pins only would more likely be a SPST

    Richard
    Sure! I'll make the drawing now and upload it later. I'm not really sure if this will work my self and it just kinda popped in my head, so I thought I'd try it.
  • ChrisGaddChrisGadd Posts: 310
    edited 2012-02-14 13:28
    Are you wanting to read tri-state inputs? A technique I used with other microcontrollers had an IO pin connected through a current-limiting resistor to the common terminal of a three-position switch, with Vcc and gnd connected to the other terminals. The program reads the switch position by first outputting a high and reading the level on the IO pin. A high or a floating line will be read as a high input. Next the program outputs a low and again reads the level on the IO pin. A low or a floating line will be read as a low input. If the switch is connected to Vcc, the program will read high both times. If the switch is floating, it will read high once and low once. If the switch is low, it will read low both times.
    I recreated this circuit on the Propeller with limited success; 10ohms was the largest value of current-limiting resistor that still allowed the program to work. 3.3V through 10ohms = 330ma, quite a bit more than the 40ma that the pins are rated for. An alternative would use two IO pins, one to bias the line high and low and the other to read the level.
  • SONIC the HedgehogSONIC the Hedgehog Posts: 321
    edited 2012-02-14 13:58
    ChrisGadd wrote: »
    Are you wanting to read tri-state inputs? A technique I used with other microcontrollers had an IO pin connected through a current-limiting resistor to the common terminal of a three-position switch, with Vcc and gnd connected to the other terminals. The program reads the switch position by first outputting a high and reading the level on the IO pin. A high or a floating line will be read as a high input. Next the program outputs a low and again reads the level on the IO pin. A low or a floating line will be read as a low input. If the switch is connected to Vcc, the program will read high both times. If the switch is floating, it will read high once and low once. If the switch is low, it will read low both times.
    I recreated this circuit on the Propeller with limited success; 10ohms was the largest value of current-limiting resistor that still allowed the program to work. 3.3V through 10ohms = 330ma, quite a bit more than the 40ma that the pins are rated for. An alternative would use two IO pins, one to bias the line high and low and the other to read the level.

    What I was going for was to switch between high and low, using the third state so that when I switch the state of my buttons, the pins would recognize the third state and do nothing so no inputs are misread. But I might also have to try the circuit you depicted. I'll draw up the circuit when I get home.
  • cavelambcavelamb Posts: 720
    edited 2012-02-14 14:49
    ChrisGadd wrote: »
    Are you wanting to read tri-state inputs? A technique I used with other microcontrollers had an IO pin connected through a current-limiting resistor to the common terminal of a three-position switch, with Vcc and gnd connected to the other terminals. The program reads the switch position by first outputting a high and reading the level on the IO pin. A high or a floating line will be read as a high input. Next the program outputs a low and again reads the level on the IO pin. A low or a floating line will be read as a low input. If the switch is connected to Vcc, the program will read high both times. If the switch is floating, it will read high once and low once. If the switch is low, it will read low both times.
    I recreated this circuit on the Propeller with limited success; 10ohms was the largest value of current-limiting resistor that still allowed the program to work. 3.3V through 10ohms = 330ma, quite a bit more than the 40ma that the pins are rated for. An alternative would use two IO pins, one to bias the line high and low and the other to read the level.


    If you were going to use 2 pins then go with the more traditional approach...

    Both will show HI wne the switch is centered and the softeware is a lot simpler...

    DPDT.jpg
    883 x 613 - 43K
  • SONIC the HedgehogSONIC the Hedgehog Posts: 321
    edited 2012-02-14 14:58
    cavelamb wrote: »
    If you were going to use 2 pins then go with the more traditional approach...

    Both will show HI wne the switch is centered and the softeware is a lot simpler...

    DPDT.jpg
    Good point....
  • SONIC the HedgehogSONIC the Hedgehog Posts: 321
    edited 2012-02-14 16:05
    Rethinking it, the software would be too complex to incorporate into a workable "controller" so to say, so instead of going out and getting one I decided that I'd gather up some pushbutton switches and see what I can do with that. Thanks for all the help, I learned a lot and will use this information in future projects, and of course will post my results using eight pushbutton switches as a controller to my blog! Once again, thanks a bunch!
Sign In or Register to comment.