[Aporte] Interfaz y galeria PSI para LCD 128x64

Hola compañeros, hoy les traigo acá un desarrollo de hace mucho tiempo el cual yo no lo tuve que creo que puede facilitarles mucho la cosa respecto a los LCD gráficos, son galerías creadas por mí que creo que pueden ser de mucha utilidad. Se pueden crear cosas muy dinámicas con presupuestos bastante limitados. Por motivos de venta y patente en el prototipo no puedo publicar el circuito, pero es intuitivo para alguien que está en el tema, creo que lo fundamental en este caso es el software cada quien experimentara y realizara su propio circuito.

Para mas entretenimiento y visualización he grabado todo en video cosa que hasta me parecía mas rápido y divertido (primera vez que grabo algo explicándolo :aplauso:). Siempre hay una primera vez. Fue una lucha mental el hecho de publicar esto no por fama ni nada, tampoco créditos, sino que me gusta compartir y ver los desafíos ajenos que también me son compartidos y de muchísima utilidad. Es como una devolución "anónima" de ayuda. Respecto al programa... Debería comprarme una camiseta de "amo el BASIC".

Por que elegí el Pic Simulator Ide? Bien la respuesta es que fue mi primera experiencia con código no ensamblador y me ayudo a entender muchas cosas, casi que aprendí primero BASIC que ASM. Aparte sin contar que me parece fabuloso que este programa haya sido desarrollado por una sola persona (increíble señor vladimir Soso). Tiene una venta bastante personalizada y es posible hablar con él no es una computadora automatizada.


Muchas funciones no están explicadas, en caso de fuerza mayor pídanme que las explique aun así, los nombres de las variables y funciones son extremadamente intuitivas

Sin más preámbulos acá empiezo a subir los videos
Reseña:



Explicacion CODIGO:








PROGRAMA PARA CREAR FONDOS DE PANTALLA





y el codigo de muestra que es el del video

Código:
'// PROGRAMADO Y DISEÑADO POR ROBERTO PEÑA
'// INICIADO: 15/11/2014
'// TERMINADO: 22/01/2015
'// Horas de trabajo: 360
'// Costo de programa venta unica prototipo: x (Pesos Argentinos)
'// Programa: PIC-18 SIMULATOR IDE (Version profecional) + ADD-ONS(Version profecional)
 
 
 
'// INICIO CONFUGURACIONES DEL REGISTRO PRINCIPAL
Define CONFIG1L = 0x00
Define CONFIG1H = 0x06
Define CONFIG2L = 0x18
Define CONFIG2H = 0x00
Define CONFIG3L = 0x00
Define CONFIG3H = 0x81
Define CONFIG4L = 0x80
Define CONFIG4H = 0x00
Define CONFIG5L = 0x00
Define CONFIG5H = 0x00
Define CONFIG6L = 0x00
Define CONFIG6H = 0x00
Define CONFIG7L = 0x00
Define CONFIG7H = 0x00
Define CLOCK_FREQUENCY = 24
'// INICIO CONFUGURACIONES DEL REGISTRO PRINCIPAL
 
AllDigital
 
iniciar_programa:
 
 
'//CONFIGURACIONES A-E
TRISA.0 = 0  'Activar Frecuencia
TRISA.1 = 0  'Step Frecuencia
TRISA.3 = 0
 
TRISB = 0x0  'Datos LCD
 
TRISC.7 = 0  'Bit LCD
TRISC.1 = 0  'start_frec
 
TRISD.0 = 1
TRISD.1 = 1
TRISD.2 = 1
TRISD.3 = 0  'LCD_ON
TRISD.4 = 0  'Bit LCD
TRISD.5 = 0  'Bit LCD
TRISD.6 = 0  'Bit LCD
TRISD.7 = 0  'Bit LCD
 
TRISE.0 = 0  'buzzer
 
Define ADC_CLOCK = 3
Define ADC_SAMPLEUS = 50
 
PWMon 2, 7
 
Define STRING_MAX_LENGTH = 100
'//CONFIGURACIONES A-E
 
 
 
 
 
