Shop OBEX P1 Docs P2 Docs Learn Events
code question for car security application — Parallax Forums

code question for car security application

GiuseppeGiuseppe Posts: 51
edited 2009-01-02 16:53 in BASIC Stamp
Hey everyone. I have question on perhaps a possible command BS2 might have. I want to know if there it anyway to completely turn an I/O pin completely OFF. No HIGH or LOW on the pin, just no electric potential whatsoever for either polarity on it. I know you can turn something on and off (like an LED) by applying two LOW signals for each lead for off and one HIGH and one LOW signal for on. Is there to do something like "Insert Example Command" followed by "Example Pin Here"? I don't something like
OFF 14.

Comments

  • GiuseppeGiuseppe Posts: 51
    edited 2009-01-02 02:23
    WAIT! I just figured it out. I can just use a PULSOUT command for what I have to do. Sorry for the hassle!
  • allanlane5allanlane5 Posts: 3,815
    edited 2009-01-02 02:29
    Another alternative is to say "INPUT PinNum".

    Turn a pin into an Input, and both output drivers are disconnected. The input reciever has really high impedance (10 Megohm or so) but no applied voltage from the BS2.

    Mind you, this make the input pin into an antenna, if nothing else is putting a voltage on that pin. But that sounds like what you're asking for.

    Oh, I forgot to warn you -- each I/O pin has a "protection diode" to both high and low, which will 'clip' an input signal to 0 volts, or 5 volts (inside the BS2), if the input signal is lower than zero volts or higher than 5 volts.· However -- these diodes don't conduct much current before they are damaged.· Thus, if you ARE trying to read a 12-volt signal, you'll need a 22 Kohm resistor in series with that signal to prevent damage.·

    Post Edited (allanlane5) : 1/2/2009 3:37:37 AM GMT
  • GiuseppeGiuseppe Posts: 51
    edited 2009-01-02 02:36
    Ah that is a much better idea. I came across another problem and I was going to ask if there is a way to use PULSOUT to send LOW signal. I was going to mimic this by adding additional transistors and such but the INPUT statement make life much easier and cost effective. Thanks a bunch.
  • GiuseppeGiuseppe Posts: 51
    edited 2009-01-02 16:53
    Okay. Everyone's advice that I have taken was great and I finally applied it. The attachment is what I have done so far. It is a bitmap image of a schematic that I drew up on ExpressSCH. My goal was to mimic door lock wires that are similar to remote start modules. All they do is send a pulse to the car's door lock or unlock relay to do the task. Some cars are positively switched and some are switched by vehicle's ground. So I wanted it to be easy to install in either scenario. When a piece of code tells one wire to go one polarity it also tell the other wire to do the opposite. So in a case with either factory wiring from the car, the wires can be merely switched during installation. Here is the code that I wrote to do that :

    *Assume PIN definitions are already declared*
        HIGH      DoorWire1                 ' sends unlock pulse for respective wire
        LOW       DoorWire2                 ' sends unlock pulse for respective wire
        PAUSE     250                          ' pulse length is a quarter second
        INPUT     DoorWire1                 ' pulse ends for respective wire
        INPUT     DoorWire2                 ' pulse ends for respective wire
    
    



    and for the opposite :
        LOW       DoorWire1                 ' sends lock pulse to respective wire
        HIGH      DoorWire2                 ' sends lock pulse to respective wire
        PAUSE     250                          ' pulse length is a quarter second
        INPUT     DoorWire1                 ' pulse ends for respective wire
        INPUT     DoorWire2                 ' pulse ends for respective wire
    
    


    This code goes along with the bitmap image I attached. Perhaps I over complicated it. Ha because it seems like too much work to do a simple task. Any advice and comments would be greatly appreciated! Also, if this not the place to post stuff like this, I apologize and will next time post it in the appropriate thread.

    *1/3/09*

    I updated the circuit and I think I made it better. I took out the relays and just blocked the short at Vss and Vdd by diodes. I am also now protecting the transistors with diodes.

    Post Edited (Giuseppe) : 1/3/2009 5:41:51 PM GMT
Sign In or Register to comment.