Shop OBEX P1 Docs P2 Docs Learn Events
PLP_A + Dipswitch — Parallax Forums

PLP_A + Dipswitch

nick bernardnick bernard Posts: 329
edited 2005-12-02 19:01 in General Discussion
is this topology and code OK on the sx28? it's yeilding inconsistant results.
thx
nick

Start:
TRIS_A = $F
TRIS_B = $00
TRIS_C = $FF


rb.6 = 0


PLP_A = $0
alarmActuated = ~ra.0
delay = ~ra

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
engineer, fireman, bowler, father, WoW addict [noparse];)[/noparse]

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-12-02 14:50
    Why are you disabling the pull-ups after the read? I would simply enable them at the beginning of the program and let them be.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • nick bernardnick bernard Posts: 329
    edited 2005-12-02 15:08
    righto jon, i commented that line out and changed my code to this thus fixxing my problem but why did it happen in the firstplace. is it because i wasn't leaving RA as pullups? to answer your question i suppose i didnt want the extra power consumption of sinking pullups for an initialization or once a lifetime dipswitch read.

    Start:
    TRIS_A = $F
    PLP_A = $0
    TRIS_B = $00
    TRIS_C = $FF
    rb.6 = 0
    alarmActuated = ~ra.0
    delay = ~ra
    ' PLP_A = $F.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    engineer, fireman, bowler, father, WoW addict [noparse];)[/noparse]
  • BeanBean Posts: 8,129
    edited 2005-12-02 16:14
    Nick,
    · You need to give the pull-up some time to "kick-in". Put a small delay (a couple uSecs) after the PLP_A = $0 instruction and before you read the pins.
    · Remember, they are WEAK pull-ups.
    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module" Now available from Parallax for only $28.95

    http://www.parallax.com/detail.asp?product_id=30012

    "SX-Video OSD module" Now available from Parallax for only·$49.95
    http://www.parallax.com/detail.asp?product_id=30015

    Product web site: www.sxvm.com

    Those that would give up freedom for security will have neither.
    ·
  • nick bernardnick bernard Posts: 329
    edited 2005-12-02 18:21
    thanks bean
    wow thats crazy cool that the sx is so fast it executes instructions before it can realize them!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    engineer, fireman, bowler, father, WoW addict [noparse];)[/noparse]
  • BeanBean Posts: 8,129
    edited 2005-12-02 19:01
    Nick,
    It's not that, it's that he pin acts like a capacitor, and it takes time for it to "charge-up" though the weak pull-up.
    There is another problem called the "read-modify-write" issue, that you can read about. That is basically the same thing.
    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module" Now available from Parallax for only $28.95

    http://www.parallax.com/detail.asp?product_id=30012

    "SX-Video OSD module" Now available from Parallax for only·$49.95
    http://www.parallax.com/detail.asp?product_id=30015

    Product web site: www.sxvm.com

    Those that would give up freedom for security will have neither.
    ·
Sign In or Register to comment.