CODE 1 and PHOTO 1 ..works and all 3 areas of the display work.
CODE 2 and PHOTO 2 ..not working...area 3 (far right) nothing is displayed.
I'd appreciate any suggestions.
CODE 1
Code: Select all
Device = 18F2525
Clock = 10 //external crystal
//Config OSC = INTIO67 // configure OSC for internal
// User options
#Option GLCD_MODEL = KS0108 // GLCD driver
#option GLCD_SCREEN_WIDTH = 192 // Screen Width in Pixels
#option GLCD_SCREEN_HEIGHT = 64 // Screen Height in Pixels
#Option GLCD_DATA = PORTB // data port
#Option GLCD_RS = PORTA.3 // RS pin
#Option GLCD_RW = PORTA.2 // RW pin
#Option GLCD_EN = PORTA.1 // EN pin
#Option GLCD_CS1 = PORTA.4 // chip select
#Option GLCD_CS2 = PORTA.5 // chip select
#Option GLCD_CS3 = PORTC.6 //chip select
#Option GLCD_RST = PORTA.0 // reset pin
#Option GLCD_ASPECT_RATIO = 100 // aspect ratio, smaller number will squeeze y for GLCD circles and box
#Option GLCD_INIT_DELAY = 50 // initialisation delay (ms)
//#Option GLCD_INVERT_CS = true // invert CS lines...
// Modules
Include "glcd.bas" // main GLCD module
Include "graphics.bas" // support for GLCD
Include "Bitmaps.bas" // support for GLCD
Include "utils.bas" // support to make all MCU pins Digital
Include "Arial.bas" // ArialFont for GLCD
// PORT setup and PLL Multiplier (set internal Osc to 32Mhz)
//TRISA = %00000000 //
//TRISB = %00000000 // Set all Ports output
//TRISC = %00000000 //
//OSCCON = %01111100 // Set up the internal oscillator for 8Mhz
//OSCCON = %01110000 // Set up the internal oscillator for 16mHz
//OSCTUNE.6 = 1 // Frequency Multiplier PLL for INTOSC Enable bit (Enabled)
SetAllDigital // set MCU pins as digital
// Demo pattern on GLCD
GLCD.Rectangle(0,0,191,63) // draws a rectangle on all corners of display (X,Y,X,Y)
GLCD.Line(6,6,20,60) // draws line (left of screen)
GLCD.Line(180,2,105,2) // draws line (top right of screen)
GLCD.Ellipse(40,32,20,30) // draws Ellipse
GLCD.Circle(160,32,20) // draws Circle
GLCD.SetFont(ArialBold) // set font BOLD
GLCD.WriteAt(80,25,"TEST 1 2 3 4")
GLCD.WriteAt(100,50,"TEST 1 2 3 4")
GLCD.SetImage(65,4,BatteryImage, cmXOR)
GLCD.SetImage(150,4,BtnOK, cmXOR)
GLCD.SetImage(120,35,BtnCancel, cmXOR)
Code: Select all
Device = 18F2525
Clock = 10 // external crystal
//Config OSC = INTIO67 // configure OSC for internal
// User options
#Option GLCD_MODEL = KS0108 // GLCD driver
#option GLCD_SCREEN_WIDTH = 192 // Screen Width in Pixels
#option GLCD_SCREEN_HEIGHT = 64 // Screen Height in Pixels
#Option GLCD_DATA = PORTB // data port
#Option GLCD_RS = PORTA.3 // RS pin
#Option GLCD_RW = PORTA.2 // RW pin
#Option GLCD_EN = PORTA.1 // EN pin
#Option GLCD_CS1 = PORTA.4 // chip select
#Option GLCD_CS2 = PORTA.5 // chip select
#Option GLCD_CS3 = PORTC.6 //chip select
#Option GLCD_RST = PORTA.0 // reset pin
#Option GLCD_ASPECT_RATIO = 100 // aspect ratio, smaller number will squeeze y for GLCD circles and box
#Option GLCD_INIT_DELAY = 50 // initialisation delay (ms)
//#Option GLCD_INVERT_CS = true // invert CS lines...
// Modules
Include "glcd.bas" // main GLCD module
Include "graphics.bas" // support for GLCD
Include "Bitmaps.bas" // support for GLCD
Include "utils.bas" // support to make all MCU pins Digital
Include "Arial.bas" // Arial font for GLCD
Include "FixedFont.bas" // Fixed font for GLCD
Include "Garamond.bas" // Garamond font for GLCD
Include "Tahoma.bas" // Tahoma font for GLCD
Include "Verdana.bas" // Verdanal font for GLCD
Include "Times.bas" // Times font for GLCD
Include "DS1307.bas"
Include "convert.bas"
Include "ISRRX.bas"
Include "usart.bas"
Include "math.bas"
Dim location As Byte
Dim msgb0 As Byte
Dim msgb1 As Byte
Dim w As Word
Dim fwdpwr As Byte
Dim revpwr As Byte
Dim vswr As Byte
Dim vswr1 As Byte
Dim vswr2 As Byte
// PORT setup and PLL Multiplier (set internal Osc to 32Mhz)
//TRISA = %00000000 //
//TRISB = %00000000 // Set all Ports output
//TRISC = %00000000 //
//OSCCON = %01111100 // Set up the internal oscillator for 8Mhz
//OSCCON = %01110000 // Set up the internal oscillator for 16mHz
//OSCTUNE.6 = 1 // Frequency Multiplier PLL for INTOSC Enable bit (Enabled)
ADCON1 = $07 // PORTE as digital (GLCD)
SetAllDigital()
//SetAllDigital // ?? set MCU pins as digital
GLCD.Cls
GLCD.SetFont(ArialBold) // set font BOLD
GLCD.Rectangle(0,0,191,63) //good..set to maximum size
USART.SetBaudrate(br19200)
ISRRX.Initialize()
While (true)
// check for usart overrun. it'll stop data if not cleared
If (ISRRX.Overrun) Then
ISRRX.Reset()
EndIf
// to receive a message from the PICAXE you must always read three bytes
// get first byte (location index)
While (ISRRX.DataAvailable = false)
End While
location = ISRRX.ReadByte()
// get second byte - lowbyte of parameter (LSB)
While (ISRRX.DataAvailable = false)
End While
msgb0 = ISRRX.ReadByte()
// get third byte - highbyte of parameter (MSB)
While (ISRRX.DataAvailable = false)
End While
msgb1 = ISRRX.ReadByte()
Select (location)
Case 23 //hserout 0,(23,"PT")
GLCD.WriteAt(5, 5, msgb0, msgb1)
Case 24 //hserout 0,(24,"T ")
GLCD.WriteAt(20, 5, msgb0, msgb1)
Case 25 //hserout 0,(25," E")
GLCD.WriteAt(35, 5, msgb0, msgb1)
Case 26 //hserout 0,(26,"RR")
GLCD.WriteAt(50, 5, msgb0, msgb1)
Case 17 //hserout 0,(17,Statusb0,Statusb1)
GLCD.WriteAt(5, 15, DecToStr(msgb0), DecToStr(msgb1))
Case 18 //hserout 0,(18,FWDPWRb0,FWDPWRb1)
GLCD.WriteAt(5, 25, "FWD PWR = ",DecToStr(msgb0))
fwdpwr=msgb0
Case 19 //hserout 0,(19,REVPWRb0,REVPWRb1)
GLCD.WriteAt(5, 35, "REV PWR = ",DecToStr(msgb0))
revpwr=msgb0
vswr1=1+sqrt(fwdpwr/revpwr)
vswr2=1-sqrt(fwdpwr/revpwr)
vswr=vswr1/vswr2
GLCD.WriteAt(100,5,DecToStr(vswr))
Case 20 //hserout 0,(20,TEMPb0,Tempb1)
GLCD.WriteAt(5, 45, "TEMP = ",DecToStr(msgb0/2))
Case 21 //hserout 0,(21,VOLTAGEb0,VOLTAGEb1)
GLCD.WriteAt(100,5,"Case 21 = ",DecToStr(msgb0), DecToStr(msgb1))
Case 22 //hserout 0,(22,CURRENTb0,CURRENTb1)
GLCD.WriteAt(100,20, "Case 22 = ",DecToStr(msgb0), DecToStr(msgb1))
Else // parameter is binary data...
// write data as two bytes (LSB, MSB)
GLCD.WriteAt(100,35, "ELSE 2 bytes= ",DecToStr(msgb0), ", ", DecToStr(msgb1))
// or write data as a single 16-bit value
w.byte1 = msgb1
w.byte0 = msgb0
GLCD.WriteAt(100,50, "ELSE 16-bit value = ", DecToStr(w))
End Select
End While