RishabhG
Member level 3
- Joined
- Aug 10, 2012
- Messages
- 65
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,286
- Activity points
- 1,815
Hi I am trying to interface a stepper motor using pic16f877a. I am using HiTech C Compiler
Here is the code
The motor does not rotate continuously;it rotates a few steps forward and then backward.
I am using ULN2803 as the driver. Can anyone please give me the circuit diagram of this IC with PIC?
Here is the code
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 #include<htc.h> __CONFIG(0x2F0A); void delay(unsigned int time) { unsigned char pause; while(time>0) { pause=255; while(pause--); time--; } } void main() { TRISC=0x00; while(1) { PORTC=0x09; delay(500); PORTC=0X08; delay(500); PORTC=0X0C; delay(500); PORTC=0X04; delay(500); PORTC=0X06; delay(500); PORTC=0X02; delay(500); PORTC=0X03; delay(500); PORTC=0X01; delay(500); } }
The motor does not rotate continuously;it rotates a few steps forward and then backward.
I am using ULN2803 as the driver. Can anyone please give me the circuit diagram of this IC with PIC?