Subversion Repositories svn.mios

Rev

Rev 52 | Rev 321 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
53 tk 1
; $Id: mios_lcd.inc 53 2008-01-30 22:52:41Z tk $
1 tk 2
;
3
; MIOS LCD Handler (2nd layer routines)
4
;
5
; ==========================================================================
6
;
7
;  Copyright 1998-2006 Thorsten Klose (tk@midibox.org)
8
;  Licensed for personal non-commercial use only.
9
;  All other rights reserved.
10
;
11
; ==========================================================================
12
 
13
MIOS_LCD_TYPE_CLCD		EQU	0x00
14
MIOS_LCD_TYPE_GLCD0		EQU	0x01
15
MIOS_LCD_TYPE_MLCD		EQU	0x06
16
MIOS_LCD_TYPE_CUSTOM_LCD	EQU	0x07
17
 
18
;; --------------------------------------------------------------------------
19
;;  FUNCTION: MIOS_LCD_TypeSet
20
;;  C_DECLARATION: void MIOS_LCD_TypeSet(unsigned char type, unsigned char par1, unsigned char par2)
21
;;  DESCRIPTION: sets the LCD type.
22
;;  Following LCDs are provided:<BR>
23
;;     0x00:	MIOS_LCD_TYPE_CLCD      (character dotmatrix LCD)<BR>
24
;;     0x01:	MIOS_LCD_TYPE_GLCD0	(graphical LCD, KS0108 or HD61202 compatible)<BR>
25
;;     0x06:	MIOS_LCD_TYPE_MLCD	(MIDI display, see SysEx implementation)<BR>
26
;;     0x07:	MIOS_LCD_TYPE_CUSTOM_LCD (custom LCD driver)<BR>
27
;;  Note that the MIOS_LCD_TypeAutoSet function allows you to derive the LCD
28
;;  type from the PIC ID header!
29
;;
30
;;  Use this function only if you want to force a special LCD type without
31
;;  changing the ID header of your PIC or if you want to set additional LCD
32
;;  options which are different from the default values
33
;;  IN:	  LCD type in WREG
34
;;        LCD Option #1 in MIOS_PARAMETER1
35
;;        LCD Option #2 in MIOS_PARAMETER2
36
;;  C_IN: LCD type in <type>
37
;;        LCD Option #1 <par1>
38
;;        LCD Option #2 <par2>
39
;;  OUT:  -
40
;;  USES: -
41
;;  EXAMPLE:
42
;;
43
;;  The available LCD options differ with the used LCD type, here a list:
44
;;
45
;;  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
46
;;
47
;;  Type 0, CLCD:
48
;;     with MIOS_PARAMETER1 and MIOS_PARAMETER2 the enable (E) pins of
49
;;     the character displays are specified. By default the E input of
50
;;     the first CLCD should be connected to pin D.7, the E input of
51
;;     the second CLCD (if available) to C.4
52
;;     Following lines of code are necessary to achieve this:
53
;;
54
;;	;; use a CLCD, E input of first CLCD at D.7, E of second CLCD @C.4
55
;;	movlw	0x37		; E1: D.7, 8bit interface
56
;;	movwf	MIOS_PARAMETER1
57
;;	movlw	0x24		; E2: C.4, 8bit interface
58
;;	movwf	MIOS_PARAMETER2
59
;;	movlw	MIOS_LCD_TYPE_CLCD ; LCD type 0
60
;;	call	MIOS_LCD_TypeSet
61
;;
62
;;     Note: the first digit of the parameter value sets the port number
63
;;           (A=0, B=1, C=2, D=3, E=4)
64
;;           the second digit sets the pin number (0-7)
65
;;           bit #7 sets the interface (0=8bit, 0=7bit)
66
;;
67
;;     Example for CLCD with 4bit interface:
68
;;	;; use a CLCD, E input of first CLCD at D.7, E of second CLCD @C.4
69
;;	;; using the 4-bit interface:
70
;;	;; -> connect MBHP_CORE:J15:D7-D4 of the core module to D7-D4 of the LCD
71
;;      ;; -> left MBHP_CORE:J15:D3-D0 of the core module open!
72
;;	;; -> tie D3-D0 of the LCD to ground
73
;;	movlw	0x37 | 0x80	; E1: D.7, 4bit interface
74
;;	movwf	MIOS_PARAMETER1
75
;;	movlw	0x24 | 0x80	; E2: C.4, 4bit interface
76
;;	movwf	MIOS_PARAMETER2
77
;;	movlw	MIOS_LCD_TYPE_CLCD ; LCD type 0
78
;;	call	MIOS_LCD_TypeSet
79
;;
80
;;     Tip: by changing these parameters dynamically you are also able to
81
;;          drive more than 2 LCDs with one core module. Only the number
82
;;          of free pins limit the number of CLCDs which can be driven!
83
;;          Don't forget to switch the appr. pins to output before using
84
;;          them, and call MIOS_LCD_Init for every display pair in your
85
;;          USER_Init
86
;;
87
;;  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
88
;;
89
;; Type 1, KS0108 or HD61202 based
90
;;     with MIOS_PARAMETER1 it has to be specified if the chip select
91
;;     lines are inverted
92
;;
93
;;	;; use a KS0108 or HD61202 compatible graphical LCD with
94
;;	;; non-inverted chip selects
95
;;	movlw	0x00
96
;;	movwf	MIOS_PARAMETER1
97
;;	movlw	MIOS_LCD_TYPE_GLCD0
98
;;	call	MIOS_LCD_TypeSet
99
;;
100
;;   OR:
101
;;	;; use a KS0108 or HD61202 compatible graphical LCD with inverted
102
;;	;; chip selects
103
;;	movlw	0x01
104
;;	movwf	MIOS_PARAMETER1
105
;;	movlw	MIOS_LCD_TYPE_GLCD0
106
;;	call	MIOS_LCD_TypeSet
107
;;
108
;;  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
109
;;
110
;; Type 2, T6963C based
111
;;     not supported anymore, use the custom driver instead which are
112
;;     available in the MIOS download section
113
;;
114
;;  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
115
;;
116
;; Type 6, MIDI display
117
;;     see the MIOS SysEx implementation which is available in the MIOS
118
;;     download section
119
;;     MIOS_PARAMETER1 defines the device ID of the target core:
120
;;
121
;;	;; send MIDI messages to core with device ID 0x42
122
;;      clrf	MIOS_PARAMETER2		; unused (yet)
123
;;	movlw	0x42
124
;;	movwf	MIOS_PARAMETER1		; device ID of target core
125
;;	movlw	MIOS_LCD_TYPE_MLCD	; LCD type #6
126
;;	call	MIOS_LCD_TypeSet
127
;;
128
;;  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
129
;;
130
;; Type 7, custom LCD driver
131
;;     options are forwarded to the custom LCD driver
132
;;     following hooks have been prepared for an easy integration into
133
;;     MIOS:
134
;;        USER_LCD_Init
135
;;        USER_LCD_Clear
136
;;        USER_LCD_CursorSet
137
;;        USER_LCD_PrintChar
138
;;
139
;;  C_EXAMPLE:
140
;;
141
;;  The available LCD options differ with the used LCD type, here a list:
142
;;
143
;;  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
144
;;
145
;;  Type 0, CLCD:
146
;;     with <par1> and <par2> the enable (E) pins of
147
;;     the character displays are specified. By default the E input of
148
;;     the first CLCD should be connected to pin D.7, the E input of
149
;;     the second CLCD (if available) to C.4
150
;;     Following lines of code are necessary to achieve this:
151
;;
152
;;	// use a CLCD, E input of first CLCD at D.7, E of second CLCD @C.4
153
;;	MIOS_LCD_TypeSet(MIOS_LCD_TYPE_CLCD, 0x37, 0x24);
154
;;
155
;;     Note: the first digit of the parameter value sets the port number
156
;;           (A=0, B=1, C=2, D=3, E=4)
157
;;           the second digit sets the pin number (0-7)
158
;;           bit #7 sets the interface (0=8bit, 0=7bit)
159
;;
160
;;     Example for CLCD with 4bit interface:
161
;;	;; use a CLCD, E input of first CLCD at D.7, E of second CLCD @C.4
162
;;	;; using the 4-bit interface:
163
;;	;; -> connect MBHP_CORE:J15:D7-D4 of the core module to D7-D4 of the LCD
164
;;      ;; -> left MBHP_CORE:J15:D3-D0 of the core module open!
165
;;	;; -> tie D3-D0 of the LCD to ground
166
;;	MIOS_LCD_TypeSet(MIOS_LCD_TYPE_CLCD, 0x80 | 0x37, 0x80 | 0x24);
167
;;
168
;;     Tip: by changing these parameters dynamically you are also able to
169
;;          drive more than 2 LCDs with one core module. Only the number
170
;;          of free pins limit the number of CLCDs which can be driven!
171
;;          Don't forget to switch the appr. pins to output before using
172
;;          them, and call MIOS_LCD_Init for every display pair in your
173
;;          USER_Init
174
;;
175
;;  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
176
;;
177
;; Type 1, KS0108 or HD61202 based
178
;;     with <par1> it has to be specified if the chip select
179
;;     lines are inverted
180
;;
181
;;	// use a KS0108 or HD61202 compatible graphical LCD with
182
;;	// non-inverted chip selects
183
;;	MIOS_LCD_TypeSet(MIOS_LCD_TYPE_GLCD0, 0x00, 0x00); // (par2 unusued)
184
;;
185
;;   OR:
186
;;	// use a KS0108 or HD61202 compatible graphical LCD with inverted
187
;;	// chip selects
188
;;	MIOS_LCD_TypeSet(MIOS_LCD_TYPE_GLCD0, 0x01, 0x00); // (par2 unusued)
189
;;
190
;;  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
191
;;
192
;; Type 2, T6963C based
193
;;     not supported anymore, use the custom driver instead which are
194
;;     available in the MIOS download section
195
;;
196
;;  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
197
;;
198
;; Type 6, MIDI display
199
;;     see the MIOS SysEx implementation which is available in the MIOS
200
;;     download section
201
;;     MIOS_PARAMETER1 defines the device ID of the target core:
202
;;
203
;;	;; send MIDI messages to core with device ID 0x42
204
;;	MIOS_LCD_TypeSet(MIOS_LCD_TYPE_MLCD, 0x42, 0x00); // (par2 unusued)
205
;;
206
;;  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
207
;;
208
;; Type 7, custom LCD driver
209
;;     options are forwarded to the custom LCD driver
210
;;     following hooks have been prepared for an easy integration into
211
;;     MIOS:
212
;;        USER_LCD_Init
213
;;        USER_LCD_Clear
214
;;        USER_LCD_CursorSet
215
;;        USER_LCD_PrintChar
216
;;
217
;; --------------------------------------------------------------------------
218
MIOS_LCD_TypeSet
219
	bcf	MIOS_BOX_CFG0, 0	; ..or do you know a better method to
220
	bcf	MIOS_BOX_CFG0, 1	; mask out 4 bits w/o using WREG?
221
	bcf	MIOS_BOX_CFG0, 2
222
	bcf	MIOS_BOX_CFG0, 3
223
	andlw	0x07
224
	iorwf	MIOS_BOX_CFG0, F
225
 
226
	;; copy additional options
227
	movff	MIOS_PARAMETER1, MIOS_LCD_OPTION1
228
	movff	MIOS_PARAMETER2, MIOS_LCD_OPTION2
229
 
230
	;; clear timeout
231
	SET_BSR	MIOS_LCD_TIMEOUT1
232
	clrf	MIOS_LCD_TIMEOUT1, BANKED
233
 
234
	return
235
 
236
;; --------------------------------------------------------------------------
237
;;  FUNCTION: MIOS_LCD_TypeAutoSet
238
;;  C_DECLARATION: unsigned char MIOS_LCD_TypeAutoSet(void)
239
;;  DESCRIPTION: derives the LCD type from the PIC ID header
240
;;  IN:	  -
241
;;  C_IN:  -
242
;;  OUT:  type in WREG,
243
;;        additional LCD parameters in MIOS_PARAMETER1 and MIOS_PARAMETER2
244
;;  C_OUT:  type in WREG,
245
;;        additional LCD parameters in MIOS_PARAMETER1 and MIOS_PARAMETER2
246
;;  USES: BSR, TBLPTR
247
;;  EXAMPLE:
248
;;
249
;;	;; set LCD type to the specified type in the PIC ID header
250
;;	call	MIOS_LCD_TypeAutoSet
251
;;
252
;;  C_EXAMPLE:
253
;;
254
;;	// set LCD type to the specified type in the PIC ID header
255
;;	MIOS_LCD_TypeAutoSet();
256
;;
257
;; --------------------------------------------------------------------------
258
MIOS_LCD_TypeAutoSet
259
	IRQ_DISABLE			; we change TBLPTRU - IRQs have to be disabled!
260
	TABLE_ADDR_FULL _IDLOC6		; derive interface type from ID sector
261
	tblrd*				; get first byte
262
 
263
	;; clear the parameters by default
264
	clrf	MIOS_PARAMETER1
265
	clrf	MIOS_PARAMETER2
266
 
267
	;; set additional parameters depending on type
268
	BRA_IFSET TABLAT, 6, ACCESS, MIOS_LCD_TypeAutoSet_4567
269
MIOS_LCD_TypeAutoSet_0123
270
	BRA_IFSET TABLAT, 5, ACCESS, MIOS_LCD_TypeAutoSet_23
271
MIOS_LCD_TypeAutoSet_01
272
	BRA_IFSET TABLAT, 4, ACCESS, MIOS_LCD_TypeAutoSet_1
273
MIOS_LCD_TypeAutoSet_0
274
	;; CLCD: define default pins for first and second LCD
275
#if PIC_DERIVATIVE_SET_LCD_4BIT	; for CAN derivatives, where Tx/Rx is located at RB2/RB3
276
	movlw	0x37 | 0x80	; Pin D.7, 4bit mode
277
	movwf	MIOS_PARAMETER1
278
	movlw	0x24 | 0x80	; Pin C.4, 4bit mode
279
	movwf	MIOS_PARAMETER2
280
#else
281
	movlw	0x37		; Pin D.7
282
	movwf	MIOS_PARAMETER1
283
	movlw	0x24		; Pin C.4
284
	movwf	MIOS_PARAMETER2
285
#endif
286
	rgoto	MIOS_LCD_TypeAutoSet_Cont
287
 
288
MIOS_LCD_TypeAutoSet_1
289
	;; GLCD0: non-inverted chip select by default
290
	;; (MIOS_PARAMETER1==0)
291
	rgoto	MIOS_LCD_TypeAutoSet_Cont
292
 
293
MIOS_LCD_TypeAutoSet_23
294
	BRA_IFSET TABLAT, 4, ACCESS, MIOS_LCD_TypeAutoSet_3
295
MIOS_LCD_TypeAutoSet_2
296
	rgoto	MIOS_LCD_TypeAutoSet_Cont
297
MIOS_LCD_TypeAutoSet_3
298
	rgoto	MIOS_LCD_TypeAutoSet_Cont
299
 
300
MIOS_LCD_TypeAutoSet_4567
301
	BRA_IFSET TABLAT, 5, ACCESS, MIOS_LCD_TypeAutoSet_67
302
MIOS_LCD_TypeAutoSet_45
303
	BRA_IFSET TABLAT, 4, ACCESS, MIOS_LCD_TypeAutoSet_5
304
MIOS_LCD_TypeAutoSet_4
305
	rgoto	MIOS_LCD_TypeAutoSet_Cont
306
MIOS_LCD_TypeAutoSet_5
307
	rgoto	MIOS_LCD_TypeAutoSet_Cont
308
 
309
MIOS_LCD_TypeAutoSet_67
310
	BRA_IFSET TABLAT, 4, ACCESS, MIOS_LCD_TypeAutoSet_7
311
MIOS_LCD_TypeAutoSet_6
312
	;; MLCD: device ID == 0
313
	;; (MIOS_PARAMETER1==0)
314
	rgoto	MIOS_LCD_TypeAutoSet_Cont
315
MIOS_LCD_TypeAutoSet_7
316
	;; Custom LCD: no auto options
317
	rgoto	MIOS_LCD_TypeAutoSet_Cont
318
 
319
MIOS_LCD_TypeAutoSet_Cont
320
	swapf	TABLAT, W
321
	rcall	MIOS_LCD_TypeSet
322
	clrf	TBLPTRU			; clear upper table pointer so
323
	IRQ_ENABLE			; that the IRQs can be enabled again
324
	return
325
 
