Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Newbie I need PIC assembly language program to driver a unipolar stepper motor

Status
Not open for further replies.

ssnickson

New Member
Dear all,
I m very new to this micro controller programming. I m very much interested in learning. As i m doing a project i need your expertise to give me a program to control a Unipolar stepper motor in both direction.

The project
  1. I m using PIC16F676
  2. Port A as input (Get the input from shaft encoder)
  3. Port B as output (Connected to Motor driver)
  4. Unipolar stepper motor is connected to (Driver L293D)
  5. Need an assembly language program to rotate the motor according to the encoder input
  6. The motor have to rotate both direction

I need your advice and guidance in this project. Thanks
 
Hi,

See the Microchip site, they have several application notes on stepper motors.

Ya i went through the website all the example they have is for Bipolar which is abit complicated for my standard to understand. So i m actually looking for sample unipolar program which i can learn frm
 
Thanks for the advice. I got some idea about the circuit. Please help me verify my circuit is correct.
  1. I have encoder(SE) which send the input to the PIC
  2. Then PIC will send the output to Motor driver
  3. Motor driver will send the output to unipolar stepper motor
I have attached my circuit for your reference and also i have write a basic program to test my circuit.I m not sure my Circuit is wrong or my program becos my motor is not moving

Here is my code (Just to rotate the motor no input)

; CPU configuration
; (It's a 16F84, RC oscillator,
; watchdog timer off, power-up timer on)

processor 16f676
include <p16f676.inc>
;__config _RC_OSC & _WDT_OFF & _PWRTE_ON
bsf STATUS, RP0 ;Select Bank1
movlw B'00000000' ;Set Port A as Input
movwf TRISA
movlw B'11111111' ;set Port C as output
movwf TRISC

bcf STATUS, RP0 ;Select Bank0
movlw B'00001100'
movwf PORTC
call delay
movlw B'00000110'
movwf PORTC
call delay
movlw B'00000011'
movwf PORTC
call delay
movlw B'00001001'
movwf PORTC
call delay


delay DECFSZ 255,1
goto delay
return

end
 

Attachments

  • Final..png
    Final..png
    14.5 KB · Views: 544
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top