[PIC] PIC32MX150 with KS0108 GLCD problem

Status
Not open for further replies.

Rtk89

Newbie level 6
Joined
Nov 15, 2013
Messages
12
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
85
Dear All,

In my project I am using a PIC32MX150F128B microcontroller with a KS0108B based graphic LCD and using MikroC PRO for PIC32 to write source.
I can draw bitmap or write text without problem, but when I use the Glcd_dot(), Glcd_rectangle(), Glcd_circle()..etc functions, I get bed results.
In pictures:
Glcd_rectangle();
Glcd_Dot();
Glcd_Fill(0x00);
Glcd_Image(); (It is right result)

I try to find the mistake for a week, but now I don't have an idea. Please help me somebody.
Here is my code:

Code:
sbit GLCD_D0 at RB7_bit;
sbit GLCD_D1 at RB8_bit;
sbit GLCD_D2 at RB9_bit;
sbit GLCD_D3 at RB10_bit;
sbit GLCD_D4 at RB12_bit;
sbit GLCD_D5 at RB13_bit;
sbit GLCD_D6 at RB14_bit;
sbit GLCD_D7 at RB15_bit;

sbit GLCD_D0_Direction at TRISB7_bit;
sbit GLCD_D1_Direction at TRISB8_bit;
sbit GLCD_D2_Direction at TRISB9_bit;
sbit GLCD_D3_Direction at TRISB10_bit;
sbit GLCD_D4_Direction at TRISB12_bit;
sbit GLCD_D5_Direction at TRISB13_bit;
sbit GLCD_D6_Direction at TRISB14_bit;
sbit GLCD_D7_Direction at TRISB15_bit;


sbit GLCD_CS1 at RB5_bit;
sbit GLCD_CS2 at RB4_bit;
sbit GLCD_RS at RB3_bit;
sbit GLCD_RW at RB1_bit;
sbit GLCD_EN at RB6_bit;
sbit GLCD_RST at RB11_bit;

sbit GLCD_CS1_Direction at TRISB5_bit;
sbit GLCD_CS2_Direction at TRISB4_bit;
sbit GLCD_RS_Direction at TRISB3_bit;
sbit GLCD_RW_Direction at TRISB1_bit;
sbit GLCD_EN_Direction at TRISB6_bit;
sbit GLCD_RST_Direction at TRISB11_bit;

void Glcd_Write_Text(char *text, unsigned short x_pos, unsigned short page_num, unsigned short color);
void Glcd_Dot(unsigned short x_pos, unsigned short y_pos, unsigned short color);
void Glcd_Fill(unsigned short pattern);
void Glcd_Rectangle(unsigned short x_upper_left, unsigned short y_upper_left, unsigned short x_bottom_right, unsigned short y_bottom_right, unsigned short color)

void main() {
    PORTA = 0x0000;
    PORTB = 0x0000;
  
 
    ANSELA = 1;
    ANSELB = 0;
    
    TRISA = 1;
    TRISB = 0;          

    JTAGEN_bit = 0;  
    Glcd_Init();                                  
    Glcd_Fill(0x00);                               /
    ADC1_Init();

do{
Glcd_Dot(30,30,1);
Delay_ms(1000);
Glcd_Rectangle(5, 5, 40, 40, 1);
Delay_ms(1000);
Glcd_Fill(0x00);  
Delay_ms(1000);
}while(1);

}
;
 

Maybe there are another GLCD library file for mikroC, what I can use with PIC32MX150?
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…