Pic stepper controller

Dec 09, 2008 3 Replies

Hej :)



Jeg har lavet dette program til at styre min unipolar 4 faset stepper motor til en pille dispenser. I f=F8rste omgang er det skrevet for at f=E5 motoren til at k=F8re bagefter bliver det =E6ndret!.



dog er der kommet nogle fejl op, som jeg ikke kan finde ud af at =E6ndre? har =E6ndret halvdelen af dem.



er der nogen der kan forklarer mig hvad der skal =E6ndres f=F8r det virker.. P=E5 forh=E5nd mange tak :)



H=E5ber virkelig der er en eller flere der kan forklarer mig det og hj=E6lpe har ikke meget tid tilbage :/



Fejlene n=E5r jeg pr=F8ver at br=E6nde pic'en:



Clean: Deleting intermediary and output files. Clean: Done. Executing: "C:\Programmer\Microchip\MPASM Suite\MPASMWIN.exe" /q / p16F84A "stepper_motor.asm" /l"stepper_motor.lst" / e"stepper_motor.err" /d__DEBUG=3D1 Message[302] C:\STEPPER_MOTOR.ASM 34 : Register in operand not in bank



  1. Ensure that bank bits are correct. Error[108] C:\STEPPER_MOTOR.ASM 52 : Illegal character (,) Halting build on first failure as requested.

Mit Pic program:



_CP_ON EQU H'000F' _CP_OFF EQU H'3FFF' _PWRTE_ON EQU H'3FF7' _PWRTE_OFF EQU H'3FFF' _WDT_ON EQU H'3FFF' _WDT_OFF EQU H'3FFB' _LP_OSC EQU H'3FFC' _XT_OSC EQU H'3FFD' _HS_OSC EQU H'3FFE' _RC_OSC EQU H'3FFF'



__CONFIG _CP_OFF & _PWRTE_ON & _WDT_OFF & _XT_OSC list p=3D16f84a #include P16F84a.inc


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Sets all port b to in/ output ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ORG 0X0000 bsf 03h,RP0 ;Skift til Bank 1 /shift to Bank 1 movlw b'00001111' ;S=E6tter alle Port b/sets all Port b movwf 86h ;benene til output/pins to output bcf 03h,RP0 ;skifter tilbage til Bank 0/shift back to Bank 0 goto TJEK ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Tjekker portene/ checks the ports ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; TJEK BTFSS 06h,0 BTFSS 06h,1 BTFSS 06h,2 BTFSS 06h,3 ; valgfri mulighed/ optional options goto REGISTRERING



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;= ;; ;;Registrere om kontakten bruges/registers if the switch are in use;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;= ;;


REGISTRERING



if 06h,0 equ 1 then go to STEPCW1 if 06h,1 equ 1 then go to STEPCCW if 06h,2 equ 1 then go to STOP


STEPCW1


movlw b'00010000' movwf 06h goto FORSINKELSE



FORSINKELSE ;25 ms delay loop ; Delay =3D 25000 instruction cycles ; Clock frequency =3D 4 MHz



; Actual delay =3D 0.025 seconds =3D 25000 cycles ; Error =3D 0 %



cblock d1 d1_1 endc d1 equ 0x0c d1_1 equ 0x1c


;24993 cycles movlw 0x86 movwf d1 movlw 0x14 movwf d1_1 forsinkelse_0 decfsz d1, f goto $+2 decfsz d1_1, f goto forsinkelse_0



;3 cycles goto $+1 nop



;4 cycles (including call) return



goto STEPCW2



STEPCW2



movlw b'00100000' movwf 06h goto FORSINKELSE1



FORSINKELSE1 ;25 ms delay loop ; Delay =3D 25000 instruction cycles



; Actual delay =3D 0.025 seconds =3D 25000 cycles ; Error =3D 0 %



cblock d1 d1_1 endc d1 equ 0x0c d1_1 equ 0x1c


;24993 cycles movlw 0x86 movwf d1 movlw 0x14 movwf d1_1 forsinkelse_0 decfsz d1, f goto $+2 decfsz d1_1, f goto forsinkelse_0



;3 cycles goto $+1 nop



;4 cycles (including call) return



goto STEPCW3


STEPCW3 movlw b'01000000' movwf 06h goto FORSINKELSE2


FORSINKELSE2 ;25 ms delay loop ; Delay =3D 25000 instruction cycles ; Clock frequency =3D 4 MHz



; Actual delay =3D 0.025 seconds =3D 25000 cycles ; Error =3D 0 %



cblock d1 d1_1 endc d1 equ 0x0c d1_1 equ 0x1c


;24993 cycles movlw 0x86 movwf d1 movlw 0x14 movwf d1_1 forsinkelse_0 decfsz d1, f goto $+2 decfsz d1_1, f goto forsinkelse_0



;3 cycles goto $+1 nop



;4 cycles (including call) return



goto STEPCW4



STEPCW4 movlw b'01000000' movwf 06h goto FORSINKELSE3



FORSINKELSE3 ;25 ms delay loop ; Delay =3D 25000 instruction cycles ; Clock frequency =3D 4 MHz



; Actual delay =3D 0.025 seconds =3D 25000 cycles ; Error =3D 0 %



cblock d1 d1_1 endc d1 equ 0x0c d1_1 equ 0x1c


;24993 cycles movlw 0x86 movwf d1 movlw 0x14 movwf d1_1 forsinkelse_0 decfsz d1, f goto $+2 decfsz d1_1, f goto forsinkelse_0



;3 cycles goto $+1 nop



;4 cycles (including call) return


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;genstart/ restart ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;= ;



goto STEPCW1



Hilsen Kevin H


ps. error [108] er her:

if 06h,0 equ 1 then go to STEPCW1 if 06h,1 equ 1 then go to STEPCCW if 06h,2 equ 1 then go to STOP

og Messages [302] er her:

bsf 03h,RP0 ;Skift til Bank 1 /shift to Bank 1 movlw b'00001111' ;S=E6tter alle Port b/sets all Port b movwf 86h ;benene til output/pins to output bcf 03h,RP0 ;skifter tilbage til Bank 0/shift back to Bank 0

Hej det er lige meget jeg har rettet det efter flere timers fors=F8g..

men hvis det ikke virker p=E5 bordet vender jeg tilbage.

M.v.h Kevin H

snipped-for-privacy@hotmail.com skriver:

Hvad var fejlen ?

Okay.

Klaus

Modelbane Europas hjemmeside: http://www.modelbaneeuropa.hadsten.dk Modeltog, internet, gratis spambekæmpelse, elektronik og andet: http://home6.inet.tele.dk/moppe

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required