color LCD workshop


Closed Thread
Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default Re: color LCD workshop

    Hi Dave, That is AWESOME!. Can we count you in as the mentor for this? Personally I would love to look at the code for this. But can you post it in a new thread? That seems to me like a far jump from can I draw a line first or even detect the screen tap.
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  2. #2
    Join Date
    Mar 2008
    Location
    Gerogetown, Texas
    Posts
    94


    Did you find this post helpful? Yes | No

    Default Re: color LCD workshop

    Sure, I don't mind helping out. The hardest part of this project was the math. I had an older version that used a look-up table for hand drawing.

    I will post a zip of the project in a new thread.

    Dave

  3. #3
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default Re: color LCD workshop

    Ok, in a moving forward fashion, I will start with the display

    Seems we have 4 things of intrest hardware wise;
    SD card slot - pretty self evident
    JP1
    JP2
    PS0-PS3

    JP1 and JP2 seem to be parallel connectors so this is now just JP1
    This is our connection to the uP and other stuff.

    PS0-PS3 are setup fuses. per suggestion from Daves thread, we want to set this as this:
    PS0 not soldered
    PS1 not soldered
    PS2 soldered
    PS3 soldered

    This should give us 8 bit data and 4 wire SPI I think. But do we want 4 wire or 3?

    Connection to the uP through JP1 is another post.
    If this is wrong, please correct me someone

    Where is the chip select for the touch screen controller? Pin 31 of JP1?
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  4. #4
    Join Date
    Mar 2008
    Location
    Gerogetown, Texas
    Posts
    94


    Did you find this post helpful? Yes | No

    Default Re: color LCD workshop

    As Bert pointed out, the solder pads PS2 and PS3 are soldered and PS1, PS0 are open. This tells the controller that we will use 8 Bit parallel. If you want to use SPI or 16 bit parallel you need to change the solder pads as required.

    The next step is to set up your ports and pins and the basic communication to the display. In my project I used a 18F4550, you can change the pins to suit your Pic.

    Code:
    LCD_Dat         var    PORTD
    LCD_CS          var    PORTA.0
    LCD_RS          var    PORTA.1
    LCD_WR          var    PORTA.2
    LCD_RD          var    PORTA.3
    LCD_RST         var    PORTA.4
    The next item is communication with the display.
    Code:
    '******************************************************************************
    LCD_Write_CMD:
    high lcd_RD
    low lcd_rs
    low lcd_cs
    low lcd_wr
    lcd_dat = cmd.highbyte
    high lcd_wr
    low lcd_wr
    LCD_Dat = cmd.lowbyte
    high lcd_wr
    high lcd_rs
    high lcd_cs
    
    Return
    '******************************************************************************
    LCD_Write_Dat:
    high lcd_RD
    high lcd_rs
    low lcd_cs
    low lcd_wr
    lcd_dat = dat.highbyte
    high lcd_wr
    low lcd_wr
    LCD_Dat = dat.lowbyte
    high lcd_wr
    high lcd_cs
    
    return
    
    
    '******************************************************************************
    LCD_Read_Dat:           ' only works with 16 bit control
    TRISD = $FF
    color_buf = 0
    low lcd_cs
    high lcd_rs
    high lcd_wr
    
    
    low lcd_rd      'dummy read
    high lcd_rd
    
    low lcd_rd
    color_buf.lowbyte = lcd_dat 
    high lcd_rd
                                                            'lcd_dat
    low lcd_rd
    color_buf.highbyte = lcd_dat 
    high lcd_rd
    
                                                               'lcd_dat
    TRISD = $00
    high lcd_cs
    return
    '******************************************************************************
    
    LCD_RESET:
    low lcd_rst
    pause 500
    high lcd_rst
    pause 1000
    return
    '******************************************************************************
    Then you need to initialize the display.

    Code:
    LCD_INIT:
    gosub lcd_reset
    cmd = $0028 : gosub lcd_write_CMD : dat = $0006 : gosub lcd_write_dat
    
    pause 10
    cmd = $0000 : gosub lcd_write_CMD : dat = $0001 : gosub lcd_write_dat ' Start OSC
    cmd = $0010 : gosub lcd_write_CMD : dat = $0000 : gosub lcd_write_dat
    cmd = $0001 : gosub lcd_write_CMD : dat = $30EF : gosub lcd_write_dat  ' Driver output  32EF
    cmd = $0002 : gosub lcd_write_CMD : dat = $0600 : gosub lcd_write_dat   
    cmd = $0003 : gosub lcd_write_CMD : dat = $6A64 : gosub lcd_write_dat   
    cmd = $0011 : gosub lcd_write_CMD : dat = $6830 : gosub lcd_write_dat   
    
    cmd = $000F : gosub lcd_write_CMD : dat = $0000 : gosub lcd_write_dat
    
    cmd = $000B : gosub lcd_write_CMD : dat = $5308 : gosub lcd_write_dat
    cmd = $000C : gosub lcd_write_CMD : dat = $0003 : gosub lcd_write_dat
    cmd = $000D : gosub lcd_write_CMD : dat = $000A : gosub lcd_write_dat
    cmd = $000E : gosub lcd_write_CMD : dat = $2E00 : gosub lcd_write_dat
    
    cmd = $001E : gosub lcd_write_CMD : dat = $002B : gosub lcd_write_dat '
    cmd = $0025 : gosub lcd_write_CMD : dat = $8000 : gosub lcd_write_dat
    cmd = $0026 : gosub lcd_write_CMD : dat = $7000 : gosub lcd_write_dat 
    cmd = $004E : gosub lcd_write_CMD : dat = $0000 : gosub lcd_write_dat
    cmd = $004F : gosub lcd_write_CMD : dat = $0000 : gosub lcd_write_dat
    
    cmd = $0012 : gosub lcd_write_CMD : dat = $08D9 : gosub lcd_write_dat
     ' Gama Curve
    cmd = $0030 : gosub lcd_write_CMD : dat = $0000 : gosub lcd_write_dat
    cmd = $0031 : gosub lcd_write_CMD : dat = $0104 : gosub lcd_write_dat
    cmd = $0032 : gosub lcd_write_CMD : dat = $0100 : gosub lcd_write_dat
    cmd = $0033 : gosub lcd_write_CMD : dat = $0305 : gosub lcd_write_dat
    cmd = $0034 : gosub lcd_write_CMD : dat = $0505 : gosub lcd_write_dat
    cmd = $0035 : gosub lcd_write_CMD : dat = $0305 : gosub lcd_write_dat
    cmd = $0036 : gosub lcd_write_CMD : dat = $0707 : gosub lcd_write_dat
    cmd = $0037 : gosub lcd_write_CMD : dat = $0300 : gosub lcd_write_dat
    cmd = $003A : gosub lcd_write_CMD : dat = $1200 : gosub lcd_write_dat
    cmd = $003B : gosub lcd_write_CMD : dat = $0800 : gosub lcd_write_dat
    pause 150
    cmd = $0007 : gosub lcd_write_CMD : dat = $0033 : gosub lcd_write_dat
    pause 200
    
    Return
    Now you can start writing to the display.

    You will need several sub routines to do things like "Text" shapes etc.

    You should read the data sheet for the display to try to understand how the display works. I attached the PBP code that has a number of different subs in another post, http://www.picbasic.co.uk/forum/showthread.php?t=14824 feel free to use it and hopefully improve upon it.

    Dave
    Last edited by DaveC3; - 11th May 2011 at 23:50.

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts