how to declare bit on Rowley?

hi…

i new to work with Rowlet n ARM…

i want to ask how to declare a bit on Rowley…

i have tried like this (i got an examples):

#define DATA IO0PIN_bit.P0_17

but it can’t works…

i want to use P0.17 as input, and i want to make a comparison to it…

if(DATA)

{

}

if(!DATA)

{

}

anybody can tell me how to declare it??

thx…

#define MY_INPUT (IO0PIN & BIT17)

IO0DIR &=~ BIT17; // set as input

if(MY_INPUT)

{

}

else

{

}

are BIT17 declare like this:

#define BIT17 17

i have tried :

#define MY_INPUT (IO0PIN & BIT17)

IO0DIR &=~ BIT17; // set as input

if(MY_INPUT)

{

}

else

{

}

i give it ‘1’ but it always go to “else” …

did i have to pull up the pin?

thank you

Posted: Tue Mar 11, 2008 5:33 pm Post subject:


are BIT17 declare like this:

#define BIT17 17

i have tried :

#define MY_INPUT (IO0PIN & BIT17)

IO0DIR &=~ BIT17; // set as input

if(MY_INPUT)

{

}

else

{

}

i give it ‘1’ but it always go to “else” …

did i have to pull up the pin?

thank you

seulater Posted: Tue Mar 11, 2008 9:56 am Post subject:


#define MY_INPUT (IO0PIN & BIT17)

IO0DIR &=~ BIT17; // set as input

if(MY_INPUT)

{

}

else

{

}

x-ray Posted: Tue Mar 11, 2008 4:43 am Post subject: how to declare bit on Rowley?


hi…

i new to work with Rowlet n ARM…

i want to ask how to declare a bit on Rowley…

i have tried like this (i got an examples):

#define DATA IO0PIN_bit.P0_17

but it can’t works…

i want to use P0.17 as input, and i want to make a comparison to it…

if(DATA)

{

}

if(!DATA)

{

}

anybody can tell me how to declare it??

thx…

to use bit 17 u must declare

#define BIT17 (1 << 17 ) /* 0000 0000 0000 0010 0000 0000 0000 0000 */

i have did it too…

#define BIT17 (1<<17)

#define MY_INPUT (IO0PIN&BIT17)

IO0DIR &= ~BIT17

but i give P0.17 input ‘1’(5V) but the condition MY_INPUT =‘1’ never reached. and never go to

if(MY_INPUT){

//never go in here

}

if(!MY_INPUT){

//always go in here

}

#define BIT17 (1<<17)

#define MY_INPUT (IO0PIN&BIT17)

IO0DIR &= ~BIT17

IO0SET |= BIT17

try this

it’s work.

thx all.