Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] MicroC GLCD library Problem.

Status
Not open for further replies.

dim912

Junior Member level 2
Joined
Sep 9, 2009
Messages
23
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Colombo
Activity points
1,524
I want to run a LM1264LFC(64*128) display using the GLCD library of MicroC. I wrote a simple program after referring the example comes with MicroC 4.60 help. But I was not able to display any thing on the screen. I used PIC16F877A microcontroller. Then I refer the MicroC 6.0 users manaualUnder the GLCD library manual noted that this library can only be used with PIC18 family. But in the diagram given in the help document of microC 4.6 installation indicates the its controller as PIC16F877.


can any body tel me, whether I can use GLCD and PIC16F877A PIC to drive this LCD. my simple code is given bellow.




char GLCD_DataPort at PORTB;

sbit GLCD_CS1 at RD4_bit;
sbit GLCD_CS2 at RD3_bit;
sbit GLCD_RS at RD5_bit;
sbit GLCD_RW at RD6_bit;
sbit GLCD_EN at RD7_bit;
sbit GLCD_RST at RD2_bit;

sbit GLCD_CS1_Direction at TRISD4_bit;
sbit GLCD_CS2_Direction at TRISD3_bit;
sbit GLCD_RS_Direction at TRISD5_bit;
sbit GLCD_RW_Direction at TRISD6_bit;
sbit GLCD_EN_Direction at TRISD7_bit;
sbit GLCD_RST_Direction at TRISD2_bit;
// End Glcd module connections

void delay2S(){ // 2 seconds delay function
Delay_ms(2000);
}

void main() {

TRISA =0x00;
TRISB =0x00;
TRISC =0x00;
TRISD =0x00;


Glcd_Init(); // Initialize GLCD
Glcd_Fill(0x00); // Clear GLCD

Glcd_Set_Font(Font_Glcd_Character8x7, 8, 7, 32); // Choose font, see __Lib_GLCDFonts.c in Uses folder
while(1){
Glcd_Write_Text("FYPUOM", 1, 7, 2); // Write string
delay2S();
}

}
 

I not familiar with the LM1264LFC GLCD, is this the display's model number?

Can you upload or post a link to the device's datasheet?

With a 128 x 64 pixel format there is a good chance it is utilizing a KS0108, S6B0108 or compatible controller which are compatible with the MikroC GLCD Library.

As far as the MikroC GLCD Library compatibility with PIC16F family:

Reference: MikroC Pro User Manual, pg 326, Section
The mikroC PRO for PIC provides a library for operating Graphic Lcd 128x64 (with
commonly used Samsung KS108/KS107 controller).

I see not mention of specific PIC compatibility, unlike the MMC library which requires the PIC18F, and as you stated the code example uses a PIC16F877.

Your only limitation would be the limited storage resources the PIC16F877A can provide. Manipulation of graphical images can be quite storage intensive.

BigDog
 
  • Like
Reactions: FvM and dim912

    dim912

    Points: 2
    Helpful Answer Positive Rating

    FvM

    Points: 2
    Helpful Answer Positive Rating
Hi all,
yes. it is the model number of the display. this is the **broken link removed** of datasheet.
I wrote a very simple code as above, and it is not working.
thank you BigDog.
 

I've took a look at the datasheet.

Yes, your GLCD uses the S6B0108 controller which is an updated and compatible version of the KS0108.

Are you using the example project on page 340 of the MikroC Pro User Manual as a guide?

I pose this question, because the pinouts of the datasheet do not match those of the example project.

If not, do you have a schematic of the GLCD circuit?

And how are you handling the contrast pin, Vo?

Another issue I might mention is the backlight has a maximum current draw of 120mA, which coupled with the power requirements of your other components may exceed your power supply's ratings.

BigDog
 
  • Like
Reactions: FvM and dim912

    dim912

    Points: 2
    Helpful Answer Positive Rating

    FvM

    Points: 2
    Helpful Answer Positive Rating
yes. I am using the same example given in the MicroC Pro user manual. But I cut off some code lines to reduce the complexity of the program. because I wanted
to get my LCD work however. I suppose to design a PCB for the board. Therefore I change the pinouts from the example so that the PCB gets simple.


but I removed following code form the example on the user manual,
#define COMPLETE_EXAMPLE // comment this line to make simpler/smaller example
// ANSEL = 0; // Configure AN pins as digital
// ANSELH = 0;
// C1ON_bit = 0; // Disable comparators
// C2ON_bit = 0;

since they give errors when i compile with MicroC 4.60. I introduced

TRISA=0x00;
TRISB=0x00;
TRISC=0x00;
TRISD=0x00;
instead of removed code lines.
But I was not able to find a way of disabling comparetors as the example code has done.


I am controlling the V0 pin according to the instruction given in the datasheet( using a 10K variable resistor , V0, VDD and Vout). I disconnected the Back light, but was not able to get a positive result. but the heating of 7805 has been decreased now.

Other than above details, I am using a bootloader to upload the program to the pic through RS232. When I press the "Write" button on the GUI of the bootloader, PIC automatically get programmed even with out a reset on MCLR. this happens when a program written with MicroC runs in the PIC. If a program written on PICC or , MPLAB runs in the pic, I need to press the reset button to program the PIC through bootloader.

It is not clear your words..
I pose this question, because the pinouts of the datasheet do not match those of the example project.

thank you.
 

Hi all,
Ultimately I was able to run the LCD smoothly. In previous attempts I used a bootloader for uploading the hex file to the PIC over RS232. Today I erase the bootloader on the PIC and program the PIC using a ICSP programer. after then LCD works properly. So I was able to run a LM1264LFC LCD display from a PIC16F877A. I use the GLCD library of MicroC 4.6 and no bootloader was used to program the PIC.
thank you all and special praise goes to bigdogguru..
 

When using a bootloader to load your code, it is often necessary to use/write a custom linker script or modify your compilers build options to prevent prevent program storage conflicts. Bootloaders installed in program flash memory occupy a specific region of flash memory. Your program must be linked in such a way as to prevent its attempted loading on top of the bootloader code. The specific technique depends largely on the bootloader used and its position in flash memory. Of course devices which have a bootloader stored in ROM, are immune to this particular problem, however the code still must be located in storage at a known point of entry.

For Example,

Reference Microchip Appnote AN1310 High-Speed Serial Bootloader for PIC16 and PIC18 Devices, pg 13, Application Mode Considerations HI-TECH C Applications:

The HI-TECH C compiler often fragments application
code into portions of program memory space that conflict
with the bootloader firmware. To prevent problems
with application code conflicting with bootloader firmware
sharing the same device program Flash memory,
the HI-TECH C project must be modified to reserve
program memory space for the bootloader.

The addresses used by the bootloader firmware can be
determined by looking at the Flash memory display
inside the host PC bootloader application. While connected
to the bootloader, scroll down to the end of
Flash memory space where you can find the dark
turquoise shaded memory region reserved for the
bootloader (see Figure 12).

Add the bootloader region to be reserved in the HITECH
C project’s “Build Options”, under the Global tab
(see Figure 13).

Set the “ROM ranges” field to something like the
following:

default,-F800-FBFF

The word, “default”, tells the compiler to use the entire
Flash program memory space of the device, while the
address range, “-F800-FBFF,” with a minus sign in
front, tells the compiler to exclude addresses, F800h
through FBFFh, from being used for the application
firmware.

This prevents application code from conflicting with the
bootloader code.

Implementing this procedure in MikroC appears to be nontrivial and is discussed in several discussion threads in various forums.

BigDog
 
  • Like
Reactions: dim912

    dim912

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top