Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Using PIC16F877 to control speed of motor

Status
Not open for further replies.

oTaRu

Junior Member level 2
Joined
May 21, 2009
Messages
21
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,473
Hi all,

is it possible to use PIC16F877 to control various speed of the motor? If possible, can you show me how to use c programming to configure in such a way.

Many thanks!

Newbie here.
 

Hi

It depend on what type of motor do you use?

There are many types :DC,BLDC,STEP,PM....

All the best

Bobi
 

**broken link removed**

Hi bobcat1, this is the vibration motor that I am using. do u have any idea regarding this?
 

Hi

Need to see data sheet to know more

All the best

Bobi
 

If there is no data sheet try to open the motor and describe it. I think you're familiar of diffirent types of motor?
 

actually I'm not familiar with types of motor but just that I require to use PIC controller to control the motor as part of my project...
 

There are different types of motor, a DC motor and AC motor. In digital electronics we don't ussually use of AC motor. what we use is the DC motor. In DC motor there is only 2 polarity like what you showed in the picture, of course the polarity of DC motor is North and South. The Red and Black of the wire of what you showed is the wire connected to the armature.
 

I having a problem using the PIC16F877 to enable/disable L293D IC chip for enabling and disabling the DC motor.

I am using PORTD of PIC16F877 to control the enable pin 1 of L293D but it's seem not controlling at all.

here is the code:

//Define compiler error message.
#ifndef __CPU_16F877__
#error "This program is tailored for PIC16F877 controller"
#endif

//Include required header files here.
#include "io16f877.h" //the hardware register definition file.



/****************************************************************
The variable timer_value holds the count between two consecutive timer interrupts.
This is the desired time (sec) between interrupts divided by
the time period of each timer count.
E.g. in this program, TIMER1 is configured so that each count = 1.6 uS,
so timer_value of 60000 will give an interrupt period of 96 mS.
****************************************************************/
//int timer_value=0xEA60; //decimal 60000.


/**********************************************************************
Declare functions to be used in the main program, i.e.
void DelayUs(int count)
void initialize_IO_ports(void)
void wait()

**********************************************************************/
//Put the body of all these functions here, before isr() and main().

void DelayUs(int count)
{
int i;
int j;
for(i=0;i<count;i++)
{
for(j=0;j<5000000;j++);

//This for loop has 5 NOPs & wastes 1 uS for our PIC clock frequency of 20MHz.
}
}


void wait()
{
char i;

for(i=0;i<100;i++)
{
RD1 = 0;
DelayUs(100);
}
}




void initialize_IO_ports(void)
{
//set the digital IO ports as per requirement.
TRISB = 0xFF ; //portB as input.
TRISD = 0x00 ; //portD as output.

//clear the output ports at the beginning.
PORTD = 0x00 ; //clear portD.
}


void main()
{
//setup port D as output


while(1)
{

RD1=1;
wait();

//Stop
RD1=0;
wait();
}
}
 

glenndr_15 said:
There are different types of motor, a DC motor and AC motor. In digital electronics we don't ussually use of AC motor. what we use is the DC motor. In DC motor there is only 2 polarity like what you showed in the picture, of course the polarity of DC motor is North and South. The Red and Black of the wire of what you showed is the wire connected to the armature.

I using DC motor.
I was told by my lab technician that the red/black wire can be ignore since red or black wires can be connect in either way
 

If you ignore the color of the wire of the dc motor then it means you probably want to turn the motor clockwise and counter clockwise.
 

Use the PWM port for this purpose.
 

glenndr_15 said:
If you ignore the color of the wire of the dc motor then it means you probably want to turn the motor clockwise and counter clockwise.

in my project, it doesn't require to turn with specific direction. either clockwise or anti clockwise is fine.

Added after 2 minutes:

AdvaRes said:
Use the PWM port for this purpose.
3

My apologises, Advares. Are you referring to me or glenndr_15?
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top