This topic shows circuit schematic and C code for interfacing PIC16F84A microcontroller with CD-ROM bipolar stepper motor.
Related Topics:
Bipolar stepper motor drive with PIC18F4550 and CCS C
Bipolar stepper motor control with PIC16F877A microcontroller
The following circuit schematic shows the connection between the microcontroller PIC16F84A and the stepper motor where a dual H-bridge circuit which is L293D chip is used between them.
The two pushbuttons are used to choose motor rotation direction.
The PIC16F84A needs +5V between its VDD and VSS pins.
Interfacing PIC16F84A microcontroller with stepper motor CCS PIC C code:
The motor speed is fixed by the code but it can be changed by varying the delay between the four steps.
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 | // Interfacing PIC16F84A with CD-ROM bipolar stepper motor CCS C code #include <16F84A.h> #fuses HS,NOWDT,PUT,NOPROTECT #use delay(clock = 8000000) #use fast_io(A) #use fast_io(B) void main() {    output_a(0);    set_tris_a(0);    port_b_pullups(TRUE);    output_b(0);    set_tris_b(3);    while(TRUE)    {       output_a(0);       while(!input(PIN_B0))       {          output_a(0b00000110);          delay_ms(5);          output_a(0b00000101);          delay_ms(5);          output_a(0b00001001);          delay_ms(5);          output_a(0b00001010);          delay_ms(5);       }       while(!input(PIN_B1))       {          output_a(0b00000101);          delay_ms(5);          output_a(0b00000110);          delay_ms(5);          output_a(0b00001010);          delay_ms(5);          output_a(0b00001001);          delay_ms(5);       }    } } |
Interfacing PIC16F84A microcontroller with stepper motor video:
The following video shows a hardware circuit of this project.
How we can upload the cood to
PIC 16f84a ??
Please put a hex file
Hi sir
I am engineering student, I need 3axis pic microcontroller based stand alone motion controller code with pic18f46k22
You help will be highly appreciated
Thanks and Regards