This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

sbit with macro define

Hi all,
I just want to ask why I cannot use this in C51:

...
sbit INPUT1 = P0 ^ 0;
sbit INPUT2 = P0 ^ 1;

#define CHECK_INPUT    ((INPUT1 << 7) | (INPUT2 << 6))

When try using it:

while(1)
{
    ...

    unsigned char temp;
    temp = CHECK_INPUT;

    ...
}

When compiled, the error:
*** ERROR C193 IN LINE 40 OF xxx.c: '<<' : bad operand type

What should be the best thing to do?
And why the error occur?

regards
gee

Parents
  • Sorry, I forgot to say that I need the two bits, it has 4(11,10,01,00) possible values so I need to evaluate each bit and not to combine the two.
    That is the reason I shifted the bit to the upper nibble of a byte. Well, upper nibble doesn't matter as long as I can put the two bits in a byte.

    thanks
    gee

Reply
  • Sorry, I forgot to say that I need the two bits, it has 4(11,10,01,00) possible values so I need to evaluate each bit and not to combine the two.
    That is the reason I shifted the bit to the upper nibble of a byte. Well, upper nibble doesn't matter as long as I can put the two bits in a byte.

    thanks
    gee

Children