Shop OBEX P1 Docs P2 Docs Learn Events
BS2P40 polling question — Parallax Forums

BS2P40 polling question

ArchiverArchiver Posts: 46,084
edited 2002-09-20 17:56 in General Discussion
With two sets of I/O pins on the 40 pin version how do I handle this situation:

Main I/O pin p15

Aux I/O pin X15

Is this even possible?? If so how do I let the Poll commands know I want to
"watch" both pin 15's??

Thanks

MIke B.


[noparse][[/noparse]Non-text portions of this message have been removed]

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2002-09-02 23:52
    Mike,
    When you set pin15s to do polling on the MAINIO and AUXIO both are active all
    the time. Some example code below:

    mainio
    pollmode 0 'deactivate polling interrupts
    pollout 0,1 'if an interrupt occours make pin0 high
    pollin 15,0 'set active when pin15 goes low
    auxio
    pollin 15,1 'set active when pin15 goes high
    mainio
    pollmode 2 'activate polling
    start: 'do program and if an interrupt occurs pin0
    (mainio) will go high
    For x=128 to 131 'read all pins (mainio, 128 & 129, and auxio, 130 &131)
    to determine which polling pin was active
    get x,y
    debug bin8 y,cr 'screen print in binary
    next

    goto start

    Hope this helps.
    Chuck
  • ArchiverArchiver Posts: 46,084
    edited 2002-09-03 00:05
    Alright Chuck.

    That answered my question. The manual is pretty vague in this area and I
    am having a hard time getting up to speed on these new (to me) commands in
    the 'P' series chips. I have a pretty complex hardware environment to keep
    track of and need to be pretty sharp on the polling stuff and also running
    programs in the various slots to make sure I don't lose track of my under
    water vessel ! ! Were getting there slowly but surely.

    Thanks again..

    Mike B.

    Original Message
    From: <CHIPKEN@a...>
    To: <basicstamps@yahoogroups.com>
    Sent: Monday, September 02, 2002 3:52 PM
    Subject: Re: [noparse][[/noparse]basicstamps] BS2P40 polling question


    > Mike,
    > When you set pin15s to do polling on the MAINIO and AUXIO both are active
    all
    > the time. Some example code below:
    >
    > mainio
    > pollmode 0 'deactivate polling interrupts
    > pollout 0,1 'if an interrupt occours make pin0 high
    > pollin 15,0 'set active when pin15 goes low
    > auxio
    > pollin 15,1 'set active when pin15 goes high
    > mainio
    > pollmode 2 'activate polling
    > start: 'do program and if an interrupt occurs pin0
    > (mainio) will go high
    > For x=128 to 131 'read all pins (mainio, 128 & 129, and auxio, 130
    &131)
    > to determine which polling pin was active
    > get x,y
    > debug bin8 y,cr 'screen print in binary
    > next
    >
    > goto start
    >
    > Hope this helps.
    > Chuck
    >
    > 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/
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2002-09-15 17:31
    Progress however slight is progress. I have the need to react every second to a
    1 Hz squarewave, (Half second high, half second low). I have tried various
    Pollmodes (3,4, 10, 11) however it appears that I am finishing my "POLLRUN"
    while the squarewave is still in the high condition which I assume is triggering
    the pollrun again.

    Apparently what I need to do is only react to a TRANSISTION from low to high
    so the run 1 only executes once per second. Can this be done somehow using
    polling?? I suppose I could build a circuit to generate a short pulse only on
    the low to high transistion but that seems a bit extreme.

    Any clever ideas out there??

    Mike B.



    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2002-09-20 17:56
    In a message dated 9/15/02 9:32:52 AM Pacific Daylight Time,
    w6ffc@p... writes:


    > Progress however slight is progress. I have the need to react every second
    > to a 1 Hz squarewave, (Half second high, half second low). I have tried
    > various Pollmodes (3,4, 10, 11) however it appears that I am finishing my
    > "POLLRUN" while the squarewave is still in the high condition which I
    > assume is triggering the pollrun again.

    That is correct when I looked at your code.

    >
    > Apparently what I need to do is only react to a TRANSISTION from low to
    > high so the run 1 only executes once per second. Can this be done somehow
    > using polling??
    You could reverse the pollin (pollin 1,0 to pollin 1,1) when in run 1.
    I suppose I could build a circuit to generate a short pulse only on the low
    to high
    > transistion but that seems a bit extreme.
    >
    > Any clever ideas out there??
    >

    Sorry I was late getting back. Your code seems to have a clear direction but
    you might need to install a delay so the pollin can go back to its non alarm
    state. You could use another pollin pin for alarm control after you have
    cleared the old pollin pin alarm.
    Regards,
    Chuck

    > Mike B.
    >
    >
    >



    [noparse][[/noparse]Non-text portions of this message have been removed]
Sign In or Register to comment.