problem in interfacing AGM1232G display

Discussion in 'Embedded Systems and Microcontrollers' started by hemnath, Oct 11, 2013.

  1. hemnath

    Thread Starter New Member

    Dec 12, 2012
    20
    0
    Hi,
    Hi, I'm interfacing GLCD with PIC 18LF2520, Oscillator type: Internal 1Mhz, CCS C compiler, GLCD: Winstar WG12232A-YYH.

    I'm having difficult in initializing the Graphic lcd. To simulate in proteus, i use AGM1232G graphic display. Below is the sample code. But its not working. Please help,

    Code ( (Unknown Language)):
    1. #include "18F2520.h"
    2. #fuses INTRC_IO        // Internal oscillator  
    3. #use delay(clock = 1000000)   // 1Mhz clock
    4.  
    5. // PIN Definitions
    6. #define A0        PIN_B3
    7. #define CS1        PIN_B4
    8. #define CS2        PIN_B5
    9. #define R_W        PIN_C0
    10. #define RST        PIN_C1
    11.  
    12. const unsigned char data[]  = {0x00, 0x00, 0xE7, 0xE7, 0xE7, 0xE7, 0x00, 0x00};    // invert of H
    13.  
    14. // Function definitions
    15. void glcd_data(unsigned char z);
    16. void glcd_cmd(unsigned char c);
    17.  
    18. unsigned int i;
    19.  
    20. void main()
    21. {
    22.    output_high(CS1);        // CS1 = 1  
    23.    output_high(CS2);        // CS2 = 1
    24.    output_high(RST);        // RESET = 1
    25.    output_low(R_W);            // Write mode
    26.    
    27.    glcd_cmd(0xe2);   //software Reset
    28.    glcd_cmd(0xAF);
    29.    glcd_cmd(0xc0);   //Set Start Line 0(C0H)~31(DFH)
    30.    glcd_cmd(0xa4);   //Static  Drive OFF
    31.    glcd_cmd(0xa9);   //Select Duty = 1 /32
    32.    glcd_cmd(0xa0);   //Select ADC = 0
    33.    glcd_cmd(0xEE);  
    34.    glcd_cmd(0xb8);   //Set Page Address 0(B8H)~3(BBH)
    35.    glcd_cmd(0x00);   //Set segment Address 0(00H)~(4FH)
    36.    glcd_cmd(0xaf);   //Set Display ON
    37.  
    38.    while(1)
    39.    {  
    40.       glcd_cmd(0xC0);      // display start line
    41.       glcd_cmd(0xB8);      // Page address
    42.                          
    43.       for (i = 0; i < 8; i++)
    44.       {
    45.          glcd_data(data[i]);      // Display the data on GLCD
    46.       }
    47.    }
    48. }
    49.  
    50. void glcd_cmd(unsigned char c)
    51. {
    52.     output_low(A0);            // Command mode
    53.     output_high(CS1);
    54.     output_high(CS2);
    55.     output_a(c);                //
    56.     output_low(CS1);
    57.     output_low(CS2);
    58. }
    59.  
    60. void glcd_data(unsigned char z)
    61. {
    62.     output_high(A0);      // Data mode
    63.     output_high(CS1);
    64.     output_high(CS2);
    65.     output_a(z);                //
    66.     output_low(CS1);
    67.     output_low(CS2);
    68. }
    69. [/i]
     
Loading...