This repository was archived by the owner on May 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLCD.inc
More file actions
76 lines (63 loc) · 1.4 KB
/
Copy pathLCD.inc
File metadata and controls
76 lines (63 loc) · 1.4 KB
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
75
;Write to the LCD Control register
WrLCC movlw 0x04
movwf PORTE
movf Output,w
movwf PORTB
movlw 0x00
movwf PORTE
Call Delay_50us
movlw 0x04
movwf PORTE
return
;Write to the LCD Data register
WrLCD movlw 0x05
movwf PORTE
movf Output,w
movwf PORTB
movlw 0x01
movwf PORTE
Call Delay_50us
movlw 0x05
movwf PORTE
return
;Set up the LCD (send the init string)
;------------------------------
SetLCD
call Delay_100ms ;Wait for LCD to init
movlw 0x38 ;2-line, 5x7, 8-bit mode
movwf Output
call WrLCC
movlw 0x0C ;(was 0x0C. Disp on/Cursor on/blink)
movwf Output
call WrLCC
movlw 0x01 ;Clear the display
movwf Output
call WrLCC
movlw 0x06 ;Set shift-right behavior
movwf Output
call WrLCC
movlw 0x02 ;Return home
movwf Output
call WrLCC
call Delay_2ms
return
goto $ ;GUARD
Cls
movlw 0x01 ;Clear the display
movwf Output
call WrLCC
call Delay_2ms ;Per spec sheet
return
QuickCls ;Like Cls, but with no delay. Use only when
;certain 2ms or more will pass before the LCD
;is accessed again.
movlw 0x01 ;Clear the display
movwf Output
call WrLCC
return
LCDGoto ;GOTO location in variable Output:
;0x00 to 0x27 in first line (0x00 - 0x0F visible),
;0x40 to 0x67 in second line (0x40 - 0x4F visible).
bsf Output, 7 ;Set high bit of Output
goto WrLCC ;WrLCC will handle the return
;(this saves a stack level)