lcd_dog_m_spi
control for DOG-M (ST7036 based) LCD's
|
Author
|
Richard Zengerink, Copyright © 2008, all rights reserved
|
|
Adapted-by
|
|
|
Compiler
|
=2.4
|
Description
Simple interface for DOG-M (st7036) alphanumeric LCD screens.
Screens can range from 1x8 (1 lines, 8 chars), 2x16 and 3x16.
Uses spi interface SI (data line), CLK (clock) RS (register select) and
if necesery CSB (chip select) (total 4 PIC pins max.).
Expects: - 1 pin for data: 'lcd_data'
- 1 pin for clock: 'lcd_clk'
- 1 pin for register/data select: 'lcd_rs'
- 1 pin for Chip Select 'lcd_csb' (if necesery, or CSB to gnd on lcd)
- 1 var bit named not_connected to assign to lcd_csb if this pin
is connected to ground.
Directions for use of this library in application programs
(in this sequence):
1. Declare the following constants:
const byte LCD_ROWS = 2 -- 1, 2 or 3 lines
const byte LCD_CHARS = 16 -- 8, or 16 chars per line
and variables (aliases):
var bit not_connected
var bit lcd_data is pin_A0 -- 1 data pin
var bit lcd_clk is pin_A1 -- 1 data pin
var bit lcd_rs is pin_A2 -- 1 data pin
var bit lcd_csb is pin_A3 -- 1 data pin
or if csb is connected to gnd:
var bit lcd_csb is not_connected
.
2. Include this library.
and somewhere before actually using the lcd:
3. Set the chosen LCD data and control pins to output:
portA_low_direction = all_output (in above case this is OK)
OR assign each pin seperatly (when not every pin is on the same port):
pin_A0_direction = output (each pin separately assigned)
pin_A1_direction = output
pin_b0_direction = output
pin_b1_direction = output
4. Call lcd_init() to initialize the lcd controller.
Above is an example for a 2x16 LCD:
.
Available functions for application programs:
.
_lcd_write() ends byte from value to
register of the lcd and
shift cursor position 1 right
.
_lcd_write_data() write data to lcd using
_lcd_write() lcd_rs high
.
_lcd_write_data() write command to lcd using
_lcd_write() lcd_rs low
.
lcd_init() initialize the LCD controller
Dependencies
Private
Private
No sample found