View previous topic :: View next topic |
Author |
Message |
vinay
Joined: 30 Sep 2012 Posts: 7
|
Help with glcd_text57() function in GLCD.c |
Posted: Mon Oct 01, 2012 2:52 am |
|
|
I am using glcd_text57() function to display text on an 128X64 Ampire GLCD(ks1080 based), but some of the pixels are missing. I have attached the driver program(I have made changes to CS1 and CS2 as active low in the driver) and the main() function that I am using, also I have attached a screenshot of the output I am getting.
compiler version 4.114
Pls suggest any corrections to get proper output.
Code: | /////////////////////////////////////////////////////////////////////////
//// GLCD.C ////
//// ////
void glcd_writeByte(char chip, BYTE data)
{
if(chip == GLCD_CS1) // Choose which chip to write to
output_low(GLCD_CS1);
else
output_low(GLCD_CS2);
.
.
.
output_high(GLCD_CS1); // Reset the chip select lines
output_high(GLCD_CS2);
}
// Purpose: Reads a byte of data from the specified chip
// Ouputs: A byte of data read from the chip
BYTE glcd_readByte(BYTE chip)
{
BYTE data; // Stores the data read from the LCD
if(chip == GLCD_CS1) // Choose which chip to read from
output_low(GLCD_CS1);
else
output_low(GLCD_CS2);
.
.
.
output_high(GLCD_CS1); // Reset the chip select lines
output_high(GLCD_CS2);
return data; // Return the read data
}
|
+++++++++++++++++++
Most glcd.c driver code removed. Only changes left.
Reason: Forum rule #10
10. Don't post the CCS example code or drivers
- Forum Moderator
+++++++++++++++++++
[/img]
Code: | char hello[]={"HELLO!"};
void main()
{
glcd_init(ON);
delay_ms(500);
glcd_text57(0,0,hello,2,ON);
} |
|
|
|
Markdem
Joined: 24 Jun 2005 Posts: 206
|
|
Posted: Mon Oct 01, 2012 6:35 pm |
|
|
We need to see the rest of the code in main, but I bet this will have something to do with the oscillator set at a speed above 20Mhz or Proteus doing something stupid with timings.
Try to run the pic at 20Mhz or change the delays in glcd_writeByte to a higher number and see how you go.
Have Fun |
|
|
vinay
Joined: 30 Sep 2012 Posts: 7
|
rest of code !!! |
Posted: Wed Oct 03, 2012 12:07 am |
|
|
Code: |
#include <16F877A.h>
#device adc=10
#FUSES NOWDT //No Watch Dog Timer
#FUSES HS //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)
#FUSES NOPUT //No Power Up Timer
#FUSES NOBROWNOUT //No brownout reset
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOCPD //No EE protection
#FUSES NOWRT //Program memory not write protected
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOPROTECT //Code not protected from reading
#use delay(clock=4000000) |
|
|
|
vinay
Joined: 30 Sep 2012 Posts: 7
|
Solved it !!!! |
Posted: Wed Oct 03, 2012 5:03 am |
|
|
Finally solved the prob
there is read problem in glcd_readbyte(), the enable pin is not pulsed properly. I am attaching the code through which I got proper output
Code: | // Purpose: Reads a byte of data from the specified chip
// Ouputs: A byte of data read from the chip
BYTE glcd_readByte(BYTE chip)
{
BYTE data; // Stores the data read from the LCD
if(chip == GLCD_CS1) // Choose which chip to read from
output_low(GLCD_CS1);
else
output_low(GLCD_CS2);
//input_d(); // Set port d to input
set_tris_d(0xFF);
output_high(GLCD_RW); // Set for reading
output_low(GLCD_E);
delay_us(10);
output_high(GLCD_E); // Pulse the enable pin
delay_us(10);
output_low(GLCD_E);
delay_us(10);
output_high(GLCD_E);
data = input_d(); // Get the data from the display's output register
output_low(GLCD_E);
output_high(GLCD_CS1); // Reset the chip select lines
output_high(GLCD_CS2);
return data; // Return the read data
} |
MARKDEM, thank you for your reply.
|
|
|
|