Nothing displays on glcd

Discuss PIC and electronic related things

Moderators: David Barker, Jerry Messina

Post Reply
hgboy
Posts: 25
Joined: Wed Aug 13, 2008 9:35 pm
Location: Dayton, OH

Nothing displays on glcd

Post by hgboy » Tue Feb 17, 2009 11:13 pm

I cannot get anything to display on my glcd (t6963c controller), and don't know if it is a code problem, or a connection issue. I believe all of my connections are correct, but I may be wrong. Here is the code, and is there any way to verify that the lcd is working properly with a multimeter or something?

Code: Select all

{
*****************************************************************************
*  Name    : FUELGAUGE.BAS                                                 *
*  Author  : Austin Cole                                                    *
*  Notice  : Copyright (c) 2009 Austin Cole                                 *
*          : All Rights Reserved                                            *
*  Date    : 1/29/2009                                                     *
*  Version : 1.0                                                            *
*  Notes   : Center module for XR4Ti gauge cluster project.  Displays       *
*          : Fuel level, Temperature level, and Turbo boost pressure as     *
*          : Bargraph style gauges. Also displays numerical readout for     *
*          : turbo boost levels.  XR4Ti logo is displayed in the center.    *
*          : Project utilizes PIC18F4550 processor and 128x64 GLCD with     *
*          : Toshiba T6963C controller.                                     *
*****************************************************************************
}
Program FUELGAUGE

Device = 18F4550
Clock = 20
Config FOSC = INTOSCIO_EC

#option GLCD_MODEL = T6963c   '<<<********* Select Toshiba driver

#option GLCD_DATA = PORTD        // data port
#option GLCD_CE  = PORTC.3        // chip Enable
#option GLCD_RD  = PORTC.5        // RD pin
#option GLCD_RW  = PORTC.4        // RW pin 
#option GLCD_CD  = PORTC.6        // Command/Data   High=Cmd , Low=Data
#option GLCD_RST = PORTC.7       // reset pin


Include "INTOSC8.bas"
Include "utils.bas"
Include "Graphics.bas"
Include "GLCD.bas"
Include "ADC.bas"
Include "Arial.bas"
Include "convert.bas"
Include "T6963c.bas"

//Variables to hold ADC values for fuel, temperature, and boost

Dim XValue As Word
Dim Y1Value As Word
Dim Y2Value As Word


 
//Reads ADC value for the fuel level on channel 0
Function GetFuelValue() As Word
    result = ADC.Read(0)
End Function

//Reads ADC value for the temperature level on channel 0
Function GetTempValue() As Word
    result = ADC.Read(1)
End Function

//Reads ADC value for the boost level on channel 0
Function GetBoostValue() As Word
    result = ADC.Read(2)
End Function

//Calculates YValue based on Fuel ADC result
Function GetY1Value(pValue As Word) As Word
    result = pValue
    Select result
    Case   = 0 Y1Value = 57
    Case   > 0 Y1Value = 56
    Case   > 20 Y1Value = 55
    Case   > 40 Y1Value = 54
    Case   > 60 Y1Value = 53
    Case   > 80 Y1Value = 52
    Case   > 100 Y1Value = 51
    Case   > 120 Y1Value = 50
    Case   > 140 Y1Value = 49
    Case   > 160 Y1Value = 48
    Case   > 180 Y1Value = 47
    Case   > 200 Y1Value = 46
    Case   > 220 Y1Value = 45
    Case   > 240 Y1Value = 44
    Case   > 260 Y1Value = 43
    Case   > 280 Y1Value = 42
    Case   > 300 Y1Value = 41
    Case   > 320 Y1Value = 40
    Case   > 340 Y1Value = 39
    Case   > 360 Y1Value = 38
    Case   > 380 Y1Value = 37
    Case   > 400 Y1Value = 36
    Case   > 420 Y1Value = 35
    Case   > 440 Y1Value = 34
    Case   > 460 Y1Value = 33
    Case   > 480 Y1Value = 32
    Case   > 500 Y1Value = 31
    Case   > 520 Y1Value = 30
    Case   > 540 Y1Value = 29
    Case   > 560 Y1Value = 28
    Case   > 580 Y1Value = 27
    Case   > 600 Y1Value = 26
    Case   > 620 Y1Value = 25
    Case   > 640 Y1Value = 24
    Case   > 660 Y1Value = 23
    Case   > 680 Y1Value = 22
    Case   > 700 Y1Value = 21
    Case   > 720 Y1Value = 20
    Case   > 740 Y1Value = 19
    Case   > 760 Y1Value = 18
    Case   > 780 Y1Value = 17
    Case   > 800 Y1Value = 16
    Case   > 820 Y1Value = 15
    Case   > 840 Y1Value = 14
    Case   > 860 Y1Value = 13
    Case   > 880 Y1Value = 12
    Case   > 900 Y1Value = 11
    Case   > 920 Y1Value = 10
    Case   > 940 Y1Value = 9
    Case   > 960 Y1Value = 8
    Case   > 980 Y1Value = 7
    Case   > 1000 Y1Value =6
    Case   > 1020 Y1Value = 5
    EndSelect
