Driver 16f84 para motor PP

controlador motor paso a paso con 16f84a
Buenas a todos
se que es un tema ya visto muchas veces.... pero quisiera su opinion en general del circuito.
A los que se preguntan porque uso un transistor para controlar el motor...
eso es para luego poder usar las mismas salidas de la secuencia de giro en un segundo motor que aqui no se encuentra. pero tambien se activaría por un segundo transistor saturado correspondiente a ese segundo motor.
dependiendo de cual transistor decida saturar.. se seleccionará el motor
la resistencia del transistor todavía no la eh calculado

el motor es unipolar pequeño, si bien todavía no me ehe fijado en las características técnicas, supongo que rondará en algo menos de 500mA (cuando sepa cuanto exactamente calcularé las resistencias de saturación)


el 6to bit que se mantiene constante en la salida de los puertos B es el que se dirige a saturar el transistor y activar el motor

con respecto al mismo (el transistor) pido una sugerencia si hay alguno mas adecuado para esto que el 2n2907


Código:
main


PDel0      equ    0x0C
PDel1      equ    0x0D
STATUS     equ    0x03
TRISB      equ    0x86
TRISA      equ    0x85
PORTB      equ    0x06
PORTA      equ    0x05


           bsf     STATUS,5  
           movlw   00h 
           movwf   TRISB 
           movlw   0xFF
           movwf   TRISA
           bcf     STATUS,5
           movlw   00h
           movwf   PORTA




leer
       btfsc  PORTA,0        ;si hay un 1
       goto   der            ;           ir a derecha
       btfsc  PORTA,1        ;si hay un 1
       goto   izq            ;           ir a izquierda
       goto   leer








der     movlw    b'00100110'    
         movwf    PORTB
         call     wait
         movlw    b'00100100'    
         movwf   PORTB
         call     wait
         movlw    b'00101100'    
         movwf    PORTB
         call     wait
         movlw    b'00101000'    
         movwf   PORTB
         call     wait
         movlw    b'00111000'    
         movwf   PORTB
         call     wait
         movlw    b'00110000'    
         movwf   PORTB
         call     wait
         movlw    b'00110010'    
         movwf    PORTB
         call     wait
         movlw    b'00100010'    
         movwf   PORTB
         call     wait
         movlw    b'00000000'    
         movwf    PORTB
         goto     leer       ;CHEKEAR SI SE ESTA APRETANDO DERECHA




izq      
         movlw    b'00100010'     
         movwf    PORTB
         call     wait
         movlw    b'00110010'   
         movwf   PORTB
         call     wait
         movlw    b'00110000'  
         movwf    PORTB
         call     wait
         movlw    b'00111000'    
         movwf    PORTB
         call     wait
         movlw    b'00101000'    
         movwf    PORTB
         call     wait
         movlw    b'00101100'    
         movwf   PORTB
         call     wait
         movlw    b'00100100'   
         movwf    PORTB
         call     wait
         movlw    b'00100110'    
         movwf    PORTB
         call     wait
         movlw    b'00100000'    
         movwf   PORTB
         goto     leer       ;CHEKEAR SI SE ESTA APRETANDO DERECHA


wait    movlw     .239      ; 1 set numero de repeticion  (B)
        movwf     PDel0     ; 1 |
PLoop1  movlw     .232      ; 1 set numero de repeticion  (A)
        movwf     PDel1     ; 1 |
PLoop2  clrwdt              ; 1 clear watchdog
PDelL1  goto PDelL2         ; 2 ciclos delay
PDelL2  goto PDelL3         ; 2 ciclos delay
PDelL3  clrwdt              ; 1 ciclo delay
        decfsz    PDel1, 1  ; 1 + (1) es el tiempo 0  ? (A)
        goto      PLoop2    ; 2 no, loop
        decfsz    PDel0,  1 ; 1 + (1) es el tiempo 0  ? (B)
        goto      PLoop1    ; 2 no, loop
PDelL4  goto PDelL5         ; 2 ciclos delay
PDelL5  goto PDelL6         ; 2 ciclos delay
PDelL6  goto PDelL7         ; 2 ciclos delay
PDelL7  clrwdt              ; 1 ciclo delay
        return              ; 2+2 Fin.












		END                     ; directive 'end of program'
 

Adjuntos

  • controlador_PP.png
    controlador_PP.png
    13.8 KB · Visitas: 14
Atrás
Arriba