Hola, mira esto:
'****************************************************************
'* 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
'