View Single Post
  #238   Spotlight this post!  
Unread 17-01-2008, 17:28
Dave Scheck's Avatar
Dave Scheck Dave Scheck is offline
Registered User
FRC #0111 (WildStang)
Team Role: Engineer
 
Join Date: Feb 2003
Rookie Year: 2002
Location: Arlington Heights, IL
Posts: 574
Dave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond repute
Re: New C18 3.0+ Compatible FRC Code

Quote:
Originally Posted by Kevin Watson View Post
Your code should probably look like this:
Code:
unsigned char limit(int value)
{
if(value >255);
value =255;
else if(value <0);
value =0;
return (unsigned char)value;
}
Kevin, I think you forgot to remove the semicolons after the IFs in your reply. I think you meant it to be
Code:
unsigned char limit(int value)
{
  if(value > 255)
    value = 255;
  else if(value < 0)
    value = 0;
  return (unsigned char)value;
}