Micro Procesadores
Programa para el control de motores:
LIST P=16F628a
#include "P16F628A.INC"
__CONFIG _CP_OFF & _WDT_OFF & _LVP_OFF & _PWRTE_ON &_INTRC_OSC_NOCLKOUT & _MCLRE_OFF
;********************************************************************************************************************************************
cblockContador
Cuenta
endc
;********************************************************************************************************************************************
ORG 0x00; El programa empieza en 0x000
goto Inicio;********************************************************************************************************************************************
;macros
bank0 macro
bcf STATUS,RP1
bcf STATUS,RP0
endm
bank1 macro
bcf STATUS,RP1
bsf STATUS,RP0
endm;********************************************************************************************************************************************
;Movimientos
;Ir a la Izquierda
left bsf PORTB,5
bcf PORTA,6
bcf PORTA,7
bsf PORTB,0return
;Ir a la derecha
right bcf PORTB,5
bsf PORTA,6
bsf PORTA,7
bcf PORTB,0
return
;Detener
stop bcf PORTB,5
bcf PORTA,6
bcf PORTA,7
bcf PORTB,0
return;Retroceder
Reverse bcf PORTB,5
bsf PORTA,6
bcf PORTA,7
bsf PORTB,0
return;********************************************************************************************************************************************
;Subrutinas Motor Paso a Paso;********************************************************************************************************************************************
;Velocidad Motor S2S
Velocidad
movwf PORTA
movlw .45
movwf Contador
Loop call Retardo_1ms
decfsz Contador,f
goto Loop
return...
Regístrate para leer el documento completo.