Autor Tema: DUDA CON MOTOR PASO A PASO  (Leído 1295 veces)

0 Usuarios y 1 Visitante están viendo este tema.

Desconectado poeta3d

  • PIC10
  • *
  • Mensajes: 33
DUDA CON MOTOR PASO A PASO
« en: 01 de Abril de 2012, 17:55:21 »
tengo este programa:

PASO1:
TRISA.0=0 'DEFINO LOS PUERTOS COMO SALIDA
TRISA.1=0
TRISA.2=0
TRISA.3=0
SYMBOL PIN0=PORTB.0
SYMBOL PIN1=PORTB.1
SYMBOL PIN2=PORTB.2
SYMBOL PIN3=PORTB.3
PIN0=1
PIN1=1
PIN2=0
PIN3=0
PASO2:
PIN0=0
PIN1=1
PIN2=1
PIN3=0
GOSUB PASO1
GOSUB PASO2

el problema es que me gira solo 45º y quiero hacerlo girar 360º

Desconectado Noelillo

  • PIC12
  • **
  • Mensajes: 94
Re: DUDA CON MOTOR PASO A PASO
« Respuesta #1 en: 03 de Abril de 2012, 04:20:26 »
Hola, mira esto:
Código: [Seleccionar]
'****************************************************************
'*  Name    : UNTITLED.BAS                                      *
'*  Author  : Miguel Noe Garcia Perez                           *
'*  Notice  : Copyright (c) 2010 Iberica 2000                   *
'*          : All Rights Reserved                               *
'*  Date    : 05/10/2010                                        *
'*  Version : 1.0                                               *
'*  Notes   :                                                   *
'*          :                                                   *
'****************************************************************
 ' Cofiguracion Para pantalla LCD
                                          
Device = 16F877a
   XTAL = 4
        lcd_type = 0
        LCD_LINES = 2
        LCD_DTPIN = PORTb.4
        LCD_RSPIN = PORTb.3
        LCD_ENPIN = PORTb.2
        LCD_INTERFACE = 4
       ALL_DIGITAL = True
       PORTB_PULLUPS = ON      ' Resistencia interna Activada
        
'DEFINICION DE VARIABLES, CONSTANTES Y PUERTOS I/O
'---------------------------------------------------------
    TRISA = $FF           ' Define el Puerto A como salidas
'   TRISB = $FF           ' Define el Puerto B como Entradas
    TRISC = $00           ' Define el Puerto C como Salidas
    trisd = $00
 clear  

'******************************************************************************************
'********************* VARIABLES DEL PROGRAMA *********************************************
'******************************************************************************************    
      
        dim N         As byte
      
'*******************************************************************************          
'************************* I N I C I I O   P R O G *****************************
'*******************************************************************************
Inicio:    
    print at 1,1,"Motor PAP"
    print at 2,1,"Giro Izq Lento"
    
    for n=0 to 10
    gosub GiroIzLento
    next n
    print at 2,1,"GiroDeLento   "
    
    for n=0 to 10
    gosub GiroDeLento
    next n
    print at 2,1,"GiroIz        "
    
    for n=0 to 10
    gosub GiroIz
    next n
    print at 2,1,"GiroDe        "
    
    for n=0 to 10
    gosub GiroDe
    next n
    
goto Inicio    
'*******************************************************************************
'******************* comtrol motror psp ****************************************
'*******************************************************************************
GiroIzLento: '76543210
     portd = %00110001
    delayms 50
     portd = %00110101
    delayms 50
     portd = %00110100
    delayms 50
     portd = %00110110
    delayms 50
     portd = %00110010
    delayms 50
     portd = %00111010
    delayms 50
     portd = %00111000
    delayms 50
     portd = %00111001
    delayms 50
    return

GiroDeLento:
        portd = %00111001
    delayms 50
        portd = %00111000
    delayms 50
        portd = %00111010
    delayms 50
        portd = %00110010
    delayms 50
        portd = %00110110
    delayms 50
        portd = %00110100
    delayms 50
        portd = %00110101
    delayms 50
        portd = %00110001
    delayms 50
Return
GiroIz:
        portd = %00110101
    delayms 10
        portd = %00110110
    delayms 10
        portd = %00111010
    delayms 10
        portd = %00111001
    delayms 10
 return
 
GiroDe:
        portd = %00111001
    delayms 10
        portd = %00111010
    delayms 10
        portd = %00110110
    delayms 10
        portd = %00110101
    delayms 10
 return
 '
« Última modificación: 03 de Abril de 2012, 04:23:01 por Noelillo »


 

anything