Jose

Páginas: 6 (1349 palabras) Publicado: 27 de diciembre de 2010
List p=16F84 ;Tipo de procesadorinclude "P16F84.INC" ;Definiciones de registros internosw equ 00 ;Working Register f equ 01 ;File-Register Z equ 02 Lcd_var equ 0x0c ;Variables (2) para rutinas de manejo del LCDContador_L equ 0x0e ;Variable para el contador parte bajaContador_H equ 0x0f ;Variable para el contador partealtaTemporal_1 equ 0x10 ;Variable temporalTemporal_2 equ 0x11 ;Variable temporal LCD_DATO equ 0 ;switch2, input RA1_LCD_E equ 02 ;LCD-Enable, RA2 status equ 03 _LCD_RS equ 03 porta equ 05 ;RB portportb equ 06 ;RB port_time0_1 equ 0c ;Register for time loop 0,1ms_time4ms equ 0d ;Register fortime loop 4msorg 0x00 ;Vector de Resetgoto Inicioorg 0x05 ;Salva vector de interrupción ;-------------------- Initialise LC-Display -----------------------_lcdinit bcf porta,_LCD_RS ;RS-Bit low movlw b'00110000' ;LCD Initialise call _w2lcd ; call _4ms ;wait _4msmovlw b'00110000' ;LCD Initialise call _w2lcd ; movlw b'00110000' ;LCD Initialise call _w2lcd ;jump to UP _w2lcd movlw b'00111000' ;Function Set ;db4=1 > 8 bit data ;db3=1 > Display 2 lines;db2=0 > 5*8dots call _w2lcd ; movlw b'00001110' ;Display Control ;db2=1 > display on ;db1=1 > cursor on ;db0=0 > cursor doesn't blink call _w2lcd ;movlw b'00000001' ;clear display call _w2lcd ; return ;end subroutine;---------------- write content of w to lcd ------------------_w2lcd movwf portb ;copy W-Reg. to portb bsf porta,_LCD_E ;toggle enable bcf porta,_LCD_E ;toggle enable clrf portb;portb = 0; Time loop, approx. 100 mys (delay for LCD)_100mys movlw d'25' ;d'25' in W-Register movwf _time0_1 ;copy W to register _time0_1__m1 decf _time0_1,f ;decrement Reg. _time0_1 btfss status,Z ;if Zero Bit in Status Register = 1 ;skip next instruction goto__m1 ;jump to __m1 return ;end subroutine | ; Time loop approx. 4 ms (delay for LCD) --_4ms movlw d'40' ;d'40' in W-Register movwf _time4ms ;copy W to _time4ms__m2 call _100mys ; delay 100mysdecf _time4ms,f ;decrement _time4msbtfss status,Z ;if Zero Bit in StatusRegister = 1 ;skip next instructiongoto __m2 ;jump to __m2 return ;end subroutine;---------------- write content of w to lcd ------------------_w2lcd movwf portb ;copy W-Reg. to portb bsf porta,_LCD_E ;toggle enable bcf porta,_LCD_E ;toggle enable clrf portb;portb = 0; Time loop, approx. 100 mys (delay for LCD)_100mys movlw d'25' ;d'25' in W-Registermovwf _time0_1 ;copy W to register _time0_1__m1 decf _time0_1,f ;decrement Reg. _time0_1btfss status,Z ;if Zero Bit in Status Register = 1 ;skip next instructiongoto __m1...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Jose Jose
  • Jose jose
  • Jos y jos
  • Jose Jose
  • Jose
  • Jose
  • Jose
  • Jose

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS