AtomSoft
Well-Known Member
Here is my code for this Nokia 7110 LCD. I also have some pictures of it.
Code is in C18.
The 2 images below are:
1: the above code running with 1 font
2: the above code using both fonts to compare differences
Schematic coming soon!
Code is in C18.
Code:
/* ****************************************************************************
; *
; Filename: GLCD.C *
; Date: May 23, 2009 *
; File Version: 001 *
; *
; Author: Jason Lopez *
; Company: AtomSoft *
; *
;******************************************************************************
; Parts Needed
; Graphic LCD 96x64 w/ SED1565 Controller ( mines from: dipmicro.com )
;
*/
#include <p18f2525.h>
#include <delays.h>
#include <string.h>
#pragma config WDT = OFF, LVP = OFF, OSC = INTIO67, XINST = OFF
/************************************
Prototypes
*************************************/
void main(void);
void LCD_Reset(void);
void LCD_Send(unsigned char cmd, unsigned char type);
void SendByte(unsigned char data);
void LCD_Init(void);
void CLS(void);
void LCDString(rom unsigned char *str, unsigned char myFont);
/************************************
Variables and Defines
*************************************/
unsigned char temp;
//LCD Defines
#define LCDt TRISC
#define LCD PORTC
#define RST LATCbits.LATC0
#define CS LATCbits.LATC1
#define DC LATCbits.LATC2
#define SCL LATCbits.LATC3
#define SDO LATCbits.LATC5
#pragma udata
unsigned rom char FontB[97][8]=
{
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, //Ascii-32
{ 0x00,0x00,0x00,0x5F,0x5F,0x00,0x00,0x00 }, //Ascii-33
{ 0x00,0x07,0x07,0x00,0x00,0x07,0x07,0x00 }, //Ascii-34
{ 0x24,0x7E,0x7E,0x24,0x7E,0x7E,0x24,0x00 }, //Ascii-35
{ 0x00,0x24,0x2E,0x6B,0x6B,0x3A,0x12,0x00 }, //Ascii-36
{ 0x00,0x66,0x36,0x18,0x0C,0x66,0x62,0x00 }, //Ascii-37
{ 0x30,0x7A,0x4F,0x5D,0x37,0x72,0x50,0x00 }, //Ascii-38
{ 0x00,0x00,0x00,0x07,0x07,0x00,0x00,0x00 }, //Ascii-39
{ 0x00,0x00,0x00,0x3E,0x7F,0x63,0x41,0x00 }, //Ascii-40
{ 0x00,0x41,0x63,0x7F,0x3E,0x00,0x00,0x00 }, //Ascii-41
{ 0x08,0x2A,0x3E,0x1C,0x1C,0x3E,0x2A,0x08 }, //Ascii-42
{ 0x00,0x08,0x08,0x3E,0x3E,0x08,0x08,0x00 }, //Ascii-43
{ 0x00,0x80,0xE0,0x60,0x00,0x00,0x00,0x00 }, //Ascii-44
{ 0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x00 }, //Ascii-45
{ 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00 }, //Ascii-46
{ 0x00,0x60,0x30,0x18,0x0C,0x06,0x03,0x00 }, //Ascii-47
{ 0x00,0x3E,0x7F,0x49,0x45,0x7F,0x3E,0x00 }, //Ascii-48
{ 0x00,0x40,0x42,0x7F,0x7F,0x40,0x40,0x00 }, //Ascii-49
{ 0x00,0x42,0x63,0x71,0x59,0x4F,0x46,0x00 }, //Ascii-50
{ 0x00,0x21,0x61,0x45,0x4F,0x7B,0x31,0x00 }, //Ascii-51
{ 0x00,0x18,0x1C,0x16,0x7F,0x7F,0x10,0x00 }, //Ascii-52
{ 0x00,0x27,0x67,0x45,0x45,0x7D,0x39,0x00 }, //Ascii-53
{ 0x00,0x3E,0x7F,0x49,0x49,0x79,0x30,0x00 }, //Ascii-54
{ 0x00,0x01,0x71,0x79,0x0D,0x07,0x03,0x00 }, //Ascii-55
{ 0x00,0x36,0x7F,0x49,0x49,0x7F,0x36,0x00 }, //Ascii-56
{ 0x00,0x06,0x4F,0x49,0x69,0x3F,0x1E,0x00 }, //Ascii-57
{ 0x00,0x00,0x00,0x36,0x36,0x00,0x00,0x00 }, //Ascii-58
{ 0x00,0x00,0x40,0x76,0x36,0x00,0x00,0x00 }, //Ascii-59
{ 0x00,0x00,0x08,0x1C,0x36,0x63,0x41,0x00 }, //Ascii-60
{ 0x00,0x24,0x24,0x24,0x24,0x24,0x24,0x00 }, //Ascii-61
{ 0x00,0x41,0x63,0x36,0x1C,0x08,0x00,0x00 }, //Ascii-62
{ 0x00,0x02,0x03,0x51,0x59,0x0F,0x06,0x00 }, //Ascii-63
{ 0x00,0x3E,0x7F,0x41,0x5D,0x57,0x5E,0x00 }, //Ascii-64
{ 0x00,0x7C,0x7E,0x13,0x13,0x7E,0x7C,0x00 }, //Ascii-65
{ 0x00,0x7F,0x7F,0x49,0x49,0x7F,0x36,0x00 }, //Ascii-66
{ 0x00,0x3E,0x7F,0x41,0x41,0x63,0x22,0x00 }, //Ascii-67
{ 0x00,0x7F,0x7F,0x41,0x63,0x3E,0x1C,0x00 }, //Ascii-68
{ 0x00,0x7F,0x7F,0x49,0x49,0x49,0x41,0x00 }, //Ascii-69
{ 0x00,0x7F,0x7F,0x09,0x09,0x09,0x01,0x00 }, //Ascii-70
{ 0x00,0x3E,0x7F,0x41,0x49,0x79,0x79,0x00 }, //Ascii-71
{ 0x00,0x7F,0x7F,0x08,0x08,0x7F,0x7F,0x00 }, //Ascii-72
{ 0x00,0x00,0x41,0x7F,0x7F,0x41,0x00,0x00 }, //Ascii-73
{ 0x00,0x20,0x60,0x40,0x40,0x7F,0x3F,0x00 }, //Ascii-74
{ 0x00,0x7F,0x7F,0x1C,0x36,0x63,0x41,0x00 }, //Ascii-75
{ 0x00,0x7F,0x7F,0x40,0x40,0x40,0x40,0x00 }, //Ascii-76
{ 0x7F,0x7F,0x06,0x0C,0x06,0x7F,0x7F,0x00 }, //Ascii-77
{ 0x00,0x7F,0x7F,0x0E,0x1C,0x7F,0x7F,0x00 }, //Ascii-78
{ 0x00,0x3E,0x7F,0x41,0x41,0x7F,0x3E,0x00 }, //Ascii-79
{ 0x00,0x7F,0x7F,0x09,0x09,0x0F,0x06,0x00 }, //Ascii-80
{ 0x00,0x3E,0x7F,0x51,0x21,0x7F,0x5E,0x00 }, //Ascii-81
{ 0x00,0x7F,0x7F,0x09,0x19,0x7F,0x66,0x00 }, //Ascii-82
{ 0x00,0x26,0x6F,0x49,0x49,0x7B,0x32,0x00 }, //Ascii-83
{ 0x00,0x01,0x01,0x7F,0x7F,0x01,0x01,0x00 }, //Ascii-84
{ 0x00,0x3F,0x7F,0x40,0x40,0x7F,0x7F,0x00 }, //Ascii-85
{ 0x00,0x1F,0x3F,0x60,0x60,0x3F,0x1F,0x00 }, //Ascii-86
{ 0x7F,0x7F,0x30,0x18,0x30,0x7F,0x7F,0x00 }, //Ascii-87
{ 0x00,0x63,0x77,0x1C,0x1C,0x77,0x63,0x00 }, //Ascii-88
{ 0x00,0x07,0x0F,0x78,0x78,0x0F,0x07,0x00 }, //Ascii-89
{ 0x00,0x61,0x71,0x59,0x4D,0x47,0x43,0x00 }, //Ascii-90
{ 0x00,0x00,0x00,0x7F,0x7F,0x41,0x41,0x00 }, //Ascii-91
{ 0x00,0x03,0x06,0x0C,0x18,0x30,0x60,0x00 }, //Ascii-92
{ 0x00,0x41,0x41,0x7F,0x7F,0x00,0x00,0x00 }, //Ascii-93
{ 0x08,0x0C,0x06,0x03,0x06,0x0C,0x08,0x00 }, //Ascii-94
{ 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00 }, //Ascii-95
{ 0x02,0x06,0x0C,0x08,0x00,0x00,0x00,0x00 }, //Ascii-96
{ 0x00,0x20,0x74,0x54,0x54,0x7C,0x78,0x00 }, //Ascii-97
{ 0x00,0x7F,0x7F,0x44,0x44,0x7C,0x38,0x00 }, //Ascii-98
{ 0x00,0x38,0x7C,0x44,0x44,0x44,0x00,0x00 }, //Ascii-99
{ 0x00,0x38,0x7C,0x44,0x44,0x7F,0x7F,0x00 }, //Ascii-100
{ 0x00,0x38,0x7C,0x54,0x54,0x5C,0x18,0x00 }, //Ascii-101
{ 0x00,0x04,0x7E,0x7F,0x05,0x05,0x00,0x00 }, //Ascii-102
{ 0x00,0x98,0xBC,0xA4,0xA4,0xFC,0x7C,0x00 }, //Ascii-103
{ 0x00,0x7F,0x7F,0x04,0x04,0x7C,0x78,0x00 }, //Ascii-104
{ 0x00,0x00,0x44,0x7D,0x7D,0x40,0x00,0x00 }, //Ascii-105
{ 0x00,0x80,0x80,0xFD,0x7D,0x00,0x00,0x00 }, //Ascii-106
{ 0x00,0x7F,0x7F,0x10,0x38,0x6C,0x44,0x00 }, //Ascii-107
{ 0x00,0x00,0x41,0x7F,0x7F,0x40,0x00,0x00 }, //Ascii-108
{ 0x7C,0x7C,0x0C,0x18,0x0C,0x7C,0x78,0x00 }, //Ascii-109
{ 0x00,0x7C,0x7C,0x04,0x04,0x7C,0x78,0x00 }, //Ascii-110
{ 0x00,0x38,0x7C,0x44,0x44,0x7C,0x38,0x00 }, //Ascii-111
{ 0x00,0xFC,0xFC,0x44,0x44,0x7C,0x38,0x00 }, //Ascii-112
{ 0x00,0x38,0x7C,0x44,0x44,0xFC,0xFC,0x00 }, //Ascii-113
{ 0x00,0x7C,0x7C,0x04,0x04,0x0C,0x08,0x00 }, //Ascii-114
{ 0x00,0x48,0x5C,0x54,0x54,0x74,0x24,0x00 }, //Ascii-115
{ 0x00,0x04,0x04,0x3E,0x7E,0x44,0x44,0x00 }, //Ascii-116
{ 0x00,0x3C,0x7C,0x40,0x40,0x7C,0x7C,0x00 }, //Ascii-117
{ 0x00,0x1C,0x3C,0x60,0x60,0x3C,0x1C,0x00 }, //Ascii-118
{ 0x1C,0x7C,0x60,0x30,0x60,0x7C,0x1C,0x00 }, //Ascii-119
{ 0x00,0x44,0x6C,0x38,0x38,0x6C,0x44,0x00 }, //Ascii-120
{ 0x00,0x9C,0xBC,0xA0,0xA0,0xFC,0x7C,0x00 }, //Ascii-121
{ 0x00,0x44,0x64,0x74,0x5C,0x4C,0x44,0x00 }, //Ascii-122
{ 0x00,0x00,0x08,0x3E,0x77,0x41,0x41,0x00 }, //Ascii-123
{ 0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,0x00 }, //Ascii-124
{ 0x00,0x41,0x41,0x77,0x3E,0x08,0x00,0x00 }, //Ascii-125
{ 0x0C,0x06,0x06,0x0C,0x18,0x18,0x0C,0x00 }, //Ascii-126
{ 0x00,0x60,0x78,0x5E,0x46,0x58,0x60,0x00 } //Ascii-127
};
unsigned rom char FontA[97][8] =
{
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, // ASCII - 32
{ 0x00,0x00,0x00,0x5F,0x5F,0x00,0x00,0x00 }, // ASCII - 33
{ 0x00,0x00,0x03,0x07,0x00,0x07,0x03,0x00 }, // ASCII - 34
{ 0x00,0x10,0x74,0x1C,0x77,0x1C,0x17,0x04 }, // ASCII - 35
{ 0x00,0x24,0x2E,0x2A,0x7F,0x2A,0x3A,0x10 }, // ASCII - 36
{ 0x00,0x4C,0x6A,0x76,0x1A,0x6A,0x56,0x33 }, // ASCII - 37
{ 0x00,0x30,0x7A,0x4F,0x5D,0x37,0x7A,0x48 }, // ASCII - 38
{ 0x00,0x00,0x04,0x07,0x03,0x00,0x00,0x00 }, // ASCII - 39
{ 0x00,0x00,0x00,0x1C,0x3E,0x63,0x41,0x00 }, // ASCII - 40
{ 0x00,0x00,0x41,0x63,0x3E,0x1C,0x00,0x00 }, // ASCII - 41
{ 0x00,0x08,0x2A,0x3E,0x1C,0x3E,0x2A,0x08 }, // ASCII - 42
{ 0x00,0x08,0x08,0x3E,0x3E,0x08,0x08,0x00 }, // ASCII - 43
{ 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00 }, // ASCII - 44
{ 0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x00 }, // ASCII - 45
{ 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00 }, // ASCII - 46
{ 0x00,0x60,0x30,0x18,0x0C,0x06,0x03,0x01 }, // ASCII - 47
{ 0x00,0x1C,0x3E,0x61,0x43,0x3E,0x1C,0x00 }, // ASCII - 48
{ 0x00,0x00,0x44,0x7F,0x7F,0x40,0x00,0x00 }, // ASCII - 49
{ 0x00,0x46,0x67,0x71,0x59,0x4F,0x66,0x00 }, // ASCII - 50
{ 0x00,0x22,0x63,0x49,0x4D,0x7F,0x32,0x00 }, // ASCII - 51
{ 0x00,0x18,0x1C,0x52,0x7F,0x7F,0x50,0x00 }, // ASCII - 52
{ 0x00,0x2F,0x6F,0x45,0x45,0x7D,0x39,0x00 }, // ASCII - 53
{ 0x00,0x3C,0x7E,0x4B,0x49,0x79,0x30,0x00 }, // ASCII - 54
{ 0x00,0x07,0x43,0x71,0x7D,0x0F,0x03,0x00 }, // ASCII - 55
{ 0x00,0x36,0x7F,0x4D,0x59,0x7F,0x36,0x00 }, // ASCII - 56
{ 0x00,0x06,0x4F,0x49,0x69,0x3F,0x1E,0x00 }, // ASCII - 57
{ 0x00,0x00,0x00,0x66,0x66,0x00,0x00,0x00 }, // ASCII - 58
{ 0x00,0x00,0x00,0x66,0x66,0x00,0x00,0x00 }, // ASCII - 59
{ 0x00,0x00,0x08,0x1C,0x36,0x63,0x41,0x00 }, // ASCII - 60
{ 0x00,0x14,0x14,0x14,0x14,0x14,0x14,0x00 }, // ASCII - 61
{ 0x00,0x00,0x41,0x63,0x36,0x1C,0x08,0x00 }, // ASCII - 62
{ 0x00,0x02,0x07,0x51,0x59,0x0F,0x06,0x00 }, // ASCII - 63
{ 0x00,0x3E,0x41,0x5D,0x55,0x5D,0x51,0x1E }, // ASCII - 64
{ 0x00,0x40,0x70,0x1D,0x17,0x1F,0x78,0x60 }, // ASCII - 65
{ 0x00,0x41,0x7F,0x7F,0x49,0x4F,0x7E,0x30 }, // ASCII - 66
{ 0x00,0x1C,0x3E,0x63,0x41,0x41,0x42,0x27 }, // ASCII - 67
{ 0x00,0x41,0x7F,0x7F,0x41,0x63,0x3E,0x1C }, // ASCII - 68
{ 0x00,0x41,0x7F,0x7F,0x49,0x5D,0x41,0x63 }, // ASCII - 69
{ 0x00,0x41,0x7F,0x7F,0x49,0x1D,0x01,0x03 }, // ASCII - 70
{ 0x00,0x1C,0x3E,0x63,0x41,0x51,0x72,0x77 }, // ASCII - 71
{ 0x00,0x7F,0x7F,0x08,0x08,0x7F,0x7F,0x00 }, // ASCII - 72
{ 0x00,0x00,0x41,0x7F,0x7F,0x41,0x00,0x00 }, // ASCII - 73
{ 0x00,0x30,0x70,0x41,0x41,0x7F,0x3F,0x01 }, // ASCII - 74
{ 0x00,0x7F,0x7F,0x08,0x1C,0x77,0x63,0x41 }, // ASCII - 75
{ 0x00,0x41,0x7F,0x7F,0x41,0x40,0x60,0x70 }, // ASCII - 76
{ 0x00,0x7F,0x7E,0x0C,0x18,0x0C,0x7E,0x7F }, // ASCII - 77
{ 0x00,0x7F,0x7E,0x0C,0x18,0x30,0x7F,0x7F }, // ASCII - 78
{ 0x00,0x1C,0x3E,0x63,0x41,0x63,0x3E,0x1C }, // ASCII - 79
{ 0x00,0x41,0x7F,0x7F,0x49,0x09,0x0F,0x06 }, // ASCII - 80
{ 0x00,0x1C,0x3E,0x63,0x51,0x63,0x3E,0x1C }, // ASCII - 81
{ 0x00,0x7F,0x7F,0x09,0x19,0x7F,0x66,0x40 }, // ASCII - 82
{ 0x00,0x66,0x6F,0x4D,0x59,0x7B,0x33,0x00 }, // ASCII - 83
{ 0x00,0x03,0x41,0x7F,0x7F,0x41,0x03,0x00 }, // ASCII - 84
{ 0x00,0x3F,0x7F,0x40,0x40,0x40,0x7F,0x3F }, // ASCII - 85
{ 0x00,0x03,0x0F,0x3D,0x70,0x1D,0x07,0x01 }, // ASCII - 86
{ 0x00,0x0F,0x7F,0x30,0x1C,0x30,0x7F,0x0F }, // ASCII - 87
{ 0x00,0x63,0x77,0x1C,0x1C,0x77,0x63,0x00 }, // ASCII - 88
{ 0x01,0x03,0x47,0x7C,0x78,0x47,0x03,0x01 }, // ASCII - 89
{ 0x00,0x67,0x73,0x59,0x4D,0x67,0x73,0x00 }, // ASCII - 90
{ 0x00,0x00,0x00,0x7F,0x7F,0x41,0x41,0x00 }, // ASCII - 91
{ 0x00,0x01,0x03,0x06,0x0C,0x18,0x30,0x60 }, // ASCII - 92
{ 0x00,0x00,0x41,0x41,0x7F,0x7F,0x00,0x00 }, // ASCII - 93
{ 0x00,0x00,0x04,0x06,0x03,0x06,0x04,0x00 }, // ASCII - 94
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, // ASCII - 95
{ 0x00,0x00,0x01,0x03,0x06,0x04,0x00,0x00 }, // ASCII - 96
{ 0x00,0x68,0x6C,0x54,0x54,0x3C,0x78,0x40 }, // ASCII - 97
{ 0x00,0x41,0x7F,0x3F,0x6C,0x44,0x7C,0x38 }, // ASCII - 98
{ 0x00,0x38,0x7C,0x44,0x44,0x6C,0x2C,0x00 }, // ASCII - 99
{ 0x00,0x38,0x7C,0x44,0x49,0x3F,0x7F,0x40 }, // ASCII - 100
{ 0x00,0x38,0x7C,0x54,0x54,0x5C,0x58,0x00 }, // ASCII - 101
{ 0x00,0x00,0x48,0x7E,0x7F,0x49,0x0B,0x02 }, // ASCII - 102
{ 0x00,0x48,0x7C,0x34,0x34,0x2C,0x68,0x44 }, // ASCII - 103
{ 0x00,0x41,0x7F,0x7F,0x08,0x04,0x7C,0x78 }, // ASCII - 104
{ 0x00,0x00,0x44,0x7D,0x7D,0x40,0x00,0x00 }, // ASCII - 105
{ 0x00,0x60,0x60,0x04,0x7D,0x7D,0x00,0x00 }, // ASCII - 106
{ 0x00,0x41,0x7F,0x7F,0x10,0x78,0x6C,0x44 }, // ASCII - 107
{ 0x00,0x00,0x41,0x7F,0x7F,0x40,0x00,0x00 }, // ASCII - 108
{ 0x00,0x7C,0x7C,0x0C,0x78,0x0C,0x7C,0x78 }, // ASCII - 109
{ 0x00,0x44,0x7C,0x7C,0x08,0x04,0x7C,0x78 }, // ASCII - 110
{ 0x00,0x38,0x7C,0x44,0x44,0x7C,0x38,0x00 }, // ASCII - 111
{ 0x00,0x04,0x7C,0x78,0x24,0x24,0x3C,0x18 }, // ASCII - 112
{ 0x00,0x18,0x3C,0x24,0x24,0x78,0x7C,0x00 }, // ASCII - 113
{ 0x00,0x44,0x7C,0x78,0x4C,0x04,0x1C,0x18 }, // ASCII - 114
{ 0x00,0x48,0x5C,0x5C,0x74,0x74,0x24,0x00 }, // ASCII - 115
{ 0x00,0x00,0x04,0x3E,0x7F,0x44,0x24,0x00 }, // ASCII - 116
{ 0x00,0x3C,0x7C,0x40,0x40,0x3C,0x7C,0x40 }, // ASCII - 117
{ 0x00,0x04,0x1C,0x3C,0x60,0x30,0x1C,0x04 }, // ASCII - 118
{ 0x00,0x1C,0x7C,0x30,0x1C,0x30,0x7C,0x1C }, // ASCII - 119
{ 0x00,0x44,0x6C,0x3C,0x10,0x78,0x6C,0x44 }, // ASCII - 120
{ 0x00,0x44,0x4C,0x1C,0x70,0x64,0x1C,0x0C }, // ASCII - 121
{ 0x00,0x4C,0x64,0x74,0x5C,0x4C,0x64,0x00 }, // ASCII - 122
{ 0x00,0x08,0x08,0x3E,0x77,0x41,0x41,0x00 }, // ASCII - 123
{ 0x00,0x00,0x00,0x7F,0x7F,0x00,0x00,0x00 }, // ASCII - 124
{ 0x00,0x41,0x41,0x77,0x3E,0x08,0x08,0x00 }, // ASCII - 125
{ 0x00,0x02,0x01,0x01,0x03,0x02,0x02,0x01 }, // ASCII - 126
{ 0x00,0x60,0x78,0x4E,0x47,0x5E,0x78,0x60 } // ASCII - 127
};
/************************************
*************************************/
void LCD_Init(void){
Delay1KTCYx(17); //Delay 85mS
LCD_Reset();
LCD_Send(0xA6,0); //Display: Normal
LCD_Send(0xA3,0); //LCD Bias Settings: 1/7
LCD_Send(0xA1,0); //ADC Selection: Reverse
LCD_Send(0xC0,0); //Common Output: Normal Direction
LCD_Send(0x22,0); //Set the V5 output Voltage
LCD_Send(0x81,0); //Set Electronic Volume Register
LCD_Send(0x2E,0); //Power Controller Set: Booster circuit: ON/Voltage regulator circuit: ON/Voltage follower circuit: OFF
LCD_Send(0x2F,0); //Power Controller Set: Voltage follower circuit: ON
LCD_Send(0xE3,0); //Non-OPeration Command
LCD_Send(0x40,0); //Set the start line
LCD_Send(0xAF,0); //LCD On
LCD_Send(0xA5,0); //Display All Points: ON
Delay1KTCYx(34); //Delay 170mS
LCD_Send(0xA4,0); //Display All Points: NORMAL
}
void CLS(void){
unsigned char x,i,q;
unsigned char line;
line = 0xB0;
for(q=0;q<9;q++){
LCD_Send(line,0);
LCD_Send(17,0);
LCD_Send(2,0);
for(i=0;i<0x60;i++){
LCD_Send(0x00,1);
}
line++;
}
}
void SendByte(unsigned char data){
char x;
for(x=0;x<8;x++){
SCL = 0;
SDO=0;
if((data & 0x80) > 0) SDO = 1;
SCL = 1;
data <<= 1;
}
}
void LCD_Send(unsigned char cmd, unsigned char type){
DC = type;
CS = 0;
SendByte(cmd);
CS = 1;
}
void LCD_Reset(void){
CS = 1;
Delay1KTCYx(17); //Delay 85mS
RST = 1;
Delay1KTCYx(17); //Delay 85mS
}
void LCDString(rom unsigned char *str, unsigned char myFont){
char x;
char y;
while(*str != 0){
y = *str++;
y -= 0x20;
for(x=0;x<8;x++){
if(myFont == 1)
LCD_Send(FontA[y][x],1);
if(myFont == 2)
LCD_Send(FontB[y][x],1);
}
}
}
void main(void){
OSCCON = 0x72; //8MHz clock
while(!OSCCONbits.IOFS); //wait for osc stable
LCDt = 0x00;
LCD_Init();
CLS();
LCD_Send(0xB0,0); //Page 0 (0xBx (x = page))
LCD_Send(0x11,0); //Column Upper Nybble (0x1x) (x = upper Nybble)
LCD_Send(0x02,0); //Column Lower Nybble (0x0x) (x = upper Nybble)
LCDString((rom unsigned char*)" AtomSoft",1);
LCD_Send(0xB2,0); //Page 1 (0xBx (x = page))
LCD_Send(0x11,0); //Column Upper Nybble (0x1x) (x = upper Nybble)
LCD_Send(0x02,0); //Column Lower Nybble (0x0x) (x = upper Nybble)
LCDString((rom unsigned char*)"New Tech.",1);
LCD_Send(0xB3,0); //Page 0 (0xBx (x = page))
LCD_Send(0x11,0); //Column Upper Nybble (0x1x) (x = upper Nybble)
LCD_Send(0x02,0); //Column Lower Nybble (0x0x) (x = upper Nybble)
LCDString((rom unsigned char*)" New World",1);
LCD_Send(0xB4,0); //Page 1 (0xBx (x = page))
LCD_Send(0x11,0); //Column Upper Nybble (0x1x) (x = upper Nybble)
LCD_Send(0x02,0); //Column Lower Nybble (0x0x) (x = upper Nybble)
LCDString((rom unsigned char*)" New You",1);
LCD_Send(0xB6,0); //Page 1 (0xBx (x = page))
LCD_Send(0x11,0); //Column Upper Nybble (0x1x) (x = upper Nybble)
LCD_Send(0x02,0); //Column Lower Nybble (0x0x) (x = upper Nybble)
LCDString((rom unsigned char*)" Thank You",1);
while(1){
}
}
The 2 images below are:
1: the above code running with 1 font
2: the above code using both fonts to compare differences
Schematic coming soon!
Attachments
Last edited: