Sample code for LCD COG (Chip On Glass) NHD-C12864MZ; NHD-C12864WM with SPLC501C.
'//--------------------------------------------------------- '/* 'NHD-C12864MZ.bas 'Program for writing a picture to Newhaven Display Graphic COG with SPLC501C ' '(c)2008 Newhaven Display International, Inc. ' ' This program is free software; you can redistribute it and/or modify ' it under the terms of the GNU General Public License as published by ' the Free Software Foundation; either version 2 of the License, or ' (at your option) any later version. ' ' This program is distributed in the hope that it will be useful, ' but WITHOUT ANY WARRANTY; without even the implied warranty of ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ' GNU General Public License for more details. ' 'Symbol Port 'DB0-DB7 P1 'CS2 P3.6 'CS1 P3.1 'RST P3.2 'R/W P3.7 'D/I P3.0 'E P3.4 '------------------------------------------------------------------------------- $large Dim A As Byte Dim Count As Byte Dim Counthi As Byte Dim Page As Byte Dim Cleardata1 As Byte Dim Cleardata2 As Byte Declare Sub Writedata Declare Sub Writecom Declare Sub Init Declare Sub Clear Declare Sub Picture '------------------------------------------------------------------------------- Do Call Init Call Clear Call Picture Wait 5 Loop End '------------------------------------------------------------------------------- Sub Init Set P3.0 Set P3.1 Reset P3.4 Set P3.3 'reset Reset P3.3 Waitms 2 Set P3.3 Waitms 20 A = &HA2 '1/9 BIAS Call Writecom A = &HA0 'ADC SELECT , NORMAL Call Writecom A = &HC8 'COM OUTPUT REVERSE Call Writecom A = &HA4 'DISPLAY ALL POINTS NORMAL Call Writecom A = &H40 'DISPLAY START LINE SET Call Writecom A = &H25 'INTERNAL RESISTOR RATIO Call Writecom A = &H81 'ELECTRONIC VOLUME MODE SET Call Writecom A = &H10 'ELECTRONIC VOLUME Call Writecom A = &H2F 'POWER CONTROLLER SET Call Writecom A = &HAF 'DISPLAY ON Call Writecom End Sub '------------------------------------------------------------------------------- Sub Picture Restore Pic1 Page = &HB0 For Counthi = 1 To 8 A = Page Call Writecom A = &H00 Call Writecom A = &H10 Call Writecom For Count = 1 To 128 Read A Call Writedata Next Count Incr Page Next Counthi '------------------------------------------------------------------------------- Sub Clear Page = &HB0 For Counthi = 1 To 8 A = Page Call Writecom A = &H00 Call Writecom A = &H10 Call Writecom A = &H00 For Count = 1 To 128 Call Writedata Next Count Incr Page Next Counthi End Sub '------------------------------------------------------------------------------- Sub Writecom Reset P3.2 'A0 Reset P3.1 'R/W Reset P3.4 'CS1 Set P3.0 'E P1 = A Reset P3.0 Set P3.4 End Sub Sub Writedata Set P3.2 Reset P3.1 Reset P3.4 Set P3.0 P1 = A Reset P3.0 Set P3.4 End Sub '------------------------------------------------------------------------------- Pic1: Data &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF, Data &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF, Data &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF, Data &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF, Data &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF, Data &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF, Data &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF, Data &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF, Data &HFF , &HFF , &HFF , &HFF , &HFF , &H00 , &H00 , &HF1 , &HE3 , &H8F , &H1F , &H7F , &HFF , &H00 , &H00 , &HFF, Data &HFF , &H00 , &H00 , &H9C , &H9C , &H9C , &H9C , &H9C , &H9C , &H9C , &HFF , &HFC , &HE0 , &H01 , &H1F , &HFF, Data &H07 , &H00 , &HF8 , &H00 , &H07 , &HFF , &H1F , &H03 , &HE0 , &HFC , &HFF , &H00 , &H00 , &H9F , &H9F , &H9F, Data &H9F , &H9F , &H9F , &H00 , &H00 , &HFF , &HFF , &HFF , &H1F , &H03 , &H60 , &H7C , &H60 , &H03 , &H1F , &HFF, Data &HFF , &HFC , &HF0 , &H83 , &H0F , &H7F , &HFF , &H7F , &H0F , &H83 , &HF0 , &HFC , &HFF , &H00 , &H00 , &H9C, Data &H9C , &H9C , &H9C , &H9C , &H9C , &H9C , &HFF , &HFF , &H00 , &H00 , &HF1 , &HE3 , &H8F , &H1F , &H7F , &HFF, Data &H00 , &H00 , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF, Data &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF, Data &HFF , &HFF , &HFF , &HFF , &HFF , &HF0 , &HF0 , &HFF , &HFF , &HFF , &HFF , &HFC , &HF8 , &HF0 , &HF0 , &HFF, Data &HFF , &HF0 , &HF0 , &HF3 , &HF3 , &HF3 , &HF3 , &HF3 , &HF3 , &HF3 , &HFF , &HFF , &HFF , &HFF , &HF0 , &HF0, Data &HF0 , &HFF , &HFF , &HFF , &HF0 , &HF0 , &HF0 , &HFE , &HFF , &HFF , &HFF , &HF0 , &HF0 , &HFF , &HFF , &HFF, Data &HFF , &HFF , &HFF , &HF0 , &HF0 , &HFF , &HF7 , &HF0 , &HF8 , &HFE , &HFE , &HFE , &HFE , &HFE , &HF8 , &HF0, Data &HF7 , &HFF , &HFF , &HFF , &HFE , &HF0 , &HF1 , &HF0 , &HFE , &HFF , &HFF , &HFF , &HFF , &HF0 , &HF0 , &HF3, Data &HF3 , &HF3 , &HF3 , &HF3 , &HF3 , &HF3 , &HFF , &HFF , &HF0 , &HF0 , &HFF , &HFF , &HFF , &HFF , &HFC , &HF8, Data &HF0 , &HF0 , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF, Data &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF, Data &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF, Data &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF, Data &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF, Data &HFF , &HFF , &H07 , &H07 , &HE7 , &HE7 , &HE7 , &HE7 , &HE7 , &HCF , &H0F , &H3F , &HFF , &HFF , &H07 , &H07, Data &HFF , &HFF , &H1F , &H0F , &H67 , &H67 , &HE7 , &HE7 , &HC7 , &H8F , &H9F , &HFF , &HFF , &H07 , &H07 , &HE7, Data &HE7 , &HE7 , &HE7 , &H47 , &H0F , &H1F , &HFF , &HFF , &H07 , &H07 , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF, Data &HFF , &HFF , &HFF , &HFF , &H1F , &H07 , &HE7 , &H07 , &H1F , &HFF , &HFF , &HFF , &HE7 , &HC7 , &H0F , &H3F, Data &HFF , &HFF , &H3F , &H0F , &HC7 , &HE7 , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF, Data &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF, Data &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF, Data &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF, Data &HFF , &HFF , &H80 , &H80 , &H9F , &H9F , &H9F , &H9F , &H9F , &HCF , &HC0 , &HF0 , &HFF , &HFF , &H80 , &H80, Data &HFF , &HFF , &HE7 , &HC6 , &H8E , &H9C , &H9C , &H9C , &H88 , &HC1 , &HE3 , &HFF , &HFF , &H80 , &H80 , &HFC, Data &HFC , &HFC , &HFC , &HFC , &HFE , &HFF , &HFF , &HFF , &H80 , &H80 , &H9F , &H9F , &H9F , &H9F , &H9F , &H9F, Data &HFF , &HBF , &H87 , &HC0 , &HF0 , &HF3 , &HF3 , &HF3 , &HF0 , &HC0 , &H87 , &HBF , &HFF , &HFF , &HFF , &HFE, Data &H80 , &H80 , &HFE , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF, Data &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF, Data &H7F , &H7F , &HFF , &H7F , &H7F , &HFF , &HFF , &HFF , &H7F , &H7F , &HFF , &H7F , &H7F , &H7F , &H7F , &H7F, Data &H7F , &HFF , &H7F , &H7F , &H7F , &H7F , &H7F , &H7F , &HFF , &H7F , &H7F , &H7F , &H7F , &H7F , &H7F , &HFF, Data &HFF , &H7F , &H7F , &HFF , &HFF , &HFF , &H7F , &H7F , &HFF , &HFF , &HFF , &H7F , &H7F , &H7F , &HFF , &HFF, Data &HFF , &H7F , &H7F , &H7F , &H7F , &H7F , &H7F , &HFF , &H7F , &H7F , &HFF , &HFF , &HFF , &H7F , &H7F , &H7F, Data &H7F , &HFF , &HFF , &HFF , &H7F , &H7F , &HFF , &HFF , &HFF , &H7F , &H7F , &HFF , &HFF , &HFF , &H7F , &H7F, Data &H7F , &HFF , &HFF , &HFF , &H7F , &H7F , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF, Data &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF, Data &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF, Data &H00 , &H00 , &HFF , &H00 , &H00 , &HF8 , &HE3 , &H8F , &H00 , &H00 , &HFF , &HFF , &HFF , &H00 , &H00 , &HFF, Data &HFF , &HFF , &H00 , &H00 , &H77 , &H77 , &H77 , &H77 , &HFF , &H00 , &H00 , &HF7 , &HF7 , &HE7 , &H80 , &H18, Data &H7F , &H00 , &H00 , &HF8 , &HE3 , &H8F , &H00 , &H00 , &HFF , &H1F , &H01 , &HC0 , &HDE , &HC0 , &H01 , &H1F, Data &HFF , &HFF , &HFF , &H00 , &H00 , &HFF , &HFF , &HFF , &H00 , &H00 , &HFF , &HC1 , &H80 , &H3E , &H7F , &H7F, Data &H3E , &H80 , &HC1 , &HFF , &H00 , &H00 , &HF8 , &HE3 , &H8F , &H00 , &H00 , &HFF , &H1F , &H01 , &HC0 , &HDE, Data &HC0 , &H01 , &H1F , &HFF , &H00 , &H00 , &H7F , &H7F , &H7F , &H7F , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF, Data &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF, Data &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF, Data &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF, Data &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF, Data &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF, Data &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF, Data &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF, Data &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF, Data &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF , &HFF,