Thread: tank drive
View Single Post
  #9   Spotlight this post!  
Unread 29-01-2004, 22:19
Random Dude Random Dude is offline
Oregon State Head FTA
AKA: Chris
no team (Oregon Robotics Tournament & Outreach Program)
 
Join Date: Aug 2002
Rookie Year: 1998
Location: Oregon
Posts: 142
Random Dude will become famous soon enoughRandom Dude will become famous soon enough
Re: tank drive

Quote:
Originally Posted by Astronouth7303
so 5 = 00000101 and -5 = !5 + 1 = 11111011
Or did I mis-read that?

I'm just curious, so one has a vague idea what happens if you pass a signed to a unsigned.
Well, if you do something like this


unsigned char u_char;
signed char s_char;

.....

u_char = s_char;



The maping will be as follows:

s_char >= 0 : u_char = s_char
s_char <0 : u_char = 256 - s_char


Hope that answers your question... (Note I'm speaking in terms of this micro and this compiler, YMMV on other systems...)