hola gente alguien me puede decir por que no me funciona este codigo?
me estube quemando la cabeza todo el dia y no logre hacerlo funcionar, les agradeceria si alguien me puede tirar una mano.
dejo como archivo adjunto el esquematico y el codigo del pic.
'****************************************************************
'* Name : UNTITLED.BAS *
'* Author : [select VIEW...EDITOR OPTIONS] *
'* Notice : Copyright (c) 2008 [select VIEW...EDITOR OPTIONS] *
'* : All Rights Reserved *
'* Date : 01/02/2008 *
'* Version : 1.0 *
'* Notes : *
'* : *
'****************************************************************
include "bs2defs.bas"
'define OSC 4
@ DEVICE pic16f627a, INTRC_OSC_NOCLKOUT 'xt_osc'Reloj interno solo
@ DEVICE pic16f627a, WDT_OFF ' Watchdog Timer desconectado
@ DEVICE pic16f627a, PWRT_OFF ' Power-On Timer conectado
@ DEVICE pic16f627a, BOD_ON ' Brown-Out Detect conectado
@ DEVICE pic16f627a, MCLR_OFF ' Master Clear Externo desconectado
@ DEVICE pic16f627a, LVP_OFF ' Low-Voltage Programming desconectado
@ DEVICE pic16f627a, CPD_OFF ' Data Memory Code Protect desconectado
'@ DEVICE pic16f628, _OFF '
'****************************** VARIABLES **************************************
D_in var portb.0 ' desplazam. datos (74x165.7)
Clock var portb.3 ' reloj (74x165.2)
Load var portb.4 ' carga de entrada (74x165.1)
switches VAR Byte ' interruptores de entrada
'******************************* LCD *******************************************
'los datos de los cables que detallo son de izquierda a derecha empezando
'por negativo positivo
' 1 - masa
' 2 - positivo 5VCC
' 3 - preset
' 4 - porta.0
' 5 - porta.2
' 6 - porta.1
' 7, 8 y 9 en el aire
' 10 - portb.0
' 11 - portb.1
' 12 - portb.2
' 13 - portb.3
' Define LCD registers and bits
Define LCD_DREG PORTA 'PORTB 'LCD data port
Define LCD_DBIT 0
Define LCD_RSREG PORTA 'LCD register select port
Define LCD_RSBIT 7
Define LCD_EREG PORTA 'LCD enabled port
Define LCD_EBIT 6
Define LCD_BITS 4 ' Aquí indicamos que trabajamos con 4 bits en vez de 8
DEFINE LCD_LINES 2
DEFINE LCD_COMMANDUS 2000
DEFINE LCD_DATAUS 50
CMCON = 7
Pause 100 ' Wait for LCD to start up
inicio:
Lcdout $FE, 1 ' Clear LCD screen
PAUSE 10
LCDOUT $FE,1,"Placa escuela"
lcdout $FE,$C0,"Iniciada"
pause 100
' -------------------------------------------------------------------------
Inicializar:
HIGH Load ' hace salida en estado alto
' -------------------------------------------------------------------------
Principal:
goto leer_pulsadores ' lee 8-pos. del dip switch
'gosub escribir
PAUSE 100
GOTO Principal ' repite
END
' -------------------------------------------------------------------------
leer_pulsadores:
PULSOUT Load,3 ' toma valores interruptores
SHIFTIN D_in,Clock,MSBPre,[B0] ' desplaza valores
escribir:
Lcdout $FE, 1 ' Clear LCD screen
PAUSE 10
LCDOUT $FE,1,"Placa escuela"
lcdout $FE,$C0,#B0
pause 10
goto leer_pulsadores
un abrazo y gracias!
me estube quemando la cabeza todo el dia y no logre hacerlo funcionar, les agradeceria si alguien me puede tirar una mano.
dejo como archivo adjunto el esquematico y el codigo del pic.
'****************************************************************
'* Name : UNTITLED.BAS *
'* Author : [select VIEW...EDITOR OPTIONS] *
'* Notice : Copyright (c) 2008 [select VIEW...EDITOR OPTIONS] *
'* : All Rights Reserved *
'* Date : 01/02/2008 *
'* Version : 1.0 *
'* Notes : *
'* : *
'****************************************************************
include "bs2defs.bas"
'define OSC 4
@ DEVICE pic16f627a, INTRC_OSC_NOCLKOUT 'xt_osc'Reloj interno solo
@ DEVICE pic16f627a, WDT_OFF ' Watchdog Timer desconectado
@ DEVICE pic16f627a, PWRT_OFF ' Power-On Timer conectado
@ DEVICE pic16f627a, BOD_ON ' Brown-Out Detect conectado
@ DEVICE pic16f627a, MCLR_OFF ' Master Clear Externo desconectado
@ DEVICE pic16f627a, LVP_OFF ' Low-Voltage Programming desconectado
@ DEVICE pic16f627a, CPD_OFF ' Data Memory Code Protect desconectado
'@ DEVICE pic16f628, _OFF '
'****************************** VARIABLES **************************************
D_in var portb.0 ' desplazam. datos (74x165.7)
Clock var portb.3 ' reloj (74x165.2)
Load var portb.4 ' carga de entrada (74x165.1)
switches VAR Byte ' interruptores de entrada
'******************************* LCD *******************************************
'los datos de los cables que detallo son de izquierda a derecha empezando
'por negativo positivo
' 1 - masa
' 2 - positivo 5VCC
' 3 - preset
' 4 - porta.0
' 5 - porta.2
' 6 - porta.1
' 7, 8 y 9 en el aire
' 10 - portb.0
' 11 - portb.1
' 12 - portb.2
' 13 - portb.3
' Define LCD registers and bits
Define LCD_DREG PORTA 'PORTB 'LCD data port
Define LCD_DBIT 0
Define LCD_RSREG PORTA 'LCD register select port
Define LCD_RSBIT 7
Define LCD_EREG PORTA 'LCD enabled port
Define LCD_EBIT 6
Define LCD_BITS 4 ' Aquí indicamos que trabajamos con 4 bits en vez de 8
DEFINE LCD_LINES 2
DEFINE LCD_COMMANDUS 2000
DEFINE LCD_DATAUS 50
CMCON = 7
Pause 100 ' Wait for LCD to start up
inicio:
Lcdout $FE, 1 ' Clear LCD screen
PAUSE 10
LCDOUT $FE,1,"Placa escuela"
lcdout $FE,$C0,"Iniciada"
pause 100
' -------------------------------------------------------------------------
Inicializar:
HIGH Load ' hace salida en estado alto
' -------------------------------------------------------------------------
Principal:
goto leer_pulsadores ' lee 8-pos. del dip switch
'gosub escribir
PAUSE 100
GOTO Principal ' repite
END
' -------------------------------------------------------------------------
leer_pulsadores:
PULSOUT Load,3 ' toma valores interruptores
SHIFTIN D_in,Clock,MSBPre,[B0] ' desplaza valores
escribir:
Lcdout $FE, 1 ' Clear LCD screen
PAUSE 10
LCDOUT $FE,1,"Placa escuela"
lcdout $FE,$C0,#B0
pause 10
goto leer_pulsadores
un abrazo y gracias!