Shop OBEX P1 Docs P2 Docs Learn Events
Latching an Input — Parallax Forums

Latching an Input

ArchiverArchiver Posts: 46,084
edited 2003-09-01 04:01 in General Discussion
Hello,

I am new to the group and have had great fun using my BS2-ic for various
things around my model railroad.

My Lionel model railroad is slowly becoming completely computer
controlled. I built custom PC boards that interface with track switches
and accessories.

I would like to activate some sort of "latched" or "interrupt style" input
that could catch an input on a pin and then I go see if it has changed in
the BS2 cycle. Or actually use an input pin as a program interrupt.

Is any of this possible?

Greg

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-09-01 02:55
    In a message dated 8/31/2003 6:18:33 PM Pacific Daylight Time,
    conductor@t... writes:
    My Lionel model railroad is slowly becoming completely computer
    controlled. I built custom PC boards that interface with track switches
    and accessories.

    I would like to activate some sort of "latched" or "interrupt style" input
    that could catch an input on a pin and then I go see if it has changed in
    the BS2 cycle. Or actually use an input pin as a program interrupt.

    Is any of this possible?

    Greg
    You can use a thing called a RS flip flop. This device, once tripped will
    remain in the "tripped" state unitl you "clear" it. If you need more detail or
    device number, write back....

    Ken


    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2003-09-01 04:01
    You might consider structuring your code so that you can check inputs
    frequently and deal with them, otherwise proceed to your normal code.
    Something like this:

    Main:
    DO
    GOSUB Get_Inputs
    IF (inBuf > 0) THEN
    ' handle inputs
    ENDIF
    ' high-level task manager
    ON task GOSUB Task1, Task2, Task3 ...
    task = task + 1 // NumTasks
    LOOP

    -- Jon Williams
    -- Applications Engineer, Parallax
    -- Dallas Office



    Original Message
    From: Greg McMurry [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=5lj27YQiVlBIQRAgIck8H4f-U7QqXszmN83KavYmCOcmAudr25XB9XEeqjGkpCY-L3L7Y9esDWsVeO41CQ]conductor@t...[/url
    Sent: Friday, August 29, 2003 2:11 PM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] Latching an Input


    Hello,

    I am new to the group and have had great fun using my BS2-ic for various

    things around my model railroad.

    My Lionel model railroad is slowly becoming completely computer
    controlled. I built custom PC boards that interface with track switches

    and accessories.

    I would like to activate some sort of "latched" or "interrupt style"
    input
    that could catch an input on a pin and then I go see if it has changed
    in
    the BS2 cycle. Or actually use an input pin as a program interrupt.

    Is any of this possible?

    Greg



    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject
    and Body of the message will be ignored.


    Your use of Yahoo! Groups is subject to
    http://docs.yahoo.com/info/terms/




    This message has been scanned by WebShield. Please report SPAM to
    abuse@p....
Sign In or Register to comment.