Driver for ILI9341


+ Reply to Thread
Page 1 of 3 123 LastLast
Results 1 to 15 of 44

Thread: Driver for ILI9341461 days old

  1. #1
    Member flosigud's Avatar
    Join Date
    Oct 2013
    Posts
    153
    Thumbs Up
    Received: 8
    Given: 12
    Total Downloaded
    3.12 GB

    2 Not allowed!

    Default Driver for ILI9341

    This is a simple driver for ILI9341 that prints charactes, lines and boxes. It was originally based on the driver that I extracted from Normnets Pic wav Player v1.0 for Nokia 6100 display which in turn I believe to be based on a driver by James Lynch which I also refered to. I addition to tha I have got some bits and pieces from all over the internet, not the least the Arduino crowd. <br>

    To use this driver you type:
    Include "ILI9341.inc"

    InitILI
    The init routine is in contrast with other inits I have seen very simple, its only starts the display but doesn't tweek any of its settings. My ILI9341 displays starts in BGR mode and mirrored. To fix that you have to set MADCTL register. There are four macros that set screen orientation, size of screen, color order to RGB and printing from left to right.


    SCRorientation0
    SCRorientation90
    SCRorientation180
    SCRorientation270

    There are few "graphic" commands that do what their names imply:

    ClearScreen
    SetPixel(x,y)
    HLine(x,y,w)
    VLine(x,y,h)
    XBlock(x,y,w,h)
    XBox(x,y,w,h)

    Printing of strings

    Fonts used are as defined in AN1182 by Microchip. To make fonts I used Microchip Graphics Resource Converter which is burried deep in Microchip Libraries for Applications. It takes Windows fonts and converts to horizontally arranged bitmaps, which isconvenient for this display. I manually converted these to basic using search and replace in Notepad++. There are several fonts includes in the zip.

    To use a font type for example:

    SetFont

    To print a string you must first set coordinates wXstart and wYstart and then:

    PrintString(string) or PrintString_At(x,y,string) which sets the coordinates first. Both call Sub Print_Chr which increments wXstart by the width of the character. More information on this can be gained by reading the program listing as I believe it to be reasonably commented.

    In the demo program there are some helper routines to set margins and print out whole fonts. It doesn't do much more than that. I will in following days post some more information on this driver and answear questions. I hope there will be some. The driver has some limitations, most notably it's inability to print wery lage fonts. I also hope to do some improvements in the coding.
    Attached Files Attached Files
    Last edited by John Drew; 15th October 2018 at 07:44. Reason: Removed the HTML
    Flosi Guđmundsson
    Reykjavík

Attention
×

This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

The advertisements we display are relevant to this web site and your browsing history

Please consider supporting us by disabling your ad blocker.


Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

If you can, please report issues in the forum area WebSite / Forum Issues


