stepper motor controller

Status
Not open for further replies.

DavidNelly

Member level 5
Joined
Sep 8, 2006
Messages
90
Helped
4
Reputation
8
Reaction score
3
Trophy points
1,288
Activity points
1,814
Hi colleagues,
I am a beginner in PIC programming.
I would like to program in C for pic 16F84 to control the stepper motor.
I want to try from very simple. Please what books or references ?
Thanks in advance.
 

hi pls hlp me out is this program is right for Stepper Motor controller using PIC16F84A

Stepper Motor controller using PIC16F84A
list p=pic16f84a
init
bsf status,rp0
clrf trisa
movlw b'00100111'
movwf trisb
movlw b'10000000'
movwf option_reg
bcf status,rp0
clrf mode
clrf count1
clrf count2
movlw b'00000101'
movwf porta
bsf portb,rb7
btfsc portb,rb5
goto $-1
start
btfsc portb,rb1
goto check1
clrf mode ;
goto drive
btfsc portb,rb2 ;
goto check2 ;
movlw d'1' ;
movwf mode
goto drive ;
btfsc portb,rb0
goto drive ;
movlw d'2' ;
movwf mode ;
movf mode,w
bz start ;
bsf portb,rb7 ;
btfsc portb,rb5 ;
goto $-1
movlw d'5' ;
movwf count1 ;
call timer ;
decfsz count1,f ;
goto loop ;
bcf portb,rb7 ;
btfss portb,rb5
goto $-1
movf porta,w ;
sublw b'000000101' ;
bnz drive2 ;
movf mode,w ;
sublw d'1' ;
bz drive1 ;
movlw b'00001001' ;
goto drive_end ;
movlw b'00000110' ;
goto drive_end ;
movf porta,w
sublw b'000000110' ;
bnz drive4 ;
movf mode,w ;
sublw d'1' ;
bz drive3 ;
movlw b'00000101' ;
goto drive_end ;
movlw b'00001010' ;
goto drive_end ;
movf porta,w ;
sublw b'000001010' ;
bnz drive6 ;
movf mode,w ;
sublw d'1' ;
bz drive5 ;
movlw b'00000110' ;
goto drive_end ;
movlw b'00001001' ;
goto drive_end ;
movf porta,w ;
sublw b'000001001' ;
bnz drive8 ;
movf mode,w ;
sublw d'1' ;
bz drive7 ;
movlw b'00001010' ;
goto drive_end ;
movlw b'00000101' ;
goto drive_end ;
movlw b'00000101' ;
movwf porta ;
goto start ;
nop ;
decfsz count2,f ;
goto tmlp ;
return ;
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…