Lecture 6 Mikro C PIC Libraries
Lecture 6 Mikro C PIC Libraries
1
Library Functions
• Mikro C provides libraries for use when working with
on board PIC modules and external PIC-compatible
hardware devices.
2
LCDs
• An LCD uses crystals that block light when current
passes through them.
3
LCDs
6
Character LCD
• It is used to display characters (ASCII and related).
• Each character is displayed on a 5x7 pixel or a 5x8 matrix.
7
Character LCD
• Display size described as number of characters per line
and the number of lines, for example 16x2 LCD.
8
Character LCD
• A character on a character LCD is identified by a line
number and its position in the line.
Character at row 1,
column 7
Character at row 3,
column 9
9
Interfacing to Character LCD
• LCD displays have large number of control signals and
lines to control the large number of pixels involved.
• They are thus constructed as modules containing the
display and an interface IC.
Enable
line
Data lines
Register
Read/write
select line 12
Select line
Interfacing to Character LCD
• Interface to a microcontroller can be 8-bit interface or
4-bit interface.
• In 4-bit mode, data pin DB4 to DB7 form the data bus
while DB0 to DB3 are left free.
• The rest of the pins retain their functions.
• Characters are exchanged in two cycles.
13
Interfacing to Character LCD
4-bit
interface
wiring for
writes only
14
LCD Library
15
LCD Library
• LCD library routines use global variables of the
external sfr bit type to identify pins and
corresponding TRIS bits.
18
LCD Library
void Lcd_Out_Cp(char *text)
• Prints text on Lcd at current cursor position.
• text: text to be written
19
LCD Library
void Lcd_Chr_Cp(char out_char)
• Prints character on Lcd at current cursor position.
• out_char: character to be written
20
LCD Library
void Lcd_Chr_Cp(char out_char)
• Prints character on Lcd at current cursor position.
• out_char: character to be written
24