326
;; --------------------------------------------------------------------------
327
;;  FUNCTION: MIOS_LCD_TypeGet
328
;;  C_DECLARATION: unsigned char MIOS_LCD_TypeGet(void)
329
;;  DESCRIPTION: returns the LCD type
330
;;  Following LCDs are provided:<BR>
331
;;     0x00:	MIOS_LCD_TYPE_CLCD      (character dotmatrix LCD)<BR>
332
;;     0x01:	MIOS_LCD_TYPE_GLCD0	(graphical LCD, KS0108 or HD61202 compatible)<BR>
333
;;     0x06:	MIOS_LCD_TYPE_MLCD	(MIDI display, see SysEx implementation)<BR>
334
;;     0x07:	MIOS_LCD_TYPE_CUSTOM_LCD (custom LCD driver)<BR>
335
;;  IN:	  -
336
;;  C_IN:	  -
337
;;  OUT:  LCD type in WREG and MIOS_PARAMETER1
338
;;  C_OUT:  LCD type
339
;;  USES: -
340
;;  EXAMPLE:
341
;;
342
;;	;; branch depending on LCD type
343
;;	call	MIOS_LCD_TypeGet
344
;;	bnz     NoCLCD
345
;;
346
;;
347
;;	;; !!! Better for branching depending on CLCD/GLCD type display !!!
348
;;	;; !!! (works also with custom LCD driver                       !!!
349
;;	BRA_IFSET MIOS_BOX_CFG0, MIOS_BOX_CFG0_USE_GLCD, ACCESS, NoCLCD
350
;;
351
;;  C_EXAMPLE:
352
;;
353
;;	// branch depending on LCD type
354
;;	if( MIOS_LCD_TypeGet() == MIOS_LCD_TYPE_CLCD ) {
355
;;	  // do something special if CLCD connected
356
;;	}
357
;;
358
;;
359
;;	// !!! Better for branching depending on CLCD/GLCD type display !!!
360
;;	// !!! (works also with custom LCD driver                       !!!
361
;;	if( !MIOS_BOX_CFG0.USE_GLCD ) {
362
;;	  // do something special if CLCD connected
363
;;	}
364
;;
365
;; --------------------------------------------------------------------------
366
MIOS_LCD_TypeGet
367
	movf	MIOS_BOX_CFG0, W
368
	andlw	0x07
369
	return
370
 
371
;; --------------------------------------------------------------------------
372
;;  FUNCTION: MIOS_LCD_YAddressSet
373
;;  C_DECLARATION: void MIOS_LCD_YAddressSet(unsigned char line0, unsigned char line1, unsigned char line2, unsigned char line3);
374
;;  DESCRIPTION: maps the Y position of the cursor to the appr. cursor
375
;;  address of character and graphical displays.<BR>
376
;;  By default the positions are configured for 2x16, 2x20, 4x20 and 2x40 displays:<BR>
377
;;     Line0 -> MIOS cursor offset: 0x00 -> cursor address 0x00<BR>
378
;;     Line1 -> MIOS cursor offset: 0x40 -> cursor address 0x40<BR>
379
;;     Line2 -> MIOS cursor offset: 0x80 -> cursor address 0x14 (4x20 only)<BR>
380
;;     Line3 -> MIOS cursor offset: 0xc0 -> cursor address 0x54 (4x20 only)<BR>
381
;;  For 4x16 displays, the configuration has to be changed:<BR>
382
;;     Line0 -> MIOS cursor offset: 0x00 -> cursor address 0x00<BR>
383
;;     Line1 -> MIOS cursor offset: 0x40 -> cursor address 0x40<BR>
384
;;     Line2 -> MIOS cursor offset: 0x80 -> cursor address 0x10 (4x16 only)<BR>
385
;;     Line3 -> MIOS cursor offset: 0xc0 -> cursor address 0x50 (4x16 only)<BR>
386
;;  For 2 character displays connected to one core use:
387
;;     Line0 -> MIOS cursor offset: 0x00 -> cursor address 0x00<BR>
388
;;     Line1 -> MIOS cursor offset: 0x40 -> cursor address 0x40<BR>
389
;;     Line2 -> MIOS cursor offset: 0x80 -> cursor address 0x80<BR>
390
;;     Line3 -> MIOS cursor offset: 0xc0 -> cursor address 0xc0<BR>
391
;;  (first LCD is addressed by 0x00-0x7f, second LCD is addressed by 0x80-0xff)<BR>
392
;;  <BR>
393
;;  This function allows also to center the screen if you want to run<BR>
394
;;  Applications which have been developed for a 2x16 display on a<BR>
395
;;  larger display. Example for a 2x20 Display:<BR>
396
;;     Line0 -> MIOS cursor offset: 0x00 -> cursor address 0x04<BR>
397
;;     Line1 -> MIOS cursor offset: 0x40 -> cursor address 0x44<BR>
398
;;     Line2 -> don't care<BR>
399
;;     Line3 -> don't care<BR>
400
;;  IN:	  Line Y0 address in MIOS_PARAMETER1,
401
;;        Line Y1 address in MIOS_PARAMETER2,
402
;;        Line Y2 address in MIOS_PARAMETER3,
403
;;        Line Y3 address in WREG
404
;;  C_IN: Line Y0 address in <line0>
405
;;        Line Y1 address in <line1>
406
;;        Line Y2 address in <line2>
407
;;        Line Y3 address in <line3>
408
;;  OUT:  -
409
;;  USES: -
410
;;  EXAMPLE:
411
;;
412
;;	;; configure the offsets for a 4x16 LCD:
413
;;	movlw	0x00
414
;;	movwf	MIOS_PARAMETER1
415
;;	movlw	0x40
416
;;	movwf	MIOS_PARAMETER2
417
;;	movlw	0x10
418
;;	movwf	MIOS_PARAMETER3
419
;;	movlw	0x50
420
;;	call	MIOS_LCD_YAddressSet
421
;;
422
;;	;; configure MIOS for 2 character LCDs:
423
;;      ;; (see also http://www.ucapps.de/mbhp_lcd.html )
424
;;	movlw	0x00
425
;;	movwf	MIOS_PARAMETER1
426
;;	movlw	0x40
427
;;	movwf	MIOS_PARAMETER2
428
;;	movlw	0x80
429
;;	movwf	MIOS_PARAMETER3
430
;;	movlw	0xc0
431
;;	call	MIOS_LCD_YAddressSet
432
;;
433
;;  C_EXAMPLE:
434
;;
435
;;	// configure the offsets for a 4x16 LCD:
436
;;	MIOS_LCD_YAddressSet(0x00, 0x40, 0x10, 0x50);
437
;;
438
;;	// configure MIOS for 2 character LCDs:
439
;;      // (see also http://www.ucapps.de/mbhp_lcd.html )
440
;;	MIOS_LCD_YAddressSet(0x00, 0x40, 0x80, 0xc0);
441
;;
442
;; --------------------------------------------------------------------------
443
MIOS_LCD_YAddressSet
444
	movff	MIOS_PARAMETER1, MIOS_LCD_Y0_OFFSET
445
	movff	MIOS_PARAMETER2, MIOS_LCD_Y1_OFFSET
446
	movff	MIOS_PARAMETER3, MIOS_LCD_Y2_OFFSET
447
	movff	WREG, MIOS_LCD_Y3_OFFSET
448
	return
449
 
450
;; --------------------------------------------------------------------------
451
;;  FUNCTION: MIOS_LCD_YAddressGet
452
;;  C_DECLARATION: unsigned char MIOS_LCD_YAddressGet(void)
453
;;  DESCRIPTION: returns the Y offsets
454
;;  IN:	  -
455
;;  C_IN:  -
456
;;  OUT:  Line Y0 address in MIOS_PARAMETER1,
457
;;        Line Y1 address in MIOS_PARAMETER2,
458
;;        Line Y2 address in MIOS_PARAMETER3,
459
;;        Line Y3 address in WREG
460
;;  C_OUT: Line Y0 address in MIOS_PARAMETER1 (global variable defined in cmios.h),
461
;;        Line Y1 address in MIOS_PARAMETER2 (global variable defined in cmios.h),
462
;;        Line Y2 address in MIOS_PARAMETER3 (global variable defined in cmios.h),
463
;;        Line Y3 address directly returned
464
;;  USES: -
465
;; --------------------------------------------------------------------------
466
MIOS_LCD_YAddressGet
467
	movff	MIOS_LCD_Y0_OFFSET, MIOS_PARAMETER1
468
	movff	MIOS_LCD_Y1_OFFSET, MIOS_PARAMETER2
469
	movff	MIOS_LCD_Y2_OFFSET, MIOS_PARAMETER3
470
	movff	MIOS_LCD_Y3_OFFSET, WREG
471
	andlw	0xff		; (update STATUS)
472
	return
473
 
474
;; --------------------------------------------------------------------------
475
;;  branches to the appr. GLCD/DLCD functions
476
;; --------------------------------------------------------------------------
477
 
478
;; --------------------------------------------------------------------------
479
;;  FUNCTION: MIOS_LCD_Init
480
;;  C_DECLARATION: void MIOS_LCD_Init(void)
481
;;  DESCRIPTION: initializes the LCD display
482
;;  this function is called automatically after startup
483
;;  IN:	  -
484
;;  C_IN:  -
485
;;  OUT:  -
486
;;  C_OUT:  -
487
;;  USES: BRS, TBLPTR
488
;; --------------------------------------------------------------------------
489
MIOS_LCD_Init
490
	;; clear cursor pos
491
	SET_BSR	MIOS_LCD_CURSOR_POS
492
	clrf	MIOS_LCD_CURSOR_POS, BANKED
493
	clrf	MIOS_LCD_CURSOR_POS_REAL, BANKED
494
 
495
	BRA_IFSET MIOS_BOX_CFG0, MIOS_BOX_CFG0_LCD_TYPE2, ACCESS, MIOS_LCD_Init_4567
496
MIOS_LCD_Init_1234
497
	BRA_IFSET MIOS_BOX_CFG0, MIOS_BOX_CFG0_LCD_TYPE1, ACCESS, MIOS_LCD_Init_34
498
MIOS_LCD_Init_12
499
	BRA_IFCLR MIOS_BOX_CFG0, MIOS_BOX_CFG0_LCD_TYPE0, ACCESS, MIOS_CLCD_Init	; type 0
500
	rgoto	MIOS_GLCD0_Init	; type 1
501
 
502
MIOS_LCD_Init_34
503
	btfss	MIOS_BOX_CFG0, MIOS_BOX_CFG0_LCD_TYPE0
504
	return
505
	return
506
 
507
MIOS_LCD_Init_4567
508
	BRA_IFSET MIOS_BOX_CFG0, MIOS_BOX_CFG0_LCD_TYPE1, ACCESS, MIOS_LCD_Init_67
509
MIOS_LCD_Init_45
510
	btfss	MIOS_BOX_CFG0, MIOS_BOX_CFG0_LCD_TYPE0
511
	return
512
	return
513
 
514
MIOS_LCD_Init_67
515
	GOTO_IFCLR MIOS_BOX_CFG0, MIOS_BOX_CFG0_LCD_TYPE0, ACCESS, MIOS_MLCD_Init
516
	;; set GLCD flag by default
517
	bsf	MIOS_BOX_CFG0, MIOS_BOX_CFG0_USE_GLCD
518
	;; call user LCD init routine
519
	goto	USER_LCD_Init	; type 7
520
 
521
 
522
 
523
;; --------------------------------------------------------------------------
524
;;  FUNCTION: MIOS_LCD_PrintChar
525
;;  C_DECLARATION: void MIOS_LCD_PrintChar(unsigned char c)
526
;;  DESCRIPTION: prints a single ASCII character
527
;;  IN:	  character which should be print in WREG
528
;;  C_IN:  character which should be print in <c>
529
;;  OUT:  the character on LCD screen
530
;;  C_OUT: the character on LCD screen
531
;;  EXAMPLE:
532
;;	;; print four characters on screen
533
;;	movlw   'M'
534
;;	call    MIOS_LCD_PrintChar
535
;;	movlw   'I'
536
;;	call    MIOS_LCD_PrintChar
537
;;	movlw   'O'
538
;;	call    MIOS_LCD_PrintChar
539
;;	movlw   'S'
540
;;	call    MIOS_LCD_PrintChar
541
;;  C_EXAMPLE:
542
;;	;; print four characters on screen
543
;;	MIOS_LCD_PrintChar('M');
544
;;	MIOS_LCD_PrintChar('I');
545
;;	MIOS_LCD_PrintChar('O');
546
;;	MIOS_LCD_PrintChar('S');
547
;;  USES: BRS, TBLPTR
548
;; --------------------------------------------------------------------------
549
MIOS_LCD_PrintChar		; (used by mios_vectors.inc - no MLCD optimization)
550
	rcall	MIOS_LCD_PrintChar_Internal
551
	rgoto	MIOS_LCD_TransferFinished
552
 
553
MIOS_LCD_PrintChar_Internal	; (used by MIOS routines -- have to finish the character transfer with MIOS_LCD_TransferFinsihed!)
554
	SET_BSR	MIOS_LCD_TIMEOUT1
555
	btfsc	MIOS_LCD_TIMEOUT1, 7, BANKED; leave routine if LCD was disabled after LCD timeout
556
	return
557
 
558
	SET_BSR	MIOS_LCD_TIMEOUT1
559
	BRA_IFSET MIOS_BOX_CFG0, MIOS_BOX_CFG0_LCD_TYPE2, ACCESS, MIOS_LCD_PrintChar_4567
560
MIOS_LCD_PrintChar_1234
561
	BRA_IFSET MIOS_BOX_CFG0, MIOS_BOX_CFG0_LCD_TYPE1, ACCESS, MIOS_LCD_PrintChar_34
562
MIOS_LCD_PrintChar_12
563
	BRA_IFCLR MIOS_BOX_CFG0, MIOS_BOX_CFG0_LCD_TYPE0, ACCESS, MIOS_CLCD_PrintChar
564
	rgoto	MIOS_GLCD0_PrintChar
565
 
566
MIOS_LCD_PrintChar_34
567
	btfss	MIOS_BOX_CFG0, MIOS_BOX_CFG0_LCD_TYPE0
568
	return
569
	return
570
 
571
MIOS_LCD_PrintChar_4567
572
	BRA_IFSET MIOS_BOX_CFG0, MIOS_BOX_CFG0_LCD_TYPE1, ACCESS, MIOS_LCD_PrintChar_67
573
MIOS_LCD_PrintChar_45
574
	btfss	MIOS_BOX_CFG0, MIOS_BOX_CFG0_LCD_TYPE0
575
	return
576
	return
577
 
578
MIOS_LCD_PrintChar_67
579
	GOTO_IFCLR MIOS_BOX_CFG0, MIOS_BOX_CFG0_LCD_TYPE0, ACCESS, MIOS_MLCD_PrintChar; type 6
580
	goto	USER_LCD_PrintChar	; type 7
581
 
582
 
583
;; --------------------------------------------------------------------------
584
;;  FUNCTION: MIOS_LCD_Data
585
;;  C_DECLARATION: void MIOS_LCD_Data(unsigned char data)
586
;;  DESCRIPTION: sends a data value to the LCD display
587
;;  IN:	  data which should be sent in WREG
588
;;  C_IN:  data which should be sent in <data>
589
;;  OUT:  -
590
;;  C_OUT:  -
591
;;  USES: BRS, TBLPTR
592
;; --------------------------------------------------------------------------
593
MIOS_LCD_Data
594
	SET_BSR	MIOS_LCD_TIMEOUT1
595
	btfsc	MIOS_LCD_TIMEOUT1, 7, BANKED; leave routine if LCD was disabled after LCD timeout
596
	return
597
 
598
	BRA_IFSET MIOS_BOX_CFG0, MIOS_BOX_CFG0_LCD_TYPE2, ACCESS, MIOS_LCD_Data_4567
599
MIOS_LCD_Data_1234
600
	BRA_IFSET MIOS_BOX_CFG0, MIOS_BOX_CFG0_LCD_TYPE1, ACCESS, MIOS_LCD_Data_34
601
MIOS_LCD_Data_12
602
	BRA_IFCLR MIOS_BOX_CFG0, MIOS_BOX_CFG0_LCD_TYPE0, ACCESS, MIOS_CLCD_Data	; type 0
603
	rgoto	MIOS_GLCD0_Data	; type 1
604
 
605
MIOS_LCD_Data_34
606
	btfss	MIOS_BOX_CFG0, MIOS_BOX_CFG0_LCD_TYPE0
607
	return
608
	return
609
 
610
MIOS_LCD_Data_4567
611
	BRA_IFSET MIOS_BOX_CFG0, MIOS_BOX_CFG0_LCD_TYPE1, ACCESS, MIOS_LCD_Data_67
612
MIOS_LCD_Data_45
613
	btfss	MIOS_BOX_CFG0, MIOS_BOX_CFG0_LCD_TYPE0
614
	return
615
	return
616
 
617
MIOS_LCD_Data_67
618
	GOTO_IFSET MIOS_BOX_CFG0, MIOS_BOX_CFG0_LCD_TYPE0, ACCESS, USER_LCD_Data ; type 7
619
	call	MIOS_MLCD_PrintChar; type 6
620
	goto	MIOS_MLCD_SendSyxFooter
621
 
622
;; --------------------------------------------------------------------------
623
;;  FUNCTION: MIOS_LCD_Cmd
624
;;  C_DECLARATION: void MIOS_LCD_Cmd(unsigned char cmd)
625
;;  DESCRIPTION: sends a command to the LCD display
626
;;  IN:	  command which should be sent in WREG
627
;;  C_IN:  command which should be sent in <cmd>
628
;;  OUT:  -
629
;;  C_OUT:  -
630
;;  USES: BRS, TBLPTR
631
;; --------------------------------------------------------------------------
632
MIOS_LCD_Cmd
633
	SET_BSR	MIOS_LCD_TIMEOUT1
634
	btfsc	MIOS_LCD_TIMEOUT1, 7, BANKED; leave routine if LCD was disabled after LCD timeout
635
	return
636
 
637
	BRA_IFSET MIOS_BOX_CFG0, MIOS_BOX_CFG0_LCD_TYPE2, ACCESS, MIOS_LCD_Cmd_4567
638
MIOS_LCD_Cmd_1234
639
	BRA_IFSET MIOS_BOX_CFG0, MIOS_BOX_CFG0_LCD_TYPE1, ACCESS, MIOS_LCD_Cmd_34
640
MIOS_LCD_Cmd_12
641
	BRA_IFCLR MIOS_BOX_CFG0, MIOS_BOX_CFG0_LCD_TYPE0, ACCESS, MIOS_CLCD_Cmd	; type 0
642
	rgoto	MIOS_GLCD0_Cmd	; type 1
643
 
644
MIOS_LCD_Cmd_34
645
	btfss	MIOS_BOX_CFG0, MIOS_BOX_CFG0_LCD_TYPE0
646
	return
647
	return
648
 
649
MIOS_LCD_Cmd_4567
650
	BRA_IFSET MIOS_BOX_CFG0, MIOS_BOX_CFG0_LCD_TYPE1, ACCESS, MIOS_LCD_Cmd_67
651
MIOS_LCD_Cmd_45
652
	btfss	MIOS_BOX_CFG0, MIOS_BOX_CFG0_LCD_TYPE0
653
	return
654
	return
655
 
656
MIOS_LCD_Cmd_67
657
	btfss	MIOS_BOX_CFG0, MIOS_BOX_CFG0_LCD_TYPE0
658
	return
659
	goto	USER_LCD_Cmd	; type 7
660
 
661
;; --------------------------------------------------------------------------
662
;;  FUNCTION: MIOS_LCD_Clear
663
;;  C_DECLARATION: void MIOS_LCD_Clear(void)
664
;;  DESCRIPTION: clears the LCD screen
665
;;  IN:	  -
666
;;  C_IN:  -
667
;;  OUT:  -
668
;;  C_OUT:  -
669
;;  EXAMPLE:
670
;;	;; clear LCD and print a character
671
;;	call    MIOS_LCD_Clear
672
;;	movlw   'A'
673
;;	call    MIOS_LCD_PrintChar
674
;;  C_EXAMPLE:
675
;;	// clear LCD and print a character
676
;;	MIOS_LCD_Clear();
677
;;	MIOS_LCD_PrintChar('A');
678
;;  USES: BRS, TBLPTR
679
;; --------------------------------------------------------------------------
680
MIOS_LCD_Clear
681
	SET_BSR	MIOS_LCD_TIMEOUT1
682
	btfsc	MIOS_LCD_TIMEOUT1, 7, BANKED; leave routine if LCD was disabled after LCD timeout
683
	return
684
 
685
	clrf	MIOS_LCD_CURSOR_POS, BANKED
686
	clrf	MIOS_LCD_CURSOR_POS_REAL, BANKED
687
 
688
	BRA_IFSET MIOS_BOX_CFG0, MIOS_BOX_CFG0_LCD_TYPE2, ACCESS, MIOS_LCD_Clear_4567
689
MIOS_LCD_Clear_1234
690
	BRA_IFSET MIOS_BOX_CFG0, MIOS_BOX_CFG0_LCD_TYPE1, ACCESS, MIOS_LCD_Clear_34
691
MIOS_LCD_Clear_12
692
	BRA_IFCLR MIOS_BOX_CFG0, MIOS_BOX_CFG0_LCD_TYPE0, ACCESS, MIOS_CLCD_Clear
693
	rgoto	MIOS_GLCD0_Clear
694
 
695
MIOS_LCD_Clear_34
696
	btfss	MIOS_BOX_CFG0, MIOS_BOX_CFG0_LCD_TYPE0
697
	return
698
	return
699
 
700
MIOS_LCD_Clear_4567
701
	BRA_IFSET MIOS_BOX_CFG0, MIOS_BOX_CFG0_LCD_TYPE1, ACCESS, MIOS_LCD_Clear_67
702
MIOS_LCD_Clear_45
703
	btfss	MIOS_BOX_CFG0, MIOS_BOX_CFG0_LCD_TYPE0
704
	return
705
	return
706
 
707
MIOS_LCD_Clear_67
708
	GOTO_IFCLR MIOS_BOX_CFG0, MIOS_BOX_CFG0_LCD_TYPE0, ACCESS, MIOS_MLCD_Clear
709
	goto	USER_LCD_Clear	; type 7
710
 
711
;; --------------------------------------------------------------------------
712
;;  FUNCTION: MIOS_LCD_CursorSet
713
;;  C_DECLARATION: void MIOS_LCD_CursorSet(unsigned char pos)
714
;;  DESCRIPTION: sets the text cursor on LCD screen<BR>
715
;;     0x00-0x3f: first line<BR>
716
;;     0x40-0x7f: second line<BR>
717
;;     0x80-0xbf: third line or second LCD (see MIOS_LCD_YAddressSet)<BR>
718
;;     0xc0-0xff: fourth line or second LCD (see MIOS_LCD_YAddressSet)
719
;;  IN:	  -
720
;;  C_IN:  -
721
;;  OUT:  -
722
;;  C_OUT:  -
723
;;  EXAMPLE:
724
;;	;; print char at first line, first column
725
;;	movlw   0x00 + 0
726
;;	call    MIOS_LCD_CursorSet
727
;;	movlw   'A'
728
;;	call    MIOS_LCD_PrintChar
729
;;
730
;;	;; print char at second line, last column (2x16 LCD)
731
;;	movlw   0x40 + 15
732
;;	call    MIOS_LCD_CursorSet
733
;;	movlw   'B'
734
;;	call    MIOS_LCD_PrintChar
735
;;
736
;;	;; print chars on second LCD
737
;;	;; (or 3rd and 4th line, see see MIOS_LCD_YAddressSet)
738
;;	movlw   0x80 + 0
739
;;	call    MIOS_LCD_CursorSet
740
;;	movlw   'C'
741
;;	call    MIOS_LCD_PrintChar
742
;;
743
;;	movlw   0xc0 + 15
744
;;	call    MIOS_LCD_CursorSet
745
;;	movlw   'D'
746
;;	call    MIOS_LCD_PrintChar
747
;;
748
;;  C_EXAMPLE:
749
;;	// print char at first line, first column
750
;;	MIOS_LCD_CursorSet(0x00 + 0);
751
;;	MIOS_LCD_PrintChar('A');
752
;;
753
;;	// print char at second line, last column (2x16 LCD)
754
;;	MIOS_LCD_CursorSet(0x40 + 15);
755
;;	MIOS_LCD_PrintChar('B');
756
;;
757
;;	// print chars on second LCD
758
;;	// (or 3rd and 4th line, see see MIOS_LCD_YAddressSet)
759
;;	MIOS_LCD_CursorSet(0x80 + 0);
760
;;	MIOS_LCD_PrintChar('C');
761
;;	MIOS_LCD_CursorSet(0xc0 + 15);
762
;;	MIOS_LCD_PrintChar('D');
763
;;
764
;;  USES: BRS, TBLPTR
765
;; --------------------------------------------------------------------------
766
MIOS_LCD_CursorSet
767
	SET_BSR	MIOS_LCD_TIMEOUT1
768
	btfsc	MIOS_LCD_TIMEOUT1, 7, BANKED; leave routine if LCD was disabled after LCD timeout
769
	return
770
 
771
	movwf	MIOS_LCD_CURSOR_POS, BANKED
772
	movwf	MIOS_LCD_CURSOR_POS_REAL, BANKED
773
	andlw	0x3f
774
 
775
	BRA_IFSET MIOS_LCD_CURSOR_POS, 7, BANKED, MIOS_LCD_CursorSet_Y23
776
MIOS_LCD_CursorSet_Y01
777
	BRA_IFSET MIOS_LCD_CURSOR_POS, 6, BANKED, MIOS_LCD_CursorSet_Y1
778
MIOS_LCD_CursorSet_Y0
779
	addwf	MIOS_LCD_Y0_OFFSET, W, BANKED
780
	rgoto	MIOS_LCD_CursorSet_Cont
781
MIOS_LCD_CursorSet_Y1
782
	addwf	MIOS_LCD_Y1_OFFSET, W, BANKED
783
	rgoto	MIOS_LCD_CursorSet_Cont
784
 
785
MIOS_LCD_CursorSet_Y23
786
	BRA_IFSET MIOS_LCD_CURSOR_POS, 6, BANKED, MIOS_LCD_CursorSet_Y3
787
MIOS_LCD_CursorSet_Y2
788
	addwf	MIOS_LCD_Y2_OFFSET, W, BANKED
789
	rgoto	MIOS_LCD_CursorSet_Cont
790
MIOS_LCD_CursorSet_Y3
791
	addwf	MIOS_LCD_Y3_OFFSET, W, BANKED
792
	;; 	rgoto	MIOS_LCD_CursorSet_Cont
793
 
794
MIOS_LCD_CursorSet_Cont
795
	movwf	MIOS_LCD_CURSOR_POS, BANKED
796
 
797
	BRA_IFSET MIOS_BOX_CFG0, MIOS_BOX_CFG0_LCD_TYPE2, ACCESS, MIOS_LCD_CursorSet_4567
798
MIOS_LCD_CursorSet_1234
799
	BRA_IFSET MIOS_BOX_CFG0, MIOS_BOX_CFG0_LCD_TYPE1, ACCESS, MIOS_LCD_CursorSet_34
800
MIOS_LCD_CursorSet_12
801
	BRA_IFCLR MIOS_BOX_CFG0, MIOS_BOX_CFG0_LCD_TYPE0, ACCESS, MIOS_CLCD_CursorSet
802
MIOS_LCD_CursorSet_34
803
MIOS_LCD_CursorSet_4567
804
	rgoto	MIOS_GLCD_CursorSet
805
 
806
;; --------------------------------------------------------------------------
807
;;  FUNCTION: MIOS_LCD_CursorGet
808
;;  C_DECLARATION: unsigned char MIOS_LCD_CursorGet(void)
809
;;  DESCRIPTION: returns the text cursor position<BR>
810
;;     0x00-0x3f: first line<BR>
811
;;     0x40-0x7f: second line<BR>
812
;;     0x80-0xbf: third line or second LCD (if available)<BR>
813
;;     0xc0-0xff: fourth line or second LCD (if available)
814
;;  IN:	  -
815
;;  C_IN:	  -
816
;;  OUT:  text cursor position in WREG and MIOS_PARAMETER1
817
;;  C_OUT:  text cursor position
818
;;  USES: BRS, TBLPTR
819
;; --------------------------------------------------------------------------
820
MIOS_LCD_CursorGet
821
	movff	MIOS_LCD_CURSOR_POS_REAL, WREG
822
	andlw	0xff		; (update STATUS)
823
	return
824
 
825
;; ==========================================================================
826
 
827
;; --------------------------------------------------------------------------
828
;;  FUNCTION: MIOS_GLCD_FontInit
829
;;  C_DECLARATION: void MIOS_GLCD_FontInit(code char *font)
830
;;  DESCRIPTION: initializes a font, (animated icon) or bitmap
831
;;  Note that this function works with graphical LCDs only!
832
;;  IN:	  pointer to font header in TBLPTR
833
;;  C_IN:  pointer to font header in <font>
834
;;  OUT:  -
835
;;  USES: BRS, TBLPTR
836
;;  EXAMPLE:
837
;;	;; set default font:
838
;;	TABLE_ADDR MIOS_GLCD_FONT
839
;;	call	MIOS_GLCD_FontInit
840
;;	;; set cursor to 0
841
;;	movlw	0x00
842
;;	call	MIOS_LCD_CursorSet
843
;;	;; print character 'A'
844
;;	movlw	'A'
845
;;	call	MIOS_LCD_PrintChar
846
;;  C_EXAMPLE:
847
;;	// set default font:
848
;;	MIOS_GLCD_FontInit(MIOS_GLCD_FONT)
849
;;	// set cursor to 0
850
;;	MIOS_LCD_CursorSet(0x00);
851
;;	// print character 'A'
852
;;	MIOS_LCD_PrintChar('A');
853
;; --------------------------------------------------------------------------
854
MIOS_GLCD_FontInit
855
	tblrd*+
856
	movff	TABLAT, MIOS_GLCD_FONT_WIDTH
857
	tblrd*+
858
	movff	TABLAT, MIOS_GLCD_FONT_HEIGHT
859
	tblrd*+
860
	movff	TABLAT, MIOS_GLCD_FONT_X0
861
	tblrd*+
862
	movff	TABLAT, MIOS_GLCD_FONT_OFFSET
863
 
864
	movff	TBLPTRL, MIOS_GLCD_FONT_PTRL
865
	movff	TBLPTRH, MIOS_GLCD_FONT_PTRH
866
#if PIC_DERIVATIVE_CODE_SIZE > 0x10000
867
	movff	TBLPTRU, MIOS_GLCD_FONT_PTRU
868
#endif
869
	return
870
 
871
;; --------------------------------------------------------------------------
872
;;  set graphical cursor and send it to display
873
;;  (compatible with MIOS_CLCD_CursorSet)
874
;; --------------------------------------------------------------------------
875
MIOS_GLCD_CursorSet
876
	SET_BSR	MIOS_GLCD_GCURSOR_X
877
	movwf	MIOS_GLCD_GCURSOR_X, BANKED
878
 
879
	swapf	MIOS_GLCD_GCURSOR_X, W, BANKED
880
	rrf	WREG, F
881
	rrf	WREG, W
882
	andlw	0x03
883
	movwf	MIOS_GLCD_GCURSOR_Y, BANKED
884
	movwf	MIOS_PARAMETER1
885
 
886
	movf	MIOS_GLCD_GCURSOR_X, W, BANKED
887
	andlw	0x3f
888
	mulwf	MIOS_GLCD_FONT_WIDTH, BANKED
889
	movf	PRODL, W
890
	movwf	MIOS_GLCD_GCURSOR_X, BANKED
891
 
892
	;; 	rgoto	MIOS_GLCD_GCursorSet
893
 
894
;; --------------------------------------------------------------------------
895
;;  FUNCTION: MIOS_GLCD_GCursorSet
896
;;  C_DECLARATION: void MIOS_GLCD_GCursorSet(unsigned char x, unsigned char y)
897
;;  DESCRIPTION: sets the graphical cursor on a LCD screen<BR>
898
;;  Note that this function works with graphical LCDs only!
899
;;  IN:	  X position in WREG (0-239)
900
;;        Y position in MIOS_PARAMETER1 (0-7)
901
;;  C_IN: X position in <x> (0-239)
902
;;        Y position in <y> (0-7)
903
;;  OUT:  -
904
;;  USES: BRS, TBLPTR
905
;;  EXAMPLE:
906
;;	;; set graphical cursor to 160/7:
907
;;	movlw	7
908
;;	movwf	MIOS_PARAMETER1
909
;;	movlw	160
910
;;	call	MIOS_GLCD_GCursorSet
911
;;  C_EXAMPLE:
912
;;	// set graphical cursor to 160/7:
913
;;	MIOS_GLCD_GCursorSet(160, 7);
914
;; --------------------------------------------------------------------------
915
MIOS_GLCD_GCursorSet
916
	SET_BSR	MIOS_GLCD_GCURSOR_X
917
	movwf	MIOS_GLCD_GCURSOR_X, BANKED
918
	movff	MIOS_PARAMETER1, MIOS_GLCD_GCURSOR_Y
919
 
920
	BRA_IFSET MIOS_BOX_CFG0, MIOS_BOX_CFG0_LCD_TYPE2, ACCESS, MIOS_LCD_GCursorSet4567
921
MIOS_LCD_GCursorSet1234
922
	BRA_IFSET MIOS_BOX_CFG0, MIOS_BOX_CFG0_LCD_TYPE1, ACCESS, MIOS_LCD_GCursorSet34
923
MIOS_LCD_GCursorSet12
924
	btfss	MIOS_BOX_CFG0, MIOS_BOX_CFG0_LCD_TYPE0
925
	return
926
	rgoto	MIOS_GLCD0_GCursorSet	; type 1
927
 
928
MIOS_LCD_GCursorSet34
929
	btfss	MIOS_BOX_CFG0, MIOS_BOX_CFG0_LCD_TYPE0
930
	return
931
	return
932
 
933
MIOS_LCD_GCursorSet4567
934
	BRA_IFSET MIOS_BOX_CFG0, MIOS_BOX_CFG0_LCD_TYPE1, ACCESS, MIOS_LCD_GCursorSet67
935
MIOS_LCD_GCursorSet45
936
	btfss	MIOS_BOX_CFG0, MIOS_BOX_CFG0_LCD_TYPE0
937
	return
938
	return
939
 
940
MIOS_LCD_GCursorSet67
941
	GOTO_IFCLR MIOS_BOX_CFG0, MIOS_BOX_CFG0_LCD_TYPE0, ACCESS, MIOS_MLCD_CursorSet
942
	goto	USER_LCD_CursorSet	; type 7
943
 
944
;; --------------------------------------------------------------------------
945
;;  FUNCTION: MIOS_GLCD_GCursorGet
946
;;  C_DECLARATION: unsigned char MIOS_GLCD_GCursorGet(void)
947
;;  DESCRIPTION: returns the position of the graphical cursor<BR>
948
;;  Note that this function works with graphical LCDs only!
949
;;  IN:  -
950
;;  C_IN:  -
951
;;  OUT: X position in WREG (0-239)
952
;;       Y position in MIOS_PARAMETER1 (0-7)
953
;;  C_OUT: X position returned directly
954
;;       Y position in MIOS_PARAMETER1 (global variable defined in cmios.h)
955
;;  USES: BRS, TBLPTR
956
;; --------------------------------------------------------------------------
957
MIOS_GLCD_GCursorGet
958
	SET_BSR	MIOS_GLCD_GCURSOR_X
959
	movff	MIOS_GLCD_GCURSOR_Y, MIOS_PARAMETER1
960
	movf	MIOS_GLCD_GCURSOR_X, W, BANKED
961
	andlw	0xff		; (update STATUS)
962
	return
963
 
964
 
965
;; ==========================================================================
966
 
967
;; --------------------------------------------------------------------------
968
;;  FUNCTION: MIOS_LCD_PrintHex2
969
;;  C_DECLARATION: void MIOS_LCD_PrintHex2(unsigned char h)
970
;;  DESCRIPTION: prints a 8-bit hex value
971
;;  IN:   Value in WREG
972
;;  C_IN: Value in <h>
973
;;  OUT:  two digits on LCD
974
;;  USES: BSR
975
;;  EXAMPLE:
976
;;	;; print content of TMP1 on screen
977
;;	movf    TMP1, W
978
;;	call	MIOS_LCD_PrintHex2
979
;;  C_EXAMPLE:
980
;;	unsigned char value;
981
;;
982
;;	// print content of 'value' on screen
983
;;	MIOS_LCD_PrintHex2(value);
984
;; --------------------------------------------------------------------------
985
MIOS_LCD_PrintHex2
986
	SET_BSR	MIOS_TMP1
987
	movwf	MIOS_TMP1, BANKED
988
	swapf	MIOS_TMP1, W, BANKED
989
	rcall	MIOS_LCD_PrintHex1_Internal
990
	movf	MIOS_TMP1, W, BANKED
991
	rcall	MIOS_LCD_PrintHex1_Internal
992
	rgoto	MIOS_LCD_TransferFinished
993
 
994
 
995
;; --------------------------------------------------------------------------
996
;;  FUNCTION: MIOS_LCD_PrintHex1
997
;;  C_DECLARATION: void MIOS_LCD_PrintHex1(unsigned char h)
998
;;  DESCRIPTION: prints a 4-bit hex value
999
;;  IN:   Value in WREG
1000
;;  C_IN:   Value in <h>
1001
;;  OUT:  one digit on LCD
1002
;;  C_OUT:  one digit on LCD
1003
;;  USES: BSR
1004
;;  EXAMPLE:
1005
;;	;; print leftmost nibble of TMP1 on screen
1006
;;	movf    TMP1, W
1007
;;	call	MIOS_LCD_PrintHex1
1008
;;  C_EXAMPLE:
1009
;;	unsigned char value;
1010
;;
1011
;;	// print leftmost nibble of 'value' on screen
1012
;;	MIOS_LCD_PrintHex1(value);
1013
;; --------------------------------------------------------------------------
1014
MIOS_LCD_PrintHex1
1015
;; --------------------------------------------------------------------------
1016
;;  FUNCTION: MIOS_LCD_PrintBCD1
1017
;;  C_DECLARATION: void MIOS_LCD_PrintBCD1(unsigned char v)
1018
;;  DESCRIPTION: prints a 8-bit as BCD (decimal value) -- one digit only
1019
;;  IN:   Value in WREG
1020
;;  OUT:  one digit on LCD
1021
;;  USES: BSR
1022
;;  EXAMPLE:
1023
;;	;; print leftmost digit of TMP1 on screen
1024
;;	movf    TMP1, W
1025
;;	call	MIOS_LCD_PrintBCD1
1026
;;  C_EXAMPLE:
1027
;;	unsigned char value;
1028
;;
1029
;;	// print leftmost digit of 'value' on screen
1030
;;	MIOS_LCD_PrintBCD1(value);
1031
;; --------------------------------------------------------------------------
1032
MIOS_LCD_PrintBCD1		; (used by mios_vectors.inc - no MLCD optimization)
1033
	rcall	MIOS_LCD_PrintBCD1_Internal
1034
	rgoto	MIOS_LCD_TransferFinished
1035
 
1036
MIOS_LCD_PrintHex1_Internal	; (used by MIOS routines -- have to finish the character transfer with MIOS_LCD_TransferFinsihed!)
1037
MIOS_LCD_PrintBCD1_Internal
1038
	andlw	0x0f
1039
	addlw	-0x0a
1040
	skpnc
1041
	addlw	0x07
1042
	addlw	0x3a
1043
	rgoto	MIOS_LCD_PrintChar_Internal
1044
 
1045
;; --------------------------------------------------------------------------
1046
;;  FUNCTION: MIOS_LCD_PrintBCD2
1047
;;  C_DECLARATION: void MIOS_LCD_PrintBCD2(unsigned char v)
1048
;;  DESCRIPTION: prints a 8-bit as BCD (decimal value) -- two digits only
1049
;;  IN:   Value in WREG
1050
;;  C_IN: Value in <v>
1051
;;  OUT:  two digits on LCD
1052
;;  C_OUT: two digits on LCD
1053
;;  USES: BSR, MIOS_PARAMETER[123]
1054
;;  EXAMPLE:
1055
;;	;; print two leftmost digits of TMP1 on screen
1056
;;	movf    TMP1, W
1057
;;	call	MIOS_LCD_PrintBCD2
1058
;;  C_EXAMPLE:
1059
;;	unsigned char value;
1060
;;
1061
;;	// print two leftmost digits of 'value' on screen
1062
;;	MIOS_LCD_PrintBCD2(value);
1063
;; --------------------------------------------------------------------------
1064
MIOS_LCD_PrintBCD2
1065
	clrf	MIOS_PARAMETER1
1066
	call	MIOS_HLP_Dec2BCD
1067
	rgoto	MIOS_LCD_PrintBCD2_Cont
1068
 
1069
;; --------------------------------------------------------------------------
1070
;;  FUNCTION: MIOS_LCD_PrintBCD3
1071
;;  C_DECLARATION: void MIOS_LCD_PrintBCD3(unsigned char v)
1072
;;  DESCRIPTION: prints a 8-bit as BCD (decimal value) -- all three digits
1073
;;  IN:   Value in WREG
1074
;;  C_IN: Value in <v>
1075
;;  OUT:  three digits on LCD
1076
;;  C_OUT:  three digits on LCD
1077
;;  USES: BSR, MIOS_PARAMETER[123]
1078
;;  EXAMPLE:
1079
;;	;; print all three digits of TMP1 on screen
1080
;;	movf    TMP1, W
1081
;;	call	MIOS_LCD_PrintBCD3
1082
;;  C_EXAMPLE:
1083
;;	unsigned char value;
1084
;;
1085
;;	// print all three digits of 'value' on screen
1086
;;	MIOS_LCD_PrintBCD3(value);
1087
;; --------------------------------------------------------------------------
1088
MIOS_LCD_PrintBCD3
1089
	clrf	MIOS_PARAMETER1
1090
	call	MIOS_HLP_Dec2BCD
1091
	rgoto	MIOS_LCD_PrintBCD3_Cont
1092
 
1093
;; --------------------------------------------------------------------------
1094
;;  FUNCTION: MIOS_LCD_PrintBCD4
1095
;;  C_DECLARATION: void MIOS_LCD_PrintBCD4(unsigned int v)
1096
;;  DESCRIPTION: prints a 16-bit as BCD (decimal value) -- four digits
1097
;;  IN:   Low-byte in WREG, High-byte in MIOS_PARAMETER1
1098
;;  C_IN: 16bit value in <v>
1099
;;  OUT:  four digits on LCD
1100
;;  USES: BSR, MIOS_PARAMETER[123]
1101
;;  EXAMPLE:
1102
;;	;; print four leftmost digits of TMP[12] on screen
1103
;;	movff   TMP2, MIOS_PARAMETER1
1104
;;	movf    TMP1, W
1105
;;	call	MIOS_LCD_PrintBCD4
1106
;;  C_EXAMPLE:
1107
;;	unsigned int value;
1108
;;
1109
;;	// print four leftmost digits of 'value' on screen
1110
;;	MIOS_LCD_PrintBCD4(value);
1111
;; --------------------------------------------------------------------------
1112
MIOS_LCD_PrintBCD4
1113
	call	MIOS_HLP_Dec2BCD
1114
	rgoto	MIOS_LCD_PrintBCD4_Cont
1115
 
1116
;; --------------------------------------------------------------------------
1117
;;  FUNCTION: MIOS_LCD_PrintBCD5
1118
;;  C_DECLARATION: void MIOS_LCD_PrintBCD5(unsigned int v)
1119
;;  DESCRIPTION: prints a 16-bit as BCD (decimal value) -- five digits
1120
;;  IN:   Low-byte in WREG, High-byte in MIOS_PARAMETER1
1121
;;  C_IN: 16bit value in <v>
1122
;;  OUT:  five digits on LCD
1123
;;  USES: BSR
1124
;;  EXAMPLE:
1125
;;	;; print all five digits of TMP[12] on screen
1126
;;	movff   TMP2, MIOS_PARAMETER1
1127
;;	movf    TMP1, W
1128
;;	call	MIOS_LCD_PrintBCD5
1129
;;  C_EXAMPLE:
1130
;;	unsigned int value;
1131
;;
1132
;;	// print all five digits of 'value' on screen
1133
;;	MIOS_LCD_PrintBCD5(value);
1134
;; --------------------------------------------------------------------------
1135
MIOS_LCD_PrintBCD5
1136
	call	MIOS_HLP_Dec2BCD
1137
	;; 	rgoto	MIOS_LCD_PrintBCD5_Cont
1138
 
1139
;; -----------------
1140
MIOS_LCD_PrintBCD5_Cont
1141
	movf	MIOS_PARAMETER3, W
1142
	andlw	0x0f
1143
	bnz	MIOS_LCD_PrintBCD_D5
1144
 
1145
	movlw	' '
1146
	rcall	MIOS_LCD_PrintChar_Internal
1147
 
1148
MIOS_LCD_PrintBCD4_Cont
1149
	swapf	MIOS_PARAMETER2, W
1150
	andlw	0x0f
1151
	bnz	MIOS_LCD_PrintBCD_D4
1152
 
1153
	movlw	' '
1154
	rcall	MIOS_LCD_PrintChar_Internal
1155
 
1156
MIOS_LCD_PrintBCD3_Cont
1157
	movf	MIOS_PARAMETER2, W
1158
	andlw	0x0f
1159
	bnz	MIOS_LCD_PrintBCD_D3
1160
 
1161
	movlw	' '
1162
	rcall	MIOS_LCD_PrintChar_Internal
1163
 
1164
MIOS_LCD_PrintBCD2_Cont
1165
	swapf	MIOS_PARAMETER1, W
1166
	andlw	0x0f
1167
	bnz	MIOS_LCD_PrintBCD_D2
1168
 
1169
	movlw	' '
1170
	rcall	MIOS_LCD_PrintChar_Internal
1171
 
1172
MIOS_LCD_PrintBCD1_Cont
1173
	rgoto	MIOS_LCD_PrintBCD_D1
1174
 
1175
 
1176
	;; ---
1177
MIOS_LCD_PrintBCD_D5
1178
	rcall	MIOS_LCD_PrintBCD1_Internal
1179
MIOS_LCD_PrintBCD_D4
1180
	swapf	MIOS_PARAMETER2, W
1181
	rcall	MIOS_LCD_PrintBCD1_Internal
1182
MIOS_LCD_PrintBCD_D3
1183
	movf	MIOS_PARAMETER2, W
1184
	rcall	MIOS_LCD_PrintBCD1_Internal
1185
MIOS_LCD_PrintBCD_D2
1186
	swapf	MIOS_PARAMETER1, W
1187
	rcall	MIOS_LCD_PrintBCD1_Internal
1188
MIOS_LCD_PrintBCD_D1
1189
	movf	MIOS_PARAMETER1, W
1190
	rcall	MIOS_LCD_PrintBCD1_Internal
1191
	rgoto	MIOS_LCD_TransferFinished
1192
 
1193
 
1194
;; --------------------------------------------------------------------------
1195
;;  FUNCTION: MIOS_LCD_PrintCString
1196
;;  C_DECLARATION: void MIOS_LCD_PrintCString(code char *str)
1197
;;  DESCRIPTION: prints a 0-terminated string --- only provided by the MIOS C Wrapper!
1198
;;  IN:   not available in assembler
1199
;;  C_IN: Pointer to 0-terminated String in <str>
1200
;;  OUT:  some characters on LCD
1201
;;  USES: BSR
1202
;;  C_EXAMPLE:
1203
;;	// print string on LCD - first line, first column
1204
;;	MIOS_LCD_CursorSet(0x00 + 0);
1205
;;	MIOS_LCD_PrintCString("Hello World!");
1206
;; --------------------------------------------------------------------------
1207
 
1208
;; --------------------------------------------------------------------------
1209
;;  FUNCTION: MIOS_LCD_PrintString
1210
;;  C_DECLARATION: void MIOS_LCD_PrintString(code char *str)
1211
;;  DESCRIPTION: prints a string
1212
;;  IN:   Pointer to String in TBLPTR[LH]
1213
;;        First word of string must contain length and LCD position
1214
;;  C_IN: Pointer to String in <str>
1215
;;        First word of string must contain length and LCD position
1216
;;  OUT:  some characters on LCD
1217
;;  USES: BSR
1218
;;  EXAMPLE:
1219
;;	;; defined somewhere *outside* the function!
1220
;;  TEXT_WELCOME_0  STRING 12, 0x00, "Hello World!"
1221
;;
1222
;;	;; within the function: print string
1223
;;	TABLE_ADDR TEXT_WELCOME_0
1224
;;	call    MIOS_LCD_PrintString
1225
;;  C_EXAMPLE:
1226
;;	// defined somewhere *outside* the function!
1227
;;  const unsigned char text_welcome_0[] = { 12, 0x00, "Hello World!" };
1228
;;
1229
;;	// within the function: print string
1230
;;	MIOS_LCD_PrintString(text_welcome_0);
1231
;;
1232
;;	// please see also the MIOS_LCD_PrintCString function!
1233
;; --------------------------------------------------------------------------
1234
MIOS_LCD_PrintString
1235
	;; get text counter and cursor pos
1236
	tblrd*+
1237
	movf	TABLAT, W
1238
	rcall	MIOS_LCD_CursorSet
1239
 
1240
	tblrd*+
1241
	movf	TABLAT, W
1242
	;; 	rgoto	MIOS_LCD_PrintStringLoop
1243
 
1244
;; --------------------------------------------------------------------------
1245
;;  FUNCTION: MIOS_LCD_PrintPreconfString
1246
;;  C_DECLARATION: void MIOS_LCD_PrintPreconfString(unsigned char len, code char *str)
1247
;;  DESCRIPTION: prints a preconfigured string
1248
;;  IN:   Pointer to String in TBLPTR[LH]
1249
;;        Stringlength in WREG
1250
;;  C_IN: Pointer to String in <str>
1251
;;        Stringlength in <len>
1252
;;  OUT:  some characters on LCD
1253
;;  USES: BSR
1254
;;  EXAMPLE:
1255
;;	;; defined somewhere *outside* the function!
1256
;;  TEXT_WELCOME_0  db "Hello World!"
1257
;;
1258
;;	;; within the function: print string
1259
;;	movlw   0x00 + 0
1260
;;	call    MIOS_LCD_CursorSet
1261
;;	TABLE_ADDR TEXT_WELCOME_0
1262
;;	movlw   12
1263
;;	call    MIOS_LCD_PrintPreconfString
1264
;;  C_EXAMPLE:
1265
;;	// defined somewhere *outside* the function!
1266
;;  const unsigned char text_welcome_0[] = { "Hello World!" };
1267
;;
1268
;;	// within the function: print string
1269
;;	MIOS_LCD_CursorSet(0x00 + 0);
1270
;;	MIOS_LCD_PrintPreconfString(12, text_welcome_0);
1271
;;
1272
;;	// please see also the MIOS_LCD_PrintCString function!
1273
;; --------------------------------------------------------------------------
1274
MIOS_LCD_PrintPreconfString	; (LCD_TEXT_CTR must be preconfigured)
1275
	SET_BSR	MIOS_TMP1
1276
	movwf	MIOS_TMP1, BANKED
1277
 
1278
MIOS_LCD_PrintStringLoop
1279
	tblrd*+				; print out first char
1280
	movf	TABLAT, W
1281
	rcall	MIOS_LCD_PrintChar_Internal
1282
 
1283
	decfsz	MIOS_TMP1, F, BANKED	; decrement text counter, leave routine if zero
1284
	rgoto	MIOS_LCD_PrintStringLoopNext
1285
	tblrd*+				; dummy read
1286
	return
1287
MIOS_LCD_PrintStringLoopNext
1288
 
1289
	tblrd*+				; print out second char
1290
	movf	TABLAT, W
1291
	rcall	MIOS_LCD_PrintChar_Internal
1292
 
1293
	decfsz	MIOS_TMP1, F		; decrement text counter, leave routine if zero
1294
	rgoto	MIOS_LCD_PrintStringLoop
1295
 
1296
	rgoto	MIOS_LCD_TransferFinished
1297
 
1298
 
1299
;; --------------------------------------------------------------------------
1300
;;  FUNCTION: MIOS_LCD_PrintMessage
1301
;;  C_DECLARATION: void MIOS_LCD_PrintMessage(code char *str)
1302
;;  DESCRIPTION: prints a message for about 2 seconds. Normal
1303
;;  program flow will not be stopped during this time, just only the
1304
;;  "DISPLAY_Tick" routine will not be called. After the message,
1305
;;  "DISPLAY_Init" will be invoked before the next "DISPLAY_Tick"
1306
;;  IN:   Pointer to String in TBLPTR[LH]
1307
;;        First word of string must contain length and LCD position
1308
;;  C_IN: Pointer to String in <str>
1309
;;        First word of string must contain length and LCD position
1310
;;  OUT:  some characters on LCD for 2 seconds
1311
;;  C_OUT:  some characters on LCD for 2 seconds
1312
;;  USES: BSR
1313
;;  EXAMPLE:
1314
;;	;; defined somewhere *outside* the function!
1315
;;  TEXT_POT_VALUE_0  STRING 11, 0x00, "Pot value: "
1316
;;
1317
;;	;; within the function: print string
1318
;;	TABLE_ADDR TEXT_POT_VALUE_0
1319
;;	call    MIOS_LCD_PrintMessage
1320
;;	movlw   0x00
1321
;;	call    MIOS_AIN_Pin7bitGet
1322
;;	call    MIOS_LCD_PrintHex2
1323
;;  C_EXAMPLE:
1324
;;	// consider the use of MIOS_LCD_PrintMessageStart
1325
;;      // see also the appr. example
1326
;; --------------------------------------------------------------------------
1327
MIOS_LCD_PrintMessage
1328
	rcall	MIOS_LCD_PrintString
1329
	SET_BSR MIOS_MESSAGE_CTR
1330
	movlw	0xff
1331
	movwf	MIOS_MESSAGE_CTR, BANKED
1332
	return
1333
 
1334
;; --------------------------------------------------------------------------
1335
;;  FUNCTION: MIOS_LCD_MessageStart
1336
;;  C_DECLARATION: void MIOS_LCD_MessageStart(unsigned char delay)
1337
;;  DESCRIPTION: a replacement for MIOS_LCD_PrintMessage which allows to
1338
;;  start a message without calling "MIOS_LCD_PrintString"
1339
;;  IN:   message delay in WREG
1340
;;  C_IN:   message delay in <delay>
1341
;;  OUT:  -
1342
;;  C_OUT:  -
1343
;;  USES: BSR
1344
;;  EXAMPLE:
1345
;;	;; don't invoke DISPLAY_Tick for 2 seconds
1346
;;	movlw	255
1347
;;	call	MIOS_LCD_MessageStart
1348
;;  C_EXAMPLE:
1349
;;	// print message on LCD for 2 seconds
1350
;;	MIOS_LCD_CursorSet(0x00 + 0);
1351
;;	MIOS_LCD_PrintCString("Pot value: ");
1352
;;	MIOS_LCD_PrintHex2(MIOS_AIN_Pin7bitGet(0));
1353
;;	MIOS_LCD_MessageStart(255);
1354
;; --------------------------------------------------------------------------
1355
MIOS_LCD_MessageStart
1356
	SET_BSR	MIOS_MESSAGE_CTR
1357
	movwf	MIOS_MESSAGE_CTR, BANKED
1358
	return
1359
 
1360
;; --------------------------------------------------------------------------
1361
;;  FUNCTION: MIOS_LCD_MessageStop
1362
;;  C_DECLARATION: void MIOS_LCD_MessageStop(void)
1363
;;  DESCRIPTION: this function allows to stop the message immediately so
1364
;;  that MIOS_LCD_Tick will be called again
1365
;;  IN:   -
1366
;;  C_IN: -
1367
;;  OUT:  -
1368
;;  C_OUT: -
1369
;;  USES: BSR
1370
;;  EXAMPLE:
1371
;;	;; stop message immediately and invoke DISPLAY_Tick again
1372
;;	call	MIOS_LCD_MessageStop
1373
;;  C_EXAMPLE:
1374
;;	// stop message immediately and invoke DISPLAY_Tick again
1375
;;	MIOS_LCD_MessageStop();
1376
;; --------------------------------------------------------------------------
1377
MIOS_LCD_MessageStop
1378
	SET_BSR	MIOS_MESSAGE_CTR
1379
	;; exit if message counter already 0
1380
	movf	MIOS_MESSAGE_CTR, W, BANKED
1381
	skpnz
1382
	return
1383
	;; else set it to 1 for a proper reinitialization of the screen
1384
	movlw	0x01
1385
	movwf	MIOS_MESSAGE_CTR, BANKED
1386
	return
1387
 
1388
;; --------------------------------------------------------------------------
1389
;;  FUNCTION: USER_LCD_Init
1390
;;  C_DECLARATION: not available in C - code is part of LCD driver (app_lcd.inc)
1391
;;  DESCRIPTION: This function is called by MIOS when the custom LCD should be initialized
1392
;;  IN:  MIOS_LCD_OPTION1 - contains the first LCD option given by MIOS_LCD_TypeSet
1393
;;       MIOS_LCD_OPTION2 - contains the second LCD option given by MIOS_LCD_TypeSet
1394
;;  OUT: -
1395
;;  NOTE: see the custom_lcd_example for further details
1396
;; --------------------------------------------------------------------------
1397
 
1398
;; --------------------------------------------------------------------------
1399
;;  FUNCTION: USER_LCD_Clear
1400
;;  C_DECLARATION: not available in C - code is part of LCD driver (app_lcd.inc)
1401
;;  DESCRIPTION: This function is called by MIOS when the custom LCD should be cleared
1402
;;  IN:  MIOS_LCD_OPTION1 - contains the first LCD option given by MIOS_LCD_TypeSet
1403
;;       MIOS_LCD_OPTION2 - contains the second LCD option given by MIOS_LCD_TypeSet
1404
;;  OUT: -
1405
;;  NOTE: see the custom_lcd_example for further details
1406
;; --------------------------------------------------------------------------
1407
 
1408
;; --------------------------------------------------------------------------
1409
;;  FUNCTION: USER_LCD_CursorSet
1410
;;  C_DECLARATION: not available in C - code is part of LCD driver (app_lcd.inc)
1411
;;  DESCRIPTION: This function is called by MIOS when the cursor should be changed
1412
;;  IN:  MIOS_LCD_OPTION1 - contains the first LCD option given by MIOS_LCD_TypeSet
1413
;;       MIOS_LCD_OPTION2 - contains the second LCD option given by MIOS_LCD_TypeSet
1414
;;       MIOS_GLCD_CURSOR_X - horizontal cursor position (for GLCDs)
1415
;;       MIOS_GLCD_CURSOR_X - vertical cursor position   (for GLCDs)
1416
;;       MIOS_LCD_CURSOR    - character cursor position  (for CLCDs)
1417
;;  OUT: -
1418
;;  NOTE: see the custom_lcd_example for further details
1419
;; --------------------------------------------------------------------------
1420
 
1421
;; --------------------------------------------------------------------------
1422
;;  FUNCTION: USER_LCD_PrintChar
1423
;;  C_DECLARATION: not available in C - code is part of LCD driver (app_lcd.inc)
1424
;;  DESCRIPTION: This function is called by MIOS when a character should be print
1425
;;  IN:  WREG - character
1426
;;       all other MIOS_*LCD_* registers
1427
;;  OUT: GLCDs should justify the X/Y cursor position
1428
;;  NOTE: see the custom_lcd_example for further details
1429
;; --------------------------------------------------------------------------
1430
 
1431
;; --------------------------------------------------------------------------
1432
;;  FUNCTION: USER_LCD_Data
1433
;;  C_DECLARATION: not available in C - code is part of LCD driver (app_lcd.inc)
1434
;;  DESCRIPTION: sends a data value to the LCD display.<BR>
1435
;;  On CLCDs: branch directly to USER_LCD_PrintChar<BR>
1436
;;  On GLCDs: ignore this function!
1437
;;  IN:  data which should be sent
1438
;;  OUT: -
1439
;;  NOTE: see the custom_lcd_example for further details
1440
;; --------------------------------------------------------------------------
1441
 
1442
;; --------------------------------------------------------------------------
1443
;;  FUNCTION: USER_LCD_Cmd
1444
;;  C_DECLARATION: not available in C - code is part of LCD driver (app_lcd.inc)
1445
;;  DESCRIPTION: sends a command to the LCD display.<BR>
1446
;;  On CLCDs: use this function to decode the HD44780 commands if required<BR>
1447
;;  On GLCDs: ignore this function!
1448
;;  IN:  command which should be sent
1449
;;  OUT: -
1450
;;  NOTE: see the custom_lcd_example for further details
1451
;; --------------------------------------------------------------------------
1452
 
1453
;; --------------------------------------------------------------------------
1454
;;  FUNCTION: USER_LCD_SpecialCharInit
1455
;;  C_DECLARATION: not available in C - code is part of LCD driver (app_lcd.inc)
1456
;;  DESCRIPTION: see MIOS_CLCD_SpecialCharInit
1457
;;  IN:  number of special character (0-7) in WREG
1458
;;       pointer to special char pattern in TBLPTR (consists of 8
1459
;;          entries for every character-line)
1460
;;  OUT: TBLPTR has to be set to next table entry (TBLPTR+=8)
1461
;;  NOTE: see the custom_lcd_example for further details
1462
;; --------------------------------------------------------------------------
1463
 
1464
;; --------------------------------------------------------------------------
1465
;;  MIOS_LCD_TransferFinished
1466
;;  called by MIOS internal functions after a transfer of characters (i.E BCD
1467
;;  numbers or strings) has been finished
1468
;;  Allowes the MLCD driver to close the SysEx string properly
1469
;;  Could also be used by similar drivers
1470
;; --------------------------------------------------------------------------
1471
MIOS_LCD_TransferFinished
1472
	GOTO_IFSET MIOS_BOX_STAT, MIOS_BOX_STAT_MLCD_TRANSFER, ACCESS, MIOS_MLCD_SendSyxFooter
1473
	return