PDA

View Full Version : ICCV7 using INA register



s1s
04-03-2009, 04:53 AM
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

ImageCraft
04-03-2009, 05:22 AM
if (INA & (1 << 15)) ...

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

if (INA & BIT(15)) ...

TJHJ
04-03-2009, 08:40 AM
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