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.

PIC18F4550 problem. Stepper motor not rotating

Status
Not open for further replies.

burpal

Newbie level 1
Joined
Oct 4, 2009
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
india
Activity points
1,288
hello all, i wrote a code for rotating a stepper motor. The code seems to work fine as i connected 4 LED's to test the stepping sequence.

I am using the ULN 2003 to drive the stepper motor(M35SP). When i switch on the power source(24V), my microcontroller stops the stepping sequence and gets stuck at the first value, in my program, 0x01...

Please help!!

Here is the source code i am using...


Code:
#include<p18cxxx.h>
#include <delays.h>
void main()
{
	ADCON1 = 0b00001111;
	TRISA=0x00;
	PORTA=0x00;
	while(1)
	{
		PORTA=0x01;
		Delay1KTCYx(240);
		Delay1KTCYx(240);
		Delay1KTCYx(240);
		Delay1KTCYx(240);
		Delay1KTCYx(240);
		PORTA=0x02;
		Delay1KTCYx(240);
		Delay1KTCYx(240);
		Delay1KTCYx(240);
		Delay1KTCYx(240);
		Delay1KTCYx(240);
		PORTA=0x04;
		Delay1KTCYx(240);
		Delay1KTCYx(240);
		Delay1KTCYx(240);
		Delay1KTCYx(240);
		Delay1KTCYx(240);
		PORTA=0x08;
		Delay1KTCYx(240);
		Delay1KTCYx(240);
		Delay1KTCYx(240);
		Delay1KTCYx(240);
		Delay1KTCYx(240);
	}
}
 

try to re-build the delay functions in C18 with your project, sometimes we need to rebuild functions.
i noticed in another post someone mentioned the LATA register, initiate the LATx register with a value.
 

I have a doubt in your utilisation of the ULN.
Would you please show us your circuit ?
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top