not able to make servo move to the definite position

i am using an arduino based platform dfrduino romeo v1.0
i have connected this board to 2 dc motors and 1 servo..servo is attached to pin 8
servo is working correctly as i runed a program to move servo to its extreme positions to and fro
it just moves a bit when i enter a input commands in serial monitor.
dc motor are working fine.

please help
thankyou

this is the code i used
#include <Servo.h>
Servo myservo;

//Standard PWM DC control
int E1 = 5; //M1 Speed Control
int E2 = 6; //M2 Speed Control
int M1 = 4; //M1 Direction Control
int M2 = 7; //M1 Direction Control

///For previous Romeo, please use these pins.
//int E1 = 6; //M1 Speed Control
//int E2 = 9; //M2 Speed Control
//int M1 = 7; //M1 Direction Control
//int M2 = 8; //M1 Direction Control

void stop(void) //Stop
{
digitalWrite(E1,LOW);
digitalWrite(E2,LOW);
}
void advance(char a,char b) //Move forward
{
analogWrite (E1,a); //PWM Speed Control
digitalWrite(M1,HIGH);
analogWrite (E2,b);
digitalWrite(M2,HIGH);
}
void back_off (char a,char b) //Move backward
{
analogWrite (E1,a);
digitalWrite(M1,LOW);
analogWrite (E2,b);
digitalWrite(M2,LOW);
}
void turn_L (char a,char b) //Turn Left
{
analogWrite (E1,a);
digitalWrite(M1,LOW);
analogWrite (E2,b);
digitalWrite(M2,HIGH);
}
void turn_R (char a,char b) //Turn Right
{
analogWrite (E1,a);
digitalWrite(M1,HIGH);
analogWrite (E2,b);
digitalWrite(M2,LOW);
}

void servochange(){
static int pos;
if (Serial.available()){
char ch=Serial.read();
if(isDigit(ch))
pos=ch;
{if(0<pos<180){
myservo.write(ch);
delay(2000);}
}
}
}

void setup(void)
{ myservo.attach(8,544,2400);
int i;
for(i=4;i<=7;i++)
pinMode(i, OUTPUT);
Serial.begin(9600); //Set Baud Rate
Serial.println("Run keyboard control");
}
void loop(void)
{servochange();
if(Serial.available()){
char val = Serial.read();
if(val != (0<val<180))
{
switch(val)
{
case 's'://Move Forward
advance (225,225); //move forward in max speed
break;
case 'w'://Move Backward
back_off (225,225); //move back in max speed
break;
case 'a'://Turn Left
turn_L (200,200);
break;
case 'd'://Turn Right
turn_R (200,200);
break;
case 'z':
Serial.println("Hello");
break;
case 'g':
stop();
break;
}
}
else stop();
}
}

You have a number of issues in your servochange function. First, you're reading from serial there but also doing so in loop. You have no control over which read picks up what you're sending.

Then you're reading a single character to get pos. You ensure it's a digit and assign it to pos. Pos will then be in the range 48 to 57 which are the ASCII vaules for '0' and '9' respectively. This is why you're only seeing a small degree of movement.

This:

if(0<pos<180)

Doesn't do what you expect, you cannot compare numbers like this. This is ugly but does what I think you intend:

if(0<pos && pos<180)

You need to read the digits into a char array, null terminate it and then use atoi to get the number of degrees, but before that, you need to figure out how to distinguish between the commands you read in loop and the numbers you're looking for in servochange. A prefix character that tells you whether to expect a command or a servo position might do it.

can u please help me by editing the code..i am not able to figure it out... please help me