31-05-2011, 09:32 AM
Abstract:
This project focuses on developing an embedded system to control the operation of the stepper motor using micro controller. It consists of two parts; one is transmitter which consists of pc, level converter, microcontroller, RF transmitter. Another one is receiver which consists of RF receiver, microcontroller, stepper motor and stepper motor driver.
If we want to control the motor the information is given to the microcontroller using pc. Microcontroller recognizes the data and provides the appropriate information to the RF transmitter. It transmits the desired signal to the RF receiver. RF receiver receives the signal, decodes and gives it to the micro controller. Finally the micro controller according to the received signal controls the motor with the help of motor driver.
Code:
/*PC BASED WIRELESS STEPPER MOTOR CONTROL*/
#include<stdio.h>
#include<conio.h>
#include<dos.h>
void main()
{
void dub(void);
c h a r e x [ 2 6 ] = { “ P r o g r a m m e d b y
V.MARIYAPPAN”};
int i;
char ex1[22]={“Programming Language:
C”};
int j;
char ex2[28]={“Operating system: Windows
98”};
int k;
char ex3[39]={“PC BASED WIRELESS STEPPER
MOTOR CONTROL”};
int l;
clrscr();
for(l=0;l<39;l++)
{
textcolor(14);gotoxy(21+l,9);
cprintf(“%c”,ex3[l]);
delay(50);
}
sound(1900);
delay(500);
nosound();
delay(100);
for(i=0;i<26;i++)
{
textcolor(11);gotoxy(27+i,16);
cprintf(“%c”,ex[i]);
delay(30);
}
for(k=0;k<28;k++)
{
textcolor(9);gotoxy(26+k,18);
cprintf(“%c”,ex2[k]);
delay(30);
}
for(j=0;j<22;j++)
{
textcolor(9);gotoxy(29+j,20);
cprintf(“%c”,ex1[j]);
delay(30);
}
sound(1800);
delay(500);
nosound();
getch();
dub();
}
void dub(void)
{
int i;
char ex[29]={“For any clarification contact”};
int j;
char ex1[31]={“Email-marietech2003@yahoo.
co.in”};
int k;
void clock(void);
void anty(void);
char ch;
clrscr();
textcolor(14);gotoxy(20,6);
cprintf(“PC BASED WIRELESS STEPPER MOTOR
CONTROL”);
textcolor(11); gotoxy(24,14);
cprintf(“FOR CLOCKWISE ROTATION PRESS
‘c’”);
textcolor(11);gotoxy(22,16);
cprintf(“FOR ANTICLOCKWISE ROTATION
PRESS ‘a’”);
textcolor(9);gotoxy(31,20);
cprintf(“FOR EXIT PRESS ‘q’”);
ch=getch();
switch(ch)
{
case ‘c’:clock();break;
case ‘a’:anty();break;
case ‘q’:
clrscr();
{
for(j=0;j<29;j++)
{
textcolor(9);gotoxy(27+j,14);
cprintf(“%c”,ex[j]);
delay(30);
}
for(k=0;k<31;k++)
{
textcolor(9);gotoxy(26+k,15);
cprintf(“%c”,ex1[k]);
delay(30);
}
outport(0x0378,0);
textcolor(14);gotoxy(1,25);
cprintf(“Press any key”);
getch();
exit(0);
}
default: clrscr();
textcolor(12);gotoxy(33,1
4);
cprintf(“WRONG KEY
PRESSED”);
for(i=0;i<5;i++)
{
sound(1000);
delay(100);
nosound();
delay(100);
}
dub();
}
getch();
}
void clock(void)
{
int p=0x0378;
char e;
clrscr();
textcolor(14);gotoxy(31,12);
cprintf(“CLOCKWISE DIRECTION”);
textcolor(9);gotoxy(1,25);
cprintf(“Press any key to stop”);
do
{
outport(p,1);
delay(200);
outport(p,2);
delay(200);
outport(p,4);
delay(200);
outport(p,8);
delay(200);
outport(p,0);
sound(1000);
delay(200);
nosound();
}
while(!kbhit());
getch();
dub();
}
void anty(void)
{
int p=0x0378;
char e;
clrscr();
textcolor(14);gotoxy(30,12);
cprintf(“ANTI CLOCKWISE DIRECTION”);
textcolor(9);gotoxy(1,25);
cprintf(“Press any key to stop”);
do
{
outport(p,8);
delay(200);
outport(p,4);
delay(200);
outport(p,2);
delay(200);
outport(p,1);
delay(200);
outport(p,0);
sound(2000);
delay(200);
nosound();
}
while(!kbhit());
getch();
dub();
}