'//IMPORTAR INTERFACEZ
Include "interfaz_visual.bas"
Include "interfaz_datos.bas"
Include "interfaz_io.bas"
Include "interfaz_sistema.bas"
'//IMPORTAR INTERFACEZ
 
 
 
 
 
'// SYMBOLOS DE SISTEMA
Symbol lcd_on = PORTD.3
Symbol buzzer = PORTE.0
Symbol sda = PORTE.2
Symbol scl = PORTE.1
Symbol button_port = PORTD.1
Symbol button_ar = PORTD.0
Symbol button_ab = PORTC.2
Symbol reset_frec = PORTA.0
Symbol step_frec = PORTA.1
'// SYMBOLOS DE SISTEMA
 
 
 
 
'// INICIAR PUERTOS LCD APAGADOS
PORTB = 0xff
PORTD.4 = 1
PORTD.6 = 1
PORTD.5 = 1
PORTD.7 = 1
PORTC.7 = 1
'// INICIAR PUERTOS LCD APAGADOS
 
 
 
 
'// INICIAR PERIFERICOS
buzzer = 0
reset_frec = 1
step_frec = 1
pwm = 0
I2CPrepare sda, scl
'// INICIAR PERIFERICOS
 
 
 
 
'//VARIABLES DECLARACIONES
Dim tiempo As Word
Dim pwm_count As Byte
Dim frecuencia As Byte
Dim reg As Byte
Dim tmr0_cont As Word
Dim estado_direccion As Byte
Dim opcion_actual As Byte
Dim word_generica As Word
Dim variable_antigua As Word
Dim variable_generica As Word
Dim variable_generic2 As Word
Dim variable_generic3 As Byte
Dim string_generico As String
Dim pantalla_generica As Byte
Dim proc_string_return As String
Dim toggle_timer As Bit
Dim r1 As Byte
Dim r2 As Byte
Dim r3 As Byte
Dim r4 As Byte
Dim ram_r1 As Byte
Dim ram_r2 As Byte
Dim rp As Byte
Dim minutos As Byte
Dim segundos As Byte
Dim milisegundos As Word
Dim pause As Bit
Dim reemplazar As Byte
Dim minusculas As Byte
Dim buton_click As Bit
Dim buton_bit As Bit
Dim buton_press As Bit
Dim generic_bit As Bit
Dim users As Byte
Dim i As Byte
Dim j As Word
Dim editar As Bit
Dim potencia As Byte
Dim ram_potencia As Byte
Dim ram_tiempo As Word
Dim modo As Byte
Dim pagina As Byte
Dim pagina_ver_usuarios As Byte
Dim estado_an As Word
Dim pantalla As Byte
Dim volver_a_terminar As Bit
Dim cabezal As Byte
Dim op_act(22) As Word
Dim idioma As Bit
Dim guardar_nuevo As Bit
Dim establecer_parametros As Byte
Dim butoncase As Byte
Dim tiempo_boton_presionado As Long
Dim global_string As String
Dim pwm As Byte
Dim pwm_global As Byte
Dim context_menu As String
Dim pwm_enable As Bit
Dim total As Byte
Dim name_string As String
Dim ram_name_string As String
Dim abecedario As String
Dim numeros As String
Dim simbolos As String
Dim abecedario_m As String
Dim r_dato As Byte
Dim bit_generico As Bit
Dim _p As Byte
Dim _h As Byte
Dim ram_p As Byte
Dim ram_h As Byte
Dim seg As Word
Dim ram_modo As Byte
Dim ram_frecuencia As Byte
Dim ram_cabezal As Byte
Dim contar_encendido As Word
Dim frecuencia_emitida As Bit
'//VARIABLES DECLARACIONES
 
 
'//DEFINICIONES
reg = 0xa0
tmr0_cont = 0
r1 = 0
r2 = 5
r3 = 0
r4 = 0
rp = 0
reemplazar = 0
minusculas = 0
buton_click = True
buton_press = 0
buton_bit = 0
milisegundos = 0
editar = False
potencia = 15
modo = 1
pagina_ver_usuarios = 1
pagina = 0
estado_an = "c"
pantalla = 0
pause = True
opcion_actual = 0
op_act(0) = 0
op_act(1) = 0
op_act(2) = 0
op_act(3) = 0
op_act(4) = 0
op_act(5) = 0
op_act(6) = 0
op_act(7) = 0
op_act(8) = 0
op_act(9) = 0
op_act(10) = 0
op_act(11) = 0
op_act(12) = 0
op_act(13) = 0
op_act(14) = 0
op_act(15) = 0
op_act(16) = 0
op_act(17) = 0
op_act(18) = 0
op_act(19) = 0
op_act(20) = 0
op_act(21) = 0
pwm_count = 0
contar_encendido = 0
guardar_nuevo = False
establecer_parametros = 0
cabezal = 0
pwm_enable = False
r_dato = 0
name_string = ""
abecedario = "   abcdefghijklmnopqrstuvwxyz"
abecedario_m = "   ABCDEFGHIJKLMNOPQRSTUVWXYZ"
numeros = "   0123456789"
simbolos = "   !$%&=?(){}[]+-"
'//DEFINICIONES
 
 
'// INICIAR INTERFAZ LCD (tiempo estimado 3000 mili segundos)
lcd_on = 0
WaitMs 2000
lcd_on = 1
WaitMs 50
Define GLCD_DREG = PORTB
Define GLCD_RSREG = PORTD
Define GLCD_RSBIT = 4
Define GLCD_EREG = PORTD
Define GLCD_EBIT = 6
Define GLCD_RWREG = PORTD
Define GLCD_RWBIT = 5
Define GLCD_CS1REG = PORTD
Define GLCD_CS1BIT = 7
Define GLCD_CS2REG = PORTC
Define GLCD_CS2BIT = 7
GLcdinit
WaitMs 50
GLcdclear 0x00
WaitMs 500
'// INICIAR INTERFAZ LCD
 
 
'/CONFIGURACION DEL TIMER 0
T0CON.T0CS = 0
T0CON.TMR0ON = 1
INTCON.TMR0IE = 1  'LIMPIAR BANDERA
Enable High  'activar alta prioridad en interrupcion
RCON.IPEN = 1
'/CONFIGURACION DEL TIMER 0
 
 
 
