-
Notifications
You must be signed in to change notification settings - Fork 0
/
LCDsoft.asm
74 lines (74 loc) · 1.41 KB
/
LCDsoft.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
;Manejo LCD
LCD_Clear equ b'00000001' ; Borra y cursor al principio
LCD_Inc equ b'00000110' ; Selecciona incrementos
Curs_Off equ b'00001100' ; Disp. on, sin cursor, no parp.
LCD_Funcion equ b'00111100' ; Bit 4 DL (=0 4 bit bus)
LCD_CGRAM equ b'01000000' ; Pone dirección CGRAM
LCD_Linea1 equ b'10000000' ; Posición 0 (00h). Línea 1
LCD_Linea2 equ b'11000000' ; Posición 64 (40h). Línea 2
; Subrutinas manejo LCD
LCDReset
movlw LCD_Funcion ; Repite orden
call LCDComando
movlw LCD_Clear ;
call LCDComando
movlw LCD_Inc ;
call LCDComando
return
; ---
LCDComando
bcf LCD_Control,LCD_RS ; LCD_RS = 0 Comando
movwf LCD_Data ; LCD_Data = W
LCDEnable
bsf LCD_Control,LCD_E ; LCD_E = 1
call Pause ; retardo 1us
bcf LCD_Control,LCD_E ; LCD_E = 0
return
; ---
LCDWrite
bsf LCD_Control,LCD_RS ; LCD_RS = 1 Caracter
movwf LCD_Data ; LCD_Data = W
goto LCDEnable
; ---
Pause
movlw 0xff
movwf Counter1
movlw 0x0A
movwf Counter2
LCDLoop
decfsz Counter1,1
goto LCDLoop
decfsz Counter2,1
goto LCDLoop
return
; --- NEW --- NEW
LCDClear
movlw LCD_Clear
call LCDComando
return
; ---
LCDInc
movlw LCD_Inc
call LCDComando
return
; ---
CursorOff
movlw Curs_Off
call LCDComando
return
; ---
LCDCGRAM
movlw LCD_CGRAM
call LCDComando
return
; ---
LCDLine1
movlw LCD_Linea1
call LCDComando
return
; ---
LCDLine2
movlw LCD_Linea2
call LCDComando
return
; ---