Thank you for your attention.

  • #2
    Member flosigud's Avatar
    Join Date
    Oct 2013
    Posts
    153
    Thumbs Up
    Received: 8
    Given: 12
    Total Downloaded
    3.12 GB

    0 Not allowed!

    Default Re: Driver for ILI9312

    Few useful links:

    ILI9341 datasheet:
    https://courses.cs.washington.edu/co...l3/ILI9341.pdf

    Nokia 6100 LCD Display Driver:
    https://elecfreaks.com/estore/downlo...lay_Driver.pdf

    AN1182Fonts in the Microchip Graphics Library:
    http://ww1.microchip.com/downloads/e...tes/01182a.pdf

    Microchip Libraries for Applications:
    https://www.microchip.com/mplab/micr...r-applications
    Flosi Guđmundsson
    Reykjavík

  • Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #3
    Junior Member Andriy76's Avatar
    Join Date
    Dec 2018
    Posts
    3
    Thumbs Up
    Received: 0
    Given: 0
    Total Downloaded
    0

    0 Not allowed!

    Default Re: Driver for ILI9341

    Thanks so much. I am not a big expert and tried to remake the ILI9320 driver earlier . Which is here in the examples . The problem was the output of characters . And I could not overcome it .

  • Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #4
    Member flosigud's Avatar
    Join Date
    Oct 2013
    Posts
    153
    Thumbs Up
    Received: 8
    Given: 12
    Total Downloaded
    3.12 GB

    0 Not allowed!

    Default Re: Driver for ILI9341

    There are several displays that this driver would work with with small modifications. I don now about ILI9320 though. I wrote it originally for Nokia 6100 display, then changed it for ILI6193 which is often sold as St7335, and then for ili9341.
    Flosi Guđmundsson
    Reykjavík

  • Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #5
    Fanatical Contributor top204's Avatar
    Join Date
    Feb 2002
    Posts
    3,454
    Thumbs Up
    Received: 298
    Given: 145
    Total Downloaded
    1.99 GB

    0 Not allowed!

    Default Re: Driver for ILI9341

    Many thanks Flosi.

    A nice, well laid out piece of coding. I can see by your code format, you are going to love the Procedures for the 8-bit compiler. :-)

  • Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #6
    Member flosigud's Avatar
    Join Date
    Oct 2013
    Posts
    153
    Thumbs Up
    Received: 8
    Given: 12
    Total Downloaded
    3.12 GB

    0 Not allowed!

    Default Re: Driver for ILI9341

    Yea maybe. I asked for procedures 20 years ago and you said it would never happen. The compiler has now reached the point that I can do anything I want in a way that I like. I look forward to the time when unused subs don't add code. Will the procedures have any overhead?

    Anyway when procedures have been added isn't it high time for version four? I haven't paid for upgrades in 15 years.
    Flosi Guđmundsson
    Reykjavík

  • Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #7
    Fanatical Contributor top204's Avatar
    Join Date
    Feb 2002
    Posts
    3,454
    Thumbs Up
    Received: 298
    Given: 145
    Total Downloaded
    1.99 GB

    0 Not allowed!

    Default Re: Driver for ILI9341

    The procedures themselves have no overhead, if they are not used.

    If they are not used in a program, they are not placed in the program. The parameters are variables that are loaded that have a specific name attached to the procedure, the same for their returns. There is no pushing or popping for parameters, so they operate extremely efficiently.

  • Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #8
    Junior Member Andriy76's Avatar
    Join Date
    Dec 2018
    Posts
    3
    Thumbs Up
    Received: 0
    Given: 0
    Total Downloaded
    0

    0 Not allowed!

    Default Re: Driver for ILI9341

    Hi. Somehow there is no file Include "18f26k2264MHz.inc." I try to use PIC18F452 . But ILI9341 doesn't work . Won't even init the display .

  • Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #9
    Member flosigud's Avatar
    Join Date
    Oct 2013
    Posts
    153
    Thumbs Up
    Received: 8
    Given: 12
    Total Downloaded
    3.12 GB

    0 Not allowed!

    Default Re: Driver for ILI9341

    Sorry about that. Here it is. You could use any setup that works. This uses intosc and PLL and runs at 64MHz.
    Flosi Guđmundsson
    Reykjavík

  • Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #10
    Prolific Poster charliecoultas's Avatar
    Join Date
    Sep 2010
    Posts
    1,372
    Thumbs Up
    Received: 46
    Given: 39
    Total Downloaded
    3.45 GB

    0 Not allowed!

    Default Re: Driver for ILI9341

    Is this any good? I use it with my preferred device of 18F26K22
    Config_Start FOSC = INTIO67 ;Internal oscillator block, port function on RA6 and RA7
    PLLCFG = On ;Oscillator multiplied by 4
    PRICLKEN = On ;Primary clock is always enabled
    FCMEN = OFF ;Fail-Safe Clock Monitor disabled
    IESO = OFF ;Oscillator Switchover mode disabled
    PWRTEN = OFF ;Power up timer disabled
    BOREN = OFF ;Brown-out Reset disabled in hardware and software
    BORV = 285 ;VBOR set to 2.85 V nominal
    WDTEN = On ;Watch dog timer enabled
    WDTPS = 2048 ;this value gives about 6 seconds before watchdog resets the chip
    PBADEN = OFF ;Segments<5:0> pins are configured as digital I/O on Reset
    HFOFST = OFF ;HFINTOSC output and ready status are delayed by the oscillator stable status
    MCLRE = EXTMCLR ;MCLR pin enabled, RE3 input pin disabled
    STVREN = On ;Stack full/underflow will cause Reset
    LVP = OFF ;Single-Supply ICSP disabled
    XINST = OFF ;Instruction set extension and Indexed mode disabled (Legacy mode)
    Debug = OFF ;Disabled
    Cp0 = OFF ;Block 0 (000800-001FFFh) not code-protected
    Config_End


    ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


    OSCCON = %01110000 ;16MHz internal oscillator block
    Nop
    OSCCON2 = %10001100
    Nop
    Set OSCTUNE.6 ;enable PLL so clock now 64MHz - hold onto your hat Mother!

    ANSELA = %00000000 ;
    ANSELB = %00000000 ;beware - pic starts life with all analogue channels set to analogue
    ANSELC = %00000000

  • Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #11
    Member flosigud's Avatar
    Join Date
    Oct 2013
    Posts
    153
    Thumbs Up
    Received: 8
    Given: 12
    Total Downloaded
    3.12 GB

    0 Not allowed!

    Default Re: Driver for ILI9341

    Seems like I was unsucessful i uploading yesterday so here it is
    Code:
    ;-------------------------------------------------------------------------------;**** Added by Fuse Configurator ****
    ; Use the Fuse Configurator plug-in to change these settings
    
    
    Device = 18F26K22
    
    
    Declare Reminders Off
    @ CONFIG_REQ = 0 ; Override Compiler's configuration settings
    Asm-
    Config FOSC = INTIO67    ;Internal oscillator block
    Config PLLCFG = On    ;Oscillator multiplied by 4
    Config PRICLKEN = On    ;Primary clock enabled
    Config FCMEN = OFF    ;Fail-Safe Clock Monitor disabled
    Config IESO = OFF    ;Oscillator Switchover mode disabled
    Config PWRTEN = OFF    ;Power up timer disabled
    Config BOREN = On    ;Brown-out Reset enabled and controlled by software (SBOREN is enabled)
    Config BORV = 190    ;VBOR set to 1.90 V nominal
    Config WDTEN = OFF    ;Watch dog timer is always disabled. SWDTEN has no effect.
    Config WDTPS = 32768    ;1:32768
    Config CCP2MX = PORTC1    ;CCP2 input/output is multiplexed with RC1
    Config PBADEN = On    ;PORTB<5:0> pins are configured as analog input channels on Reset
    Config CCP3MX = PORTB5    ;P3A/CCP3 input/output is multiplexed with RB5
    Config HFOFST = On    ;HFINTOSC output and ready status are not delayed by the oscillator stable status
    Config T3CMX = PORTC0    ;T3CKI is on RC0
    Config P2BMX = PORTB5    ;P2B is on RB5
    Config MCLRE = EXTMCLR    ;MCLR pin enabled, RE3 input pin disabled
    Config STVREN = On    ;Stack full/underflow will cause Reset
    Config LVP = OFF    ;Single-Supply ICSP disabled
    Config XINST = OFF    ;Instruction set extension and Indexed Addressing mode disabled (Legacy mode)
    Config Debug = OFF    ;Disabled
    Config Cp0 = OFF    ;Block 0 (000800-003FFFh) not code-protected
    Config CP1 = OFF    ;Block 1 (004000-007FFFh) not code-protected
    Config CP2 = OFF    ;Block 2 (008000-00BFFFh) not code-protected
    Config CP3 = OFF    ;Block 3 (00C000-00FFFFh) not code-protected
    Config CPB = OFF    ;Boot block (000000-0007FFh) not code-protected
    Config CPD = OFF    ;Data EEPROM not code-protected
    Config WRT0 = OFF    ;Block 0 (000800-003FFFh) not write-protected
    Config WRT1 = OFF    ;Block 1 (004000-007FFFh) not write-protected
    Config WRT2 = OFF    ;Block 2 (008000-00BFFFh) not write-protected
    Config WRT3 = OFF    ;Block 3 (00C000-00FFFFh) not write-protected
    Config WRTC = OFF    ;Configuration registers (300000-3000FFh) not write-protected
    Config WRTB = OFF    ;Boot Block (000000-0007FFh) not write-protected
    Config WRTD = OFF    ;Data EEPROM not write-protected
    Config EBTR0 = OFF    ;Block 0 (000800-003FFFh) not protected from table reads executed in other blocks
    Config EBTR1 = OFF    ;Block 1 (004000-007FFFh) not protected from table reads executed in other blocks
    Config EBTR2 = OFF    ;Block 2 (008000-00BFFFh) not protected from table reads executed in other blocks
    Config EBTR3 = OFF    ;Block 3 (00C000-00FFFFh) not protected from table reads executed in other blocks
    Config EBTRB = OFF    ;Boot Block (000000-0007FFh) not protected from table reads executed in other blocks
    Endasm-
    Declare Reminders On
    
    
    ;**** End of Fuse Configurator Settings ****
    ;-------------------------------------------------------------------------------
    
    
        Declare Xtal 64
        Declare All_Digital 1
        
        Symbol PLLEN = OSCTUNE.6                    ' PLL enable
        Symbol HFIOFS = OSCCON.2                      ' HFINTOSC frequency stable
        Symbol PLLRDY = OSCCON2.7                    ' PLL run status
    
    
        OSCCON=110000                            ' Osc =  64 MHz
        While HFIOFS=0:Wend                           ' Wait until osc is stable
        
        PLLEN=1                                        ' Enable PLL 4x 16MHz = 64Mhz 
        While PLLRDY=0:Wend                            ' Wait until PLL is stable
    Flosi Guđmundsson
    Reykjavík

  • Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #12
    Member flosigud's Avatar
    Join Date
    Oct 2013
    Posts
    153
    Thumbs Up
    Received: 8
    Given: 12
    Total Downloaded
    3.12 GB

    0 Not allowed!

    Default Re: Driver for ILI9341

    Below is a zip with the updated main include. The previos version was unable to print very large fonts as I used to small variable for a counter. While fixing this I realized that one variable was superfluous and this meant some reduction in code size.

    I also increased the SPI speed to maximum. The reason prior experiments to that effect were futile is probably that the device wakes up with sleew rate limited. Les recently changed that so now higher speed is possible.

    ILI.zip
    Last edited by flosigud; 10th March 2019 at 17:02.
    Flosi Guđmundsson
    Reykjavík

  • Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #13
    Member flosigud's Avatar
    Join Date
    Oct 2013
    Posts
    153
    Thumbs Up
    Received: 8
    Given: 12
    Total Downloaded
    3.12 GB

    0 Not allowed!

    Default Re: Driver for ILI9341

    Here is an update to my driver end a better demo I think. It is a pulldown menu using indirect addressing. The input is a quadrature encoder on Portb4,5. I used a cheap one.
    Attached Files Attached Files
    Last edited by flosigud; 29th September 2019 at 20:50.
    Flosi Guđmundsson
    Reykjavík

  • Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #14
    Member teo's Avatar
    Join Date
    Sep 2010
    Posts
    308
    Thumbs Up
    Received: 8
    Given: 1
    Total Downloaded
    7.41 GB

    0 Not allowed!

    Default Re: Driver for ILI9341

    Hi Flosi,
    A good job!
    Teo

  • Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #15
    Prolific Poster charliecoultas's Avatar
    Join Date
    Sep 2010
    Posts
    1,372
    Thumbs Up
    Received: 46
    Given: 39
    Total Downloaded
    3.45 GB

    0 Not allowed!

    Default Re: Driver for ILI9341

    Excellent! I'll try it out, thanks Flosi.

    Charlie

  • Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

    Thread Information

    Users Browsing this Thread

    There are currently 1 users browsing this thread. (0 members and 1 guests)

       

    Similar Threads

    1. ILI9341 LCD module with touch
      By towlerg in forum LCD module
      Replies: 0
      Last Post: 10th November 2019, 17:17
    2. [SOLVED !] ILI9341 Touch screen display
      By mikedownunder in forum Proton Plus Compiler v3
      Replies: 5
      Last Post: 25th February 2016, 10:11
    3. 0 to 10 v driver
      By Tim in forum The Lounge
      Replies: 25
      Last Post: 23rd July 2012, 10:29
    4. LED Driver
      By pic-ignorant in forum The Lounge
      Replies: 11
      Last Post: 13th January 2012, 20:45
    5. Bridge Driver
      By fanie in forum The Lounge
      Replies: 0
      Last Post: 27th August 2008, 12:55

    Posting Permissions

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