End Function

//Calculates YValue based on Temperature ADC result
Function GetY2Value(pValue As Word) As Word
result = pValue
    Select result
    Case   = 0 Y2Value = 57
    Case   > 0 Y2Value = 56
    Case   > 20 Y2Value = 55
    Case   > 40 Y2Value = 54
    Case   > 60 Y2Value = 53
    Case   > 80 Y2Value = 52
    Case   > 100 Y2Value = 51
    Case   > 120 Y2Value = 50
    Case   > 140 Y2Value = 49
    Case   > 160 Y2Value = 48
    Case   > 180 Y2Value = 47
    Case   > 200 Y2Value = 46
    Case   > 220 Y2Value = 45
    Case   > 240 Y2Value = 44
    Case   > 260 Y2Value = 43
    Case   > 280 Y2Value = 42
    Case   > 300 Y2Value = 41
    Case   > 320 Y2Value = 40
    Case   > 340 Y2Value = 39
    Case   > 360 Y2Value = 38
    Case   > 380 Y2Value = 37
    Case   > 400 Y2Value = 36
    Case   > 420 Y2Value = 35
    Case   > 440 Y2Value = 34
    Case   > 460 Y2Value = 33
    Case   > 480 Y2Value = 32
    Case   > 500 Y2Value = 31
    Case   > 520 Y2Value = 30
    Case   > 540 Y2Value = 29
    Case   > 560 Y2Value = 28
    Case   > 580 Y2Value = 27
    Case   > 600 Y2Value = 26
    Case   > 620 Y2Value = 25
    Case   > 640 Y2Value = 24
    Case   > 660 Y2Value = 23
    Case   > 680 Y2Value = 22
    Case   > 700 Y2Value = 21
    Case   > 720 Y2Value = 20
    Case   > 740 Y2Value = 19
    Case   > 760 Y2Value = 18
    Case   > 780 Y2Value = 17
    Case   > 800 Y2Value = 16
    Case   > 820 Y2Value = 15
    Case   > 840 Y2Value = 14
    Case   > 860 Y2Value = 13
    Case   > 880 Y2Value = 12
    Case   > 900 Y2Value = 11
    Case   > 920 Y2Value = 10
    Case   > 940 Y2Value = 9
    Case   > 960 Y2Value = 8
    Case   > 980 Y2Value = 7
    Case   > 1000 Y2Value =6
    Case   > 1020 Y2Value = 5
    EndSelect
End Function

//Calculates XValue based on Boost ADC result
Function GetXValue(pValue As Word) As Word
result = pValue
    Select result
    Case   = 0 XValue = 37
    Case   > 0 XValue = 38
    Case   > 20 XValue = 39
    Case   > 40 XValue = 40
    Case   > 60 XValue = 41
    Case   > 80 XValue = 42
    Case   > 100 XValue = 43
    Case   > 120 XValue = 44
    Case   > 140 XValue = 45
    Case   > 160 XValue = 46
    Case   > 180 XValue = 47
    Case   > 200 XValue = 48
    Case   > 220 XValue = 49
    Case   > 240 XValue = 50
    Case   > 260 XValue = 51
    Case   > 280 XValue = 52
    Case   > 300 XValue = 53
    Case   > 320 XValue = 54
    Case   > 340 XValue = 55
    Case   > 360 XValue = 56
    Case   > 380 XValue = 57
    Case   > 400 XValue = 58
    Case   > 420 XValue = 59
    Case   > 440 XValue = 60
    Case   > 460 XValue = 61
    Case   > 480 XValue = 62
    Case   > 500 XValue = 63
    Case   > 520 XValue = 64
    Case   > 540 XValue = 65
    Case   > 560 XValue = 66
    Case   > 580 XValue = 67
    Case   > 600 XValue = 68
    Case   > 620 XValue = 69
    Case   > 640 XValue = 70
    Case   > 660 XValue = 71
    Case   > 680 XValue = 72
    Case   > 700 XValue = 73
    Case   > 720 XValue = 74
    Case   > 740 XValue = 75
    Case   > 760 XValue = 76
    Case   > 780 XValue = 77
    Case   > 800 XValue = 78
    Case   > 820 XValue = 79
    Case   > 840 XValue = 80
    Case   > 860 XValue = 81
    Case   > 880 XValue = 82
    Case   > 900 XValue = 83
    Case   > 920 XValue = 84
    Case   > 940 XValue = 85
    Case   > 960 XValue = 86
    Case   > 980 XValue = 87
    Case   > 1000 XValue = 88
    Case   > 1020 XValue = 89
    EndSelect
End Function
 


//Start of program
SetAllDigital()

//Small delay for GLCD warmup
DelayMS(150)

//Clear GLCD
GLCD.Cls	

//input(portA.0)
//input(porta.1)
//input(porta.2)
//Display "background" bitmap image here
//GLCD.SetImage(0,0)
//Use lines, etc to draw backgraound image until setimage function is implemented

GLCD.Rectangle(0,0,127,63)
GLCD.Rectangle(1,1,126,62)  //Outside border