'/INICIAR LOGO EN PANTALLA
Call imprimir_pantalla()
WaitMs 5000
'/INICIAR LOGO EN PANTALLA
 
 
 
'//COMPROBAR ERRORES
Call comprobar_memoria_externa()
Call contar_usuarios()
'//COMPROBAR ERRORES
 
 
 
 
 
'//APAGAR EQUIPO
Goto _escape
    apagar:
        pwm = 0
        lcd_on = 0
        PORTB = 0xff
        PORTD.4 = 1
        PORTD.6 = 1
        PORTD.5 = 1
        PORTD.7 = 1
        PORTC.7 = 1
        If button_port Then
            contar_encendido = contar_encendido + 1
            WaitMs 1
            If contar_encendido > 2000 Then Goto iniciar_programa
        Else
            contar_encendido = 0
        Endif
Goto apagar
'//APAGAR EQUIPO
 
 
_escape:
Call reset_generador()
pwm = 0
 
PORTA.3 = 0
'PANTALLA_________________Inicio______________________0
'PANTALLA_____________________________________________0
'PANTALLA_____________________________________________0
'PANTALLA_____________________________________________0
'PANTALLA_____________________________________________0
If pantalla = 0 Then
    GLcdclear 0x00
    string_generico = "INICIO"
    Call item(string_generico, 0)
    Call crear_windows()
    WaitMs 20
 
    elejir_programa:
 
        Call limpiar_renglon(4, 3, 124, True)
        context_menu = ""
        context_menu = context_menu + "///"
        context_menu = context_menu + "PROGRAMAS FIJOS/"
        context_menu = context_menu + "PROGRAMAS USUARIO/"
        context_menu = context_menu + "MODO MANUAL/"
        context_menu = context_menu + "ACERCA DE/"
        context_menu = context_menu + "APAGAR/"
        total = CountChr(context_menu, "/") - 4
        Call generar_menu(context_menu, op_act(pantalla))
        Call invertir_renglon(4, 3, 124, True)
 
        Call sb()
 
        variable_antigua = op_act(pantalla)
    elejir_programa2:
        'ACA VA LA SELECCION DE ITEMS!
 
        Call volver(0, False, 10000)
 
        generic_bit = llamoclick()
        If generic_bit = True Then
            If op_act(pantalla) = 0 Then
                pantalla = 6
                Goto _escape
            Endif
            If op_act(pantalla) = 1 Then
                pantalla = 2
                Goto _escape
            Endif
            If op_act(pantalla) = 2 Then
                establecer_parametros = 0
                Call valores_predeterminados()
                pantalla = 7
                Goto _escape
            Endif
            If op_act(pantalla) = 3 Then
                pantalla = 1
                Goto _escape
            Endif
            If op_act(pantalla) = 4 Then
                Call despedirse()
                WaitMs 2000
                Call imprimir_pantalla()
                WaitMs 5000
                Goto apagar
            Endif
        Endif
 
        Call deslizar(0, total, 1)
 
        If variable_antigua <> op_act(pantalla) Then Goto elejir_programa
        Goto elejir_programa2
