Conditional compilation

Libraries ›› The LCD unit ››
Parent Previous Next

Parameter / feature

$DEFINE format

Default

Example

Width

LCD_WIDTH N

N = 16 characters.

{$DEFINE LCD_WIDTH 20}

Number of lines

LCD_LINES N

N = 2 lines.

{$DEFINE LCD_LINES 4}

Data bus width

LCD_BITS N

N = 4-bit.

{$DEFINE LCD_BITS 8}

4-bit mode bus position

LCD_4BIT_UPPER

Lower bits.

{$DEFINE LCD_4BIT_UPPER}

Read mode is possible (LCD's WR pin not permanently grounded)

LCD_READ

NO. Forced as NO if PIC10/PIC12.

{$DEFINE LCD_READ}

Use of character generator routine (possible values are 0, 8, 10 for the nb of pixels height 5x8 or 5x10)

LCD_GEN N

N = 0, no generator.

{$DEFINE LCD_GEN 10}

Control port to use

LCD_CNTRL 'PORTx'

GPIO for PIC10/12 and PORTB otherwise.

{$DEFINE LCD_CNTRL 'LATC'}

Data port to use

LCD_DATA 'PORTx'

GPIO for PIC10/12, otherwise it is PORTB if 4-bit mode, PORTC otherwise.

{$DEFINE LCD_DATA 'LATB'}

Register select pin bit to use (1)

LCD_BIT_RS

4 if data bits in lower bits of same port,

0 otherwise.

{$DEFINE LCD_BIT_RS 4}

Enable pulse pin bit to use (1)

LCD_BIT_E

5 if data bits in lower bits of same port,

1 otherwise.

{$DEFINE LCD_BIT_E 5}

Write mode pin bit to use (1) (2)

LCD_BIT_WR

6 if data bits in lower bits of same port,

2 otherwise.

{$DEFINE LCD_BIT_WR 6}

Data settle time before enable pulse (writing) and settle time after start of enable pulse before data latch (reading)  (µs)

LCD_DELAY_DATA

2

{$DEFINE LCD_DELAY_DATA 5}

Enable pulse duration (µs)

LCD_DELAY_ENABLE

5

{$DEFINE LCD_DELAY_ENABLE 10}

Basic wait for end of operation delay, used only if LCD_READ is not defined (µs)

LCD_DELAY_WAIT

37

{$DEFINE LCD_DELAY_WAIT 50}

Long operation (CLEAR / HOME) wait for end of operation delay, used only if LCD_READ is not defined (µs)

LCD_DELAY_HOME

1520

{$DEFINE LCD_DELAY_HOME 2000}

Minimize HW stack use by using include and unrolled code. This takes more code but limits stack depth.

LCD_MINIMIZE_STACK_USE

Normal calls /  HW stack use.

{$DEFINE LCD_MINIMIZE_STACK_USE}

(1): If one is user-defined, all must be defined to avoid conflicts with defaults.

(2): Only if LCD_READ is defined.