My problem is that while I can see the basis of letters and lines the horizontal spacing seems to be out of whack. I get proper (good) vertical stacked pixels forming the edge of boxes but the gap between the edges is just evenly spaced single pixels, which look like they are 7 pixels apart or perhaps 8. Letters which involve diagonal lines are spotty with pixels missing, lines using the lines command also are just a series of widely spaced out (I think I could be going that way too) dots. The fact the pixels are in the right place leads to think data lines are ok and because it actually displays what I expect then the control lines are ok. Both PIC and display are running from 5V.
My thoughts are that the X spacing is using the byte character spacing but I’ve been going around in circles. I’ve checked the S1D13700 initialization codes against the data sheet and can’t see any problem, I changed the display and the PIC, and although the PIC is mounted on my own prototype PCB I have buzzed the connections out through to the S1D13700 chip on the display. The code I’m using now is basically taken from several forum responses, graphics program and PIC configuration.
Any ideas welcome! Any Help most welcome!
The code has several alternative attempts commented out, e.g. I was using an external crystal but the 8MHz internal solved a problem where everything was 'shadowed' but I did try 32MHz via PLL but had the same shadowing problem just not so bad.
Code: Select all
Device=18F4520
//Clock=25 //Crystal on pins 13 &14
Clock = 25 //temp try internal osc
Config osc = hs,//intio67, //Internal Oscillator with I/O on RA6 and RA7 or osc=HS
DEBUG=OFF, //Background debugger disabled, RB6 and RB7 configured as general purpose I/O pins
mclre = OFF, //RE3 input pin enabled; MCLR disabled
FCMEN=OFF, //Fail-Safe Clock Monitor disabled
IESO=OFF, //Oscillator Switchover mode disabled
PWRT=ON, //Power-up Timer disabled
BOREN=OFF, //Brown-out Reset disabled in hardware and software
BORV=0, //Brown-out Reset Voltage Maximum setting
WDT=OFF, //WatchDog Timer disabled
WDTPS = 128, // 1:1 Watchdog Timer Postscale
LPT1OSC=OFF, //Timer1 configured for high power operation
PBADEN=OFF, //POR set portb to digital I/O
STVREN=OFF, //Stack full/underflow will not cause Reset
LVP=OFF, //don't use low voltage programming
XINST=OFF, //don't use extended instruction set
CCP2MX=PORTC //use CCP2 on PORTc
//====user settings to override default module options ====
#option GLCD_MODEL = S1D13700 //Controller mounted on display
#option GLCD_MODEL = 6800 //hardware default M6800 Indirect CNF<3:2>
#option GLCD_DATA = PORTB // Data port - only 8 bit port
#option GLCD_RES = PORTC.7 // reset pin
#option GLCD_EN = PORTD.5 // EN pin - 6800 mode
#option GLCD_RD = PORTD.5 // RD pin - 8080 mode
#option GLCD_RW = PORTD.6 // RW pin - 6800 mode
#option GLCD_WR = PORTD.6 // WR pin - 8080 mode
#option GLCD_A0 = PORTD.7 // A0 pin
#option GLCD_CS = PORTD.4 // chip select
#option GLCD_TCR = $2C // TC/R setting to fix flicker problem on display override system instruction ($48)
#option GLCD_ASPECT_RATIO = 100 // aspect ratio, smaller number will squeeze y For GLCD circles And Boxes
#option GLCD_INIT_DELAY = 100 // initialisation delay (ms)
Include "s1d13700.bas"
Include "GLCD.bas"
Include "Graphics.bas"
Include "Bitmaps.bas"
Include "Arial.bas"
Include "Convert.bas"
//Include "SansSerif.bas"
//Include "TouchScreen.BAS"
//Include "SPI.bas"
//Include "Utils.bas"
//Include "String.bas"
//Include "SDFileSystem.bas"
Dim cindex,yindex,i As Byte
//================Main Program ===================
//OSCCON.6 = 1 // Set Internal OSC to 8Mhz
//OSCCON.5 = 1 // "
//OSCCON.4 = 1 // "
OSCTUNE.6 = 0 // Turn off/on PLL
// temp - LED 5 flashes before writting to screen
High(PORTB.4)
For cindex=1 To 5
Toggle(PORTB.4)
DelayMS(250)
Toggle(PORTB.4)
DelayMS(250)
Next
//To write black text (Pen.Color = 1)
//To write white background (Brush.Color = 0)
Cls(1)
Pen.Color = 1
Brush.Color =0
Pen.Mode = 0 // pen modes, pmCopy = 0, pmMerge = 1, pmXOR = 2,
Brush.Style = 0 //1=bsClear 0=bsSolid
SetFont(Arial)
//SetFont(SansSerif)
SetPixel(20, 20)
SetPixel(20, 21)
SetPixel(20, 22)
SetPixel(20, 23)
SetPixel(20, 24)
MoveTo(28,28)
LineTo(210,28)
WriteAt(33,100,"A1--------A2........A3--------A4........A5////////A6")
WriteStr(47,60,"A1B2C3")
Square(50,150,60)
Rectangle(120, 100, 250, 180)