Endif
'PANTALLA_______________Acerca de_____________________1
'PANTALLA_____________________________________________1
'PANTALLA_____________________________________________1
'PANTALLA_____________________________________________1
'PANTALLA_____________________________________________1
If pantalla = 1 Then
    GLcdclear 0x00
    string_generico = "ACERCA DE"
    Call item(string_generico, 0)
    Call crear_windows()
 
 
    string_generico = "Modelo: FR5M003A"
    Call item(string_generico, 2)
    string_generico = "FABRICANTE:"
    Call item(string_generico, 4)
    string_generico = " PH-ELECTRONICA.com"
    Call item(string_generico, 6)
 
    Call sb()
 
    elejir_programa_1:
    'ACA VA LA SELECCION DE ITEMS!
    generic_bit = llamoclick()
    If generic_bit = True Then
        pantalla = 0
        Goto _escape
    Endif
    Goto elejir_programa_1
Endif
 
'PANTALLA_____________________________________________6
'PANTALLA_____________________________________________6
'PANTALLA___________PROGRAMAS FIJOS___________________6
'PANTALLA_____________________________________________6
'PANTALLA_____________________________________________6
If pantalla = 6 Then
    GLcdclear 0x00
    string_generico = "PROGRAMAS FIJOS"
    Call item(string_generico, 0)
    Call crear_windows()
 
    elejir_programa_6:
 
        Call limpiar_renglon(4, 3, 124, True)
        context_menu = ""
        context_menu = context_menu + "///"
        context_menu = context_menu + ">CARA/"
        context_menu = context_menu + ">FRENTE/"
        context_menu = context_menu + ">BRAZO/"
        context_menu = context_menu + ">CINTURA/"
        context_menu = context_menu + ">ABDOMEN/"
        context_menu = context_menu + ">GLUTEOS/"
        context_menu = context_menu + ">PIERNAS/"
 
        total = CountChr(context_menu, "/") - 4
        Call generar_menu(context_menu, op_act(pantalla))
        Call invertir_renglon(4, 3, 124, True)
 
        Call sb()
 
        variable_antigua = op_act(pantalla)
 
        elejir_leer_botones_6:
            'ACA VA LA SELECCION DE ITEMS!
 
            Call volver(0, True, 10000)
 
            generic_bit = llamoclick()
            If generic_bit = True Then
                op_act(7) = 0
                If op_act(pantalla) = 0 Then
                    establecer_parametros = 4
                    name_string = "Cara"
                    r1 = 1
                    r2 = 5
                    r3 = 0
                    r4 = 0
                    modo = 15
                    potencia = 60
 
                    pantalla = 7
                    Goto _escape
                Endif
 
                If op_act(pantalla) = 1 Then
                    establecer_parametros = 4
                    name_string = "Frente"
                    r1 = 1
                    r2 = 5
                    r3 = 0
                    r4 = 0
                    modo = 10
                    potencia = 80
 
                    pantalla = 7
                    Goto _escape
                Endif
 
                If op_act(pantalla) = 2 Then
                    establecer_parametros = 4
                    name_string = "Brazo"
 
                    r1 = 1
                    r2 = 5
                    r3 = 0
                    r4 = 0
                    modo = 15
                    potencia = 50
 
                    pantalla = 7
                    Goto _escape
                Endif
 
                If op_act(pantalla) = 3 Then
                    establecer_parametros = 4
                    name_string = "Cintura"
                    r1 = 0
                    r2 = 6
                    r3 = 0
                    r4 = 0
                    modo = 5
                    potencia = 30
                    pantalla = 7
                    Goto _escape
                Endif
                If op_act(pantalla) = 4 Then
                    establecer_parametros = 4
                    name_string = "Abdomen"
                    r1 = 0
                    r2 = 6
                    r3 = 0
                    r4 = 0
                    modo = 5
                    potencia = 30
                    pantalla = 7
                    Goto _escape
                Endif
                If op_act(pantalla) = 5 Then
                    establecer_parametros = 4
                    name_string = "Gluteos"
                    r1 = 0
                    r2 = 6
                    r3 = 0
                    r4 = 0
                    modo = 5
                    potencia = 30
                    pantalla = 7
                    Goto _escape
                Endif
                If op_act(pantalla) = 6 Then
                    establecer_parametros = 4
                    name_string = "Piernas"
                    r1 = 0
                    r2 = 6
                    r3 = 0
                    r4 = 0
                    modo = 5
                    potencia = 30
                    pantalla = 7
                    Goto _escape
                Endif
            Endif
 
 
    Call deslizar(0, total, 1)
 
    If variable_antigua <> op_act(pantalla) Then Goto elejir_programa_6
    Goto elejir_leer_botones_6
