EPPL example libraries  0.1 alpha
 All Files Functions Variables Groups Pages
<alcddrv> Alphanumeric display driver

Modules

 Internal definitions
 
 Internal functions
 
 Alphanumeric display driver configuration
 
 <alcddrv_cmd> Commands definitions
 

Macros

#define ALCD_PINCONFIG
 LCD pin initialization data. More...
 
#define ALCD_PIN_DEFINED(p)   ((p) != EPPL_NP)
 Check if pin is defined. More...
 
#define ALCD_CANREAD   ALCD_PIN_DEFINED(ALCD_RW)
 Define if we have read access to LCD. More...
 

Functions

void alcd_cmd (uint8_t cmd)
 Send single command byte. More...
 
void alcd_data (uint8_t data)
 Send signle data byte. More...
 
char alcd_rdata (void)
 Function to read one character from LCD. More...
 
void alcd_init (void)
 Initialize LCD. More...
 
void alcd_puts (const char *pstr)
 Put string. More...
 
void alcd_read (char *pstr, uint8_t size)
 Read data block. More...
 
void alcd_puts_P (const __flash char *pstr)
 Put string from program memory. More...
 
void alcd_defineChar (char c, const char *ppat)
 Define special character pattern. More...
 
void alcd_defineChar_P (char c, const __flash char *ppat)
 Define special character pattern from program memory. More...
 
void alcd_readDefinedChar (char c, char *ppat)
 Read defined character pattern. More...
 
static void alcd_cls (void)
 Clear screen. More...
 
static void alcd_home (void)
 Moves cursor home. More...
 
static void alcd_turnOnOff (uint8_t display, uint8_t cursor, uint8_t blink)
 Turn on or off. More...
 
static void alcd_shift (uint8_t right_left, uint8_t display_cursor)
 Shift display or cursor by one position. More...
 
static void alcd_entryMode (uint8_t inc_dec, uint8_t shift)
 Entry mode set. More...
 
static void alcd_goto (uint8_t y, uint8_t x)
 Move cursor to position. More...
 
static void alcd_putc (char c)
 Put a character. More...
 
static char alcd_getc (void)
 Get a character. More...
 

Detailed Description

Driver for alphanumeric lcd, created as an example of EPPL usage.

Macro Definition Documentation

#define ALCD_CANREAD   ALCD_PIN_DEFINED(ALCD_RW)

Define if we have read access to LCD.

Macro that informs us if library have read access to LCD. This library uses it only to read busy flag.

#define ALCD_PIN_DEFINED (   p)    ((p) != EPPL_NP)

Check if pin is defined.

Internal macro for check if pin is defined. We assume that pin is defined if the mnemonic is defined and it not equals EPPL_NP

Parameters
pMnemonic to check
Returns
Value that indicates if pin is defined
#define ALCD_PINCONFIG
Value:
EPPL_SC(ALCD_D7, ALCD_DOutMode | EPPL_outSet_0),\
EPPL_SC(ALCD_D6, ALCD_DOutMode | EPPL_outSet_0),\
EPPL_SC(ALCD_D5, ALCD_DOutMode | EPPL_outSet_0),\
EPPL_SC(ALCD_D4, ALCD_DOutMode | EPPL_outSet_0),\
EPPL_SC(ALCD_D3, ALCD_DOutMode | EPPL_outSet_0),\
EPPL_SC(ALCD_D2, ALCD_DOutMode | EPPL_outSet_0),\
EPPL_SC(ALCD_D1, ALCD_DOutMode | EPPL_outSet_0),\
EPPL_SC(ALCD_D0, ALCD_DOutMode | EPPL_outSet_0),\
EPPL_SC(ALCD_RW, ALCD_CtrlMode | EPPL_outSet_0),\
EPPL_SC(ALCD_RS, ALCD_CtrlMode | EPPL_outSet_0),\
EPPL_SC(ALCD_E, ALCD_CtrlMode | EPPL_outSet_0)

LCD pin initialization data.

Use this constant for eppl_init function in your main code.

Example:

eppl_init(EPPL_mode_inPU,
EPPL_SC(LED, EPPL_mode_outPP_0),
EPPL_SC(BUTTON, EPPL_mode_inPU)
);
Examples:
base/main.c.

Function Documentation

static void alcd_cls ( void  )
inlinestatic

Clear screen.

