dear all,
here is the basic function to run a stepper motor.
Code:
void move_x1ccw(int distance,int speed)
{
int j;
distance=200*distance;/* for 1.8 deg stepper motor */
for(j=0;j<distance;j++)
{
outportb(dport,0x02);
delay(speed);
outportb(dport,0x03);
delay(speed);
}
}
void move_x1cw (int distance,int speed)
{
int i;
distance=200*distance; /*for 1.8 deg stepper motor */
for(i=0;i<distance;i++)
{
outportb(dport,0x00);
delay(speed);
outportb(dport,0x01);
delay(speed);
/* printf("%2d\n",rotation);*/
}
}
void work1(int dir,int distance,int speed)
{
switch(dir)
{
case 'f':
{
printf("\n\n\t\tmotor-x1 moving in forward direction...");
move_x1cw(distance,speed);
break;
}
case 'r':
{
printf("\n\n\t\tmotor-x1 moving in reverse direction...");
move_x1ccw(distance,speed);
break;
}
case '27':
{
exit(0);
}
default:
{
usage();
break;
}
}
}
these functions are capable to run one stepper motor.
motor1_cw for its clockwise rotation and the other for the anti-clockwise rotation.
the robot is a pure assembly and it is a scara type robot aimed to work for handling purposes for the materials in the tool room.
dear salem this robot does not have any manual,it is being prepared by a group of students.
dear magos thanks for the ckt dia. for the printer port , i think this would be helpful for further research.
[code][/code]tagged by Salem