Shop OBEX P1 Docs P2 Docs Learn Events
Oddness with writePin? — Parallax Forums

Oddness with writePin?

Scott MScott M Posts: 43
edited 2005-04-20 21:13 in General Discussion
Have folk used writePin to set multiple pins at once? I understand that you can only set pins 0-7 OR 8-15 in one call, but at one point I summed up some pinids between 8 and 11, called write, and had pin 2 change state. It would happen reliably (and would reliably send my circuit to never-never land). The problem vanished when I did individual calls to writePin for each, separate pinid. That kind of defeats the purpose (I wanted the pin changes to happen simultaneously).

Anyone know of any weirdness with this call?

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-04-10 19:03
    Try ORing the pins, instead of ADDing the pins.

    CPU.writePin(CPU.pin8 | CPU.pin9 | CPU.pin10, false);

    You still must only use pins from the same port.



    You can use writePort() to set the port latch (this does not change pin directions,

    but it disturbs VP that uses pins of that port)

    and then use setOutput() to make the required pins outputs.


    required peter
    ·
  • Scott MScott M Posts: 43
    edited 2005-04-20 21:13
    Oring seems to have cleared this up. If Adding is truely wrong, the doc needs to be checked.
Sign In or Register to comment.