Function generates command that:

  • moves cursor at position 0 in DDRAM
  • resets any display shifts
  • fills DDRAM with spaces (0x20 ASCII code)
  • sets increment entry mode, (shift does not change)
void alcd_cmd ( uint8_t  cmd)

Send single command byte.

Function that configures outputs and sends one command. Also supports busy waiting strategy depending of read accessability. Just "call and forget" function.

Attention
For future compatibility do not call this function directly. Use other higher-level configuration functions.
Parameters
cmdCommand to send.
See Also
alcd_data
void alcd_data ( uint8_t  data)

Send signle data byte.

Function sends signgle data byte.

Attention
For future compatibility do not use it to send character on LCD. Use alcd_putc instead.
Parameters
dataData to send.
See Also
alcd_cmd
void alcd_defineChar ( char  c,
const char *  ppat 
)

Define special character pattern.

Function writes special character pattern to LCD.

Parameters
cCharacter do define (only 3 lowest bits are significant)
[in]ppat8 bajts of character pattern in RAM
Attention
Function resets actual cursor positon
void alcd_defineChar_P ( char  c,
const __flash char *  ppat 
)

Define special character pattern from program memory.

Function writes special character pattern to LCD.

Parameters
cCharacter do define (only 3 lowest bits are significant)
[in]ppat8 bajts of character pattern in FLASH
Attention
Function resets actual cursor positon
static void alcd_entryMode ( uint8_t  inc_dec,
uint8_t  shift 
)
inlinestatic

Entry mode set.

Function sets entry mode. It means what display have to do when data is send.

Parameters
inc_decIncrement (!0) or decrement (0) current addres (in CGRAM or in DDRAM)
shiftShifts display when writting
static char alcd_getc ( void  )
inlinestatic

Get a character.

Function reads a character on current cursor position.

Returns
ASCII code of the readed character
static void alcd_goto ( uint8_t  y,
uint8_t  x 
)
inlinestatic

Move cursor to position.

Function sets cursor on selected position.

Parameters
yRow number in range from 0 to (ALCD_SY-1)
xColumn number in range from 0 to (ALCD_SX-1)
Examples:
base/main.c.
static void alcd_home ( void  )
inlinestatic

Moves cursor home.

Function generates command that moves cursor home and also resets any display shifts.

void alcd_init ( void  )

Initialize LCD.

Initializes LCD to work. Call it more than 15ms after voltage reaches 4.5V or more than 40ms after voltage reaches 2.7V.

It just sets the interface and line count. It leaves LCD off.

static void alcd_putc ( char  c)
inlinestatic

Put a character.

Function puts a character on current cursor position

Parameters
cASCII code of the character to put
Examples:
base/main.c.
void alcd_puts ( const char *  pstr)

Put string.

Function puts string to display

Parameters
[in]pstrPointer to string in RAM
void alcd_puts_P ( const __flash char *  pstr)

Put string from program memory.

Function puts string from FLASH to display

Parameters
[in]pstrPointer to string in FLASH
char alcd_rdata ( void  )

Function to read one character from LCD.

Function reads one byte from LCD. If ALCD_CANREAD is false function returns 0x20 (' ' - space character) constant value.

Attention
It is accessable here for optymalization reason. For future compatibility do not use it to read character from LCD. Use alcd_getc
Returns
Value readed from LCD.
void alcd_read ( char *  pstr,
uint8_t  size 
)

Read data block.

Function reads data from character memory of the display Function does not write null character on the end of the readed data.

Parameters
[out]pstrPointer to data buffer
sizeof the block to read
void alcd_readDefinedChar ( char  c,
char *  ppat 
)

Read defined character pattern.

Function reads special character pattern from LCD.

Parameters
cCharacter do read
[out]ppat8 bajts buffor for the pattern
Attention
Function resets actual cursor positon
static void alcd_shift ( uint8_t  right_left,
uint8_t  display_cursor 
)
inlinestatic

Shift display or cursor by one position.

Function generates command that moves cursor or shifts whole display.

Parameters
right_leftMoves/Shifts right(!0) or left (0)
display_cursorMoves/Shifts display (!0) or cursor (0)
static void alcd_turnOnOff ( uint8_t  display,
uint8_t  cursor,
uint8_t  blink 
)
inlinestatic

Turn on or off.

Function generates command that turns on or off elements given in parameters

Parameters
displayTurn on (!0) or of (0) display
cursorTurn on (!0) or of (0) cursor
blinkTurn on (!0) or of (0) blinking cursor
Examples:
base/main.c.