Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
deda_294911
Level 4
Level 4
Welcome!

hi every body,

   

if anybody works on this. can i get details?

   

when i used 89xx uc. there INTRINS  extern unsigned char _crol_    (unsigned char, unsigned char); viz.

   

temp=_crol_(temp,1);/*Shift D7 BIT TO D0*/
SDA = (temp&0x01);/*SEND D0 BIT TO SDA*/

   

or how to implement this function.

0 Likes
2 Replies
EmHo_296241
Level 5
Level 5
10 solutions authored 50 replies posted 25 replies posted

Something like this ? 

   


unsigned char _crol(unsigned char value, int shift)
{ if ((shift &= 7) == 0)
return value;
return (value << shift) | (value >> (8 - shift));

   

}
 

0 Likes
Anonymous
Not applicable

Here's a post with more information if you are interested:

   

http://stackoverflow.com/questions/10134805/bitwise-rotate-left-function

0 Likes