;************************************************* www.x-robotics.com ******* ; PROGRAMA : X-ProbeLCD3310.asm ; Funcion : Control LCD grafico NOKIA 3310 ; ; ; ;--------------------------------------------------------------------------- ; Revision : 2.00 Fecha: 8/10/2005 Programa para : PIC16F876 ; CPU Clock : 4 MHz Tiempo instruccion : 1uS ; WDT : OFF Tipo de reloj : XT ; Code Prot : OFF cfg USART rs232 ; none ; Autor : Daniel C. Martin " ionitron@x-robotics.com " ;************************************************* www.x-robotics.com ******* processor 16F876 LIST P=16F876 ;Se indica el modo de procesador INCLUDE ;se incluye la definicion de los ;registros internos __config 3D31 ;---------------------------------------------------------------------------- org 0x00 ;vector de inicio goto INICIO org 0x05 ;despues del vector de interrupcion ;<<<<<<----------------- INICIO PROGRAMA PRINCIPAL ------------------->>>>>>> ;---------------------------------------------------------------------------- INICIO bcf STATUS,RP0 ;banco 0 >>>> bcf STATUS,RP1 clrf PORTA ;carga latches de salida antes de cfg clrf PORTB clrf PORTC bsf PORTC,SCE ;/SCE a 1 bsf PORTC,DC ;D/C a 1 bsf PORTC,RST ;/RESET a 1 bsf STATUS,RP0 ;banco 1 >>>> movlw 0x06 ;modo A/D puerto A movwf ADCON1 clrf TRISA ;portA como salida clrf TRISB ;portB como salida clrf PORTC ;portC como salida bcf STATUS,RP0 ;banco 0 >>>> call INI_LCD ;inicializa y configura el LCD ;----------------------------------------------------------------------------- goto continua ;................ DEFINICION DE ROTULOS ..................................... mensaje1 dt "Control LCD NOKIA3310 x-robotics.com ",0xFD mensaje2 dt "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890 @#$%&/()*+-,.:;<>?[]^",0xFD ;............................................................................ continua ;-----apunta a una posicion grafica del LCD donde empezar a escribir movlw .0 ;Y address call Y_address movlw .0 ;X address call X_address ;------------------------------------------------------------------- movlw mensaje1 ;<---- poner aqui la etiqueta del mensaje PCL-LSB movwf rotulo ;direcciona al mensaje que se quiere visualizar call lee_rotulo call del1seg ;retardo 1 segundo call CLR_LCD ;limpia la pantalla ;-----apunta a una posicion grafica del LCD donde empezar a escribir movlw .0 ;Y address call Y_address movlw .0 ;X address call X_address ;------------------------------------------------------------------- movlw mensaje2 ;<---- poner aqui la etiqueta del mensaje PCL-LSB movwf rotulo ;direcciona al mensaje que se quiere visualizar call lee_rotulo acabar call del1seg ;retardo 1 segundo call CLR_LCD ;limpia la pantalla goto continua ;bucle infinito ;-----------------retardo 1 segundo--------------------------- ;------------------------------------------------------------- del1seg movlw .14 ; 1 set number of repetitions (C) movwf PDel0 ; 1 | PLoop0 movlw .72 ; 1 set number of repetitions (B) movwf PDel1 ; 1 | PLoop1 movlw .247 ; 1 set number of repetitions (A) movwf PDel2 ; 1 | PLoop2 nop ; 1 clear watchdog decfsz PDel2, 1 ; 1 + (1) is the time over? (A) goto PLoop2 ; 2 no, loop decfsz PDel1, 1 ; 1 + (1) is the time over? (B) goto PLoop1 ; 2 no, loop decfsz PDel0, 1 ; 1 + (1) is the time over? (C) goto PLoop0 ; 2 no, loop PDelL1 goto PDelL2 ; 2 cycles delay PDelL2 nop ; 1 cycle delay return ; 2+2 Done ;------------------------------------------------------------- include ;aņade la libreria al final del codigo END ;************************************************* www.x-robotics.com *******