Discussion in "Project Doubts" started by    kanniyappan    Feb 17, 2013.
Sun Feb 17 2013, 06:25 pm
#1
I am using 293d for bipolar stepper motor drive and it is not working why I don't know... the coding I used is..
#include<htc.h>

int _XTAL_FREQ=12000000;


int i;
void forv();
void rev();
void reva();
void fora();

void DelayMs(unsigned char delay)
{
unsigned int j;
for(i=0;i<=delay;i++)
{
for(j=0;j<=1000;j++);
}
}

void port_initialize()
{
TRISB=0X00;
PORTB=0x00;
TRISC=0xFF;

#define a RC0
#define b RC1
#define c RC2
#define d RC3


}

void main()

{
port_initialize();
while(1)
{
 if(a>
0x00)
 { 
  forv();
 }
 if(b>
0x00)
 {
  rev();
 }
 if(c>
0x00)
 {
  reva();
 }
 if(d>
0x00)
 {
  fora();
 }
}
}

void forv()
{
PORTB=0x08;
DelayMs(50);
PORTB=0x02;
DelayMs(50);
PORTB=0x04;
DelayMs(50);
PORTB=0x01;
DelayMs(50);
}

void rev()
{

PORTB=0x08;
DelayMs(100);
PORTB=0x09;
DelayMs(100);
PORTB=0x01;
DelayMs(100);
PORTB=0x03;
DelayMs(100);
PORTB=0x02;
DelayMs(100);
PORTB=0x06;
DelayMs(100);
PORTB=0x04;
DelayMs(100);
PORTB=0x0C;
DelayMs(100);
}
void reva()
{
PORTB=0x06;
DelayMs(150);
PORTB=0x0C;
DelayMs(150);
PORTB=0x09;
DelayMs(150);
PORTB=0x03;
DelayMs(150);
}
void fora()
{
PORTB=0x06;
DelayMs(300);
PORTB=0x0C;
DelayMs(300);
PORTB=0x09;
DelayMs(300);
PORTB=0x03;
DelayMs(300);
}


And this is the diagram i used... i dont know what is the reason behind the problem... but it is not rotating... but i hear the sound in the motor... supply i used is 12V battery with 7812 regulator and for Microcontroller 9V battery...
i am first trying to rotate in forward direction for that i used different delay and made this... my motor winding are Yellow Orange Brown and Black among which Yellow and Orange are one winding and Black and Brown are another winding.. pls help me...

Mon Feb 18 2013, 06:58 pm
#2
@kanniyappan
which compiler u r using?is yr code working on protius?
Sun Feb 24 2013, 07:59 pm
#3
Make sure you have used right kind of stepper motor. Are you using a bipolar stepper?
Tue Feb 26 2013, 05:03 pm
#4

supply i used is 12V battery with 7812 regulator and for Microcontroller 9V battery...



are you using a regulator ahead of 9v battery? max vdd as in datasheet for 16f887 is +7.5 v. 5 volts is recommended.
also mention if your simulation on proteus is working. if it is working, we will focus on the hardware.
Wed Feb 27 2013, 10:52 am
#5
@ kanniyappan
there is no need of 7812 for steeper motor as it also limit the current
another possibility can be a current of motor if it is a big motor then use L298 instead of L293
in your coding there is no setting of configurations words
in Proteus no need of configuration but in real you need it
also try to swap the pair of wires of motor windings


[ Edited Wed Feb 27 2013, 10:52 am ]
Fri Mar 01 2013, 08:38 pm
#6
Sorry for late reply, i made it working but don't know what happen, it is working now. but how to get the high holding torque form the motor.

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

RonaldNak
Thu May 09 2024, 07:45 pm
Jamescon
Thu May 09 2024, 12:52 pm
RobertSkats
Thu May 09 2024, 10:23 am
hvCar
Thu May 09 2024, 05:53 am
DJGlido
Wed May 08 2024, 09:28 pm
migCar
Wed May 08 2024, 04:48 pm
TimmyJup
Wed May 08 2024, 12:22 am
Shawnarows
Tue May 07 2024, 10:16 pm