Shop OBEX P1 Docs P2 Docs Learn Events
ICCV7 using INA register — Parallax Forums

ICCV7 using INA register

s1ss1s Posts: 4
edited 2009-04-03 01:40 in Propeller 1
I'm trying to learn how to program the Propeller and have a simple question.

I want to read bit 15 of INA register and would like to know how to access a specific bit. I can do it in assembly but think there has to be a different way with C.

Thanks,
Steve

Comments

  • ImageCraftImageCraft Posts: 348
    edited 2009-04-02 22:22
    if (INA & (1 << 15)) ...

    or
    #define BIT(x) (1 << (x))

    if (INA & BIT(15)) ...
  • TJHJTJHJ Posts: 243
    edited 2009-04-03 01:40
    Dont forget the SET(Reg, BITNUM) and CLR(Reg,BITNUM) commands in the prop header.

    The best ive seen was
    #define pinState(pin) ((INA>>pin)&1) 'A return of 1 is a high, 0 is low state. Quick easy way to get a pin state

    TJ

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I owe everyone here a bunch, So thanks again for answering my dumb questions.
    Projects. RG500 ECU system. PropCopter. Prop CanSat. Prop Paste Gun.
    Suzuki RG500 in a RGV 250 frame.
    Bimota V-Due (Running on the fuel injection system)
    Aprilia RS250
Sign In or Register to comment.