Bitwise operators and their use

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi all,

Can someone explain the following and why it may not work in codevision.
I'm guessing at a logic 1 being left shifted a certain number of positions for RXCIE or logic 1 being left shifted a certain number of positions for RXEN or logic 1 being left shifted a certain number of positions for TXEN. I don't think these are defined anywhere in codevision for the 90s2313 so should I define them somewhere.

UCR = ( (1<<RXCIE) | (1<<RXEN) | (1<<TXEN) );

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

RXCIE, RXEN and TXEN should be defined as bit-numbers (not bit-mask) of UCR. 1.inc.

/Martin.

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks Martin,

Looked a little confusing at first as I'm used to setting the registers as a byte and those bits (TXEN etc.) aren't defined in codevision.

eg.
UCR=0x08;
UBRR=0x19;

I just downloaded AVRStudio and I'll have a look at that but I don't think my little board (DT006) is supported.

Regards,
Lee.