Endif
'PANTALLA_____________________________________________FIN
'PANTALLA_____________________________________________FIN
'PANTALLA_____________________________________________FIN
'PANTALLA_____________________________________________FIN
'PANTALLA_____________________________________________FIN
 
End                                               
 
 
 
 
 
On High Interrupt
    Save System  'Almacenar sistema en memoria RAM
 
 
    buton_press = button_port
    Dim switch As Byte
    If button_ar = True And button_ab = False Then
        switch = 0
    Endif
    If button_ar = True And button_ab = True Then
        switch = 1
    Endif
    If button_ab = True And button_ar = False Then
        switch = 2
    Endif
    If button_ab = False And button_ar = False Then
        switch = 3
    Endif
 
    If switch > 0 And switch < 2 Then
        If switch > estado_direccion Then
            estado_direccion = switch
            butoncase = 0
        Endif
        If switch < estado_direccion Then
            estado_direccion = switch
            butoncase = 2
        Endif
    Endif
 
    estado_direccion = switch
    If switch = 3 Then
        butoncase = 1
    Endif
 
    TMR0 = 2  'CARGAR 2 EN TIMER 0
 
    If pause = False Then tmr0_cont = tmr0_cont + 1
 
    If tmr0_cont = 4675 Then
        milisegundos = milisegundos + 1
        If milisegundos = 9 Then
            If seg > 0 Then seg = seg - 1
            toggle_timer = True
        Endif
        If milisegundos = 20 Then
            If seg > 0 Then seg = seg - 1
            toggle_timer = True
            milisegundos = 0
        Endif
 
        tmr0_cont = 0
    Endif
    PWMduty 2, pwm
 
 
 
    INTCON.TMR0IF = 0  'LIMPIAR LA BANDERA DE INTERRUPCION
Resume


y por ultimo los adjuntos. Saludos y espero que les guste!
 

Adjuntos

  • librerias.rar
    7.2 KB · Visitas: 8
  • PH-ELECTRONICA screen creator.zip
    20.5 KB · Visitas: 6
  • programa.rar
    136.2 KB · Visitas: 7
Última edición por un moderador:
Atrás
Arriba