Signed vs. Unsigned

4 replies [Last post]
YuSheng.Chen
Title: NooBot
Joined: 10/28/2013
Posts:
BotPoints: 286
User offline. Last seen 8 years 33 weeks ago.

Jeremy, you told me that on the CBC, servo values are signed. Can you please tell me what values are signed and which ones are unsigned. I feel like they would be significant. Thank you very much.

Jeremy Rand
Jeremy Rand's picture
Title: Botball Youth Advisory Council
Joined: 04/03/2009
Posts:
BotPoints: 1168
User offline. Last seen 7 years 18 weeks ago.

I'm not certain I understand the question, but when I'm curious about exactly how KIPR implemented something, their GitHub is an excellent resource.

Here's the source code for the CBC libraries; look at cbc.h to see the servo function prototypes.

https://github.com/kipr/cbc/tree/master/userlib/libcbc/src

-Jeremy Rand
Senior Programmer, Team SNARC (2012-2013), Norman Advanced (2010-2011), Norman HS (2008-2009), Norman North (2005-2007), Whittier MS (2003-2004)
2012-2013 VP of Tech, 2011 President, Botball YAC (2009-2013)
Mentor, Alcott and Whittier MS

YuSheng.Chen
Title: NooBot
Joined: 10/28/2013
Posts:
BotPoints: 286
User offline. Last seen 8 years 33 weeks ago.

Thanks, I've heard of GitHub a lot and I should really check it out. Thanks for replying. Anyway, I was talking about the signed or unsigned integer type used in the function parameters.

Jeremy Rand
Jeremy Rand's picture
Title: Botball Youth Advisory Council
Joined: 04/03/2009
Posts:
BotPoints: 1168
User offline. Last seen 7 years 18 weeks ago.

I can't tell if you're asking what signed/unsigned means or if you're asking which of them is used for servo positions. Can you clarify?

Thanks.

-Jeremy Rand
Senior Programmer, Team SNARC (2012-2013), Norman Advanced (2010-2011), Norman HS (2008-2009), Norman North (2005-2007), Whittier MS (2003-2004)
2012-2013 VP of Tech, 2011 President, Botball YAC (2009-2013)
Mentor, Alcott and Whittier MS

YuSheng.Chen
Title: NooBot
Joined: 10/28/2013
Posts:
BotPoints: 286
User offline. Last seen 8 years 33 weeks ago.

For the servo positions. And, if I am correct, all integer values in all parameters following the writing of a function, has to have either no parameters or has to have an integer value. The integer value say can be signed or unsigned. I am not asking for the definition of signed and unsigned, I'm asking how the functions in the kiss library was written. Like say since create drive straight only requires on input, the first line should look like this: int or void create_drive_straight(int input); But you could have had int or void create_drive_straight(uint input); So I am asking which one is used during the writing of the function. Thanks.