PICSimLab - Programmable IC Simulator Laboratory 0.9.2
PICSimLab - API
Loading...
Searching...
No Matches
lcd_hd44780.h
1/* ########################################################################
2
3 PICSimLab - Programmable IC Simulator Laboratory
4
5 ########################################################################
6
7 Copyright (c) : 2010-2024 Luis Claudio GambĂ´a Lopes <lcgamboa@yahoo.com>
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2, or (at your option)
12 any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22
23 For e-mail suggestions : lcgamboa@yahoo.com
24 ######################################################################## */
25
26#ifndef LCD_H
27#define LCD_H
28
29class board;
30
31#include "../lib/draw.h"
32
33#define DDRMAX 80
34
35#define L_FNT 0x0200 // Sets character font
36#define L_NLI 0x0100 // Sets number of display line
37
38#define L_DL 0x0080 // Sets interface data length
39
40#define L_LR 0x0040 // Sets shift direction
41#define L_CD 0x0020 // Sets cursor-move or display-shift
42
43#define L_DID 0x0010 // Sets cursor move direction
44#define L_DSH 0x0008 // specifies to shift the display
45
46#define L_DON 0x0004 // Sets On/Off of all display
47#define L_CON 0x0002 // Sets cursor On/Off
48#define L_CBL 0x0001 // Set blink of cursor position character
49
50/*
51I/D 0 = Decrement cursor position 1 = Increment cursor position
52S 0 = No display shift 1 = Display shift
53D 0 = Display off 1 = Display on
54C 0 = Cursor off 1 = Cursor on
55B 0 = Cursor blink off 1 = Cursor blink on
56S/C 0 = Move cursor 1 = Shift display
57R/L 0 = Shift left 1 = Shift right
58DL 0 = 4-bit interface 1 = 8-bit interface
59N 0 = 1/8 or 1/11 Duty (1 line) 1 = 1/16 Duty (2 lines)
60F 0 = 5x7 dots 1 = 5x10 dots
61BF 0 = Can accept instruction 1 = Internal operation in progress
62*/
63
64#define LCD_ADDR_CGRAM 0
65#define LCD_ADDR_DDRAM 1
66
67typedef struct {
68 unsigned short int flags;
69 unsigned char addr_counter;
70 unsigned char addr_mode;
71 unsigned char update; // redraw
72 unsigned char blink; // cursor state
73 char shift; // display shift
74 char ddram_char[DDRMAX]; // ddram
75 char cgram[8][5]; // cgram font mapped
76 char cgram_char[64]; // cgram
77 char bc;
78 char buff;
79 unsigned char cnum; // number of columns 16 or 20
80 unsigned char lnum; // number of lines 1,2 or 4
81 board* pboard;
82 int TimerID;
83} lcd_t;
84
85void lcd_cmd(lcd_t* lcd, char cmd);
86void lcd_data(lcd_t* lcd, char data);
87unsigned char lcd_read_busyf_acounter(lcd_t* lcd);
88char lcd_read_data(lcd_t* lcd);
89void lcd_rst(lcd_t* lcd);
90void lcd_init(lcd_t* lcd, unsigned char cnum, unsigned char lnum, board* pboard_);
91void lcd_end(lcd_t* lcd);
92void lcd_on(lcd_t* lcd, int onoff);
93void lcd_draw(lcd_t* lcd, CanvasCmd_ft CanvasCmd, float x1, float y1, float w1, float h1, int picpwr);
94
95#endif
Board class.
Definition board.h:111
Definition lcd_hd44780.h:67