GLCD.Rectangle(4,3,15,59)//Fuel gauge main border
GLCD.Line(14,10,15,10)
GLCD.Line(14,17,15,17)
GLCD.Line(14,24,15,24)
GLCD.Line(14,31,15,31)
GLCD.Line(14,38,15,38)
GLCD.Line(14,45,15,45)
GLCD.Line(14,52,15,52) //Fuel gauge division marks

GLCD.Rectangle(35,47,91,58)//Boost gauge main border
GLCD.Line(42,47,42,48)
GLCD.Line(49,47,49,48)
GLCD.Line(56,47,56,48)
GLCD.Line(63,47,63,48)
GLCD.Line(70,47,70,48)
GLCD.Line(77,47,77,48)
GLCD.Line(84,47,84,48)//Boost gauge division marks  

GLCD.Rectangle(112,3,123,59)//Temperature gauge main border
GLCD.Line(112,10,113,10)
GLCD.Line(112,17,113,17)
GLCD.Line(112,24,113,24)
GLCD.Line(112,31,113,31)
GLCD.Line(112,38,113,38)
GLCD.Line(112,45,113,45)
GLCD.Line(112,52,113,52) //temperature gauge division marks

GLCD.Rectangle(30,10,96,28)//Center logo outline
//X
Line(32,12,35,12)
Line(33,13,35,13)
Line(34,14,36,14)
Line(35,15,36,15)
Line(36,16,37,16)
Line(37,17,38,17) //Upper left portion
Line(43,12,46,12)
Line(43,13,45,13)
Line(42,14,44,14)
Line(42,15,43,15)
Line(41,16,42,16)
Line(40,17,41,17) //upper right portion
Line(37,21,38,21)
Line(36,22,37,22)
Line(35,23,36,23)
Line(34,24,36,24)
Line(33,25,35,25)
Line(32,36,35,26) //lower left portion
Line(40,21,41,21)
Line(41,22,42,22)
Line(42,23,43,23)
Line(42,24,44,24)
Line(43,25,45,25)
Line(43,26,46,26)  //lower right portion
Line(38,18,40,18)
Line(39,19,39,19)
Line(38,20,40,20)  //center portion
//R
Line(48,12,48,26)
Line(49,12,49,26)
Line(50,12,50,26)
Line(51,12,58,12)
Line(51,13,60,13)
Line(58,14,61,14)
Line(60,15,62,15)
Line(61,16,62,16)
Line(61,17,62,17)
Line(60,18,62,18)
Line(51,19,61,19)
Line(51,20,60,20)
Line(54,21,57,21)
Line(55,22,58,22)
Line(56,23,59,23)
Line(57,24,60,24)
Line(58,25,61,25)
Line(59,26,62,26)
//4
Line(76,12,76,26)
Line(77,12,77,26)
Line(78,12,78,26)
Line(66,21,75,21)
Line(66,22,75,22)
Line(66,21,75,12)
//T
Line(80,12,94,12)
Line(80,13,81,13)
Line(80,14,80,14)
Line(93,13,94,13)
Line(94,14,94,14)
Line(86,13,86,25)
Line(87,13,87,25)
Line(88,13,88,25)
Line(85,26,89,26)
//i
Line(92,18,93,18)
Line(92,19,93,19)
Line(92,21,92,26)
Line(93,21,93,26)
Line(94,26,94,26)

//Display text markers for Gauges
GLCD.SetFont(ArialBold)
GLCD.WriteAt(18,12,"F")
GLCD.WriteAt(18,54,"E")
GLCD.WriteAt(104,12,"H")
GLCD.WriteAt(104,54,"C")
GLCD.WriteAt(40,45,"PSI:")

//Main program loop
While(true)

    //ADC read functions take place here
    GetY1Value(GetFuelValue())
    GetY2Value(GetTempValue())
    GetXValue(GetBoostValue())
    
    //Draw rectangles based on ADC results
    
    //Fuel gauge rectangle
    Rectangle(6,57,12,Y1Value)
    
    //Temperature Gauge rectangle
    Rectangle(115,57,121,Y2Value)
    
    //Boost Gauge rectangle
    Rectangle(37,56,XValue,50)

    //Small delay
    DelayMS(50)
    
Wend 

End

Francis
Registered User
Registered User
Posts: 314
Joined: Sun Mar 25, 2007 9:40 am
Location: Devon

Post by Francis » Sat Mar 07, 2009 2:26 pm

Have you made sure you have connected the LCD voltage correctly?
On my GLCD the pin is marked 'Vo' and , on mine, needs a genuine -ve voltage. Try a reversed 6V battery via a resistor connected to the pot circuit usually shown in the Data Sheet.
I ended up having to use a 7660 chip to invert my positive supply.

hgboy
Posts: 25
Joined: Wed Aug 13, 2008 9:35 pm
Location: Dayton, OH

Post by hgboy » Wed Mar 11, 2009 10:19 pm

I got it figured out. Like i was afraid of, i damaged the connector and had to replace the lcd. Works fine now.

Post Reply