Nokia COLOR LCD PicBasicPro 2.50a example code


Closed Thread
Results 1 to 40 of 50

Hybrid View

  1. #1
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default Nokia GLCD code without the need for big RAM, font in eeprom

    Just like the title says...
    The 'font' stays in eeprom (need a PIC with a minimum of 512 bytes, otherwise characters will get dropped) and minimal ram is needed (37 bytes).
    If you're tacking this program onto something else, pay attention to the variable names. Maybe go back and pre-pend them all with CGLCD or something to keep them from getting overwritten or overwriting something important to you...

    Next up...the font goes into program memory instead of ram or eeprom. Should open up the code to practically every PIC out there with at 2K of program memory and more than 37 bytes of ram (most PICs except for the 10Fxxx and some of the 12F series)...

    After that, the shape drawing routines, and maybe some 3D functions I've been playing with...

    EDIT: Found a bug...pulled the code for now...will have new stuff up later tonight...
    Last edited by skimask; - 24th February 2008 at 02:32.

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default Nokia knock-off Color LCD code with the font in program memory

    This time the font goes in program memory at the high end.
    Pay attention to the notes in the code. You have to change a couple of values based on the PIC you are using, then you may have to do some math if you are using a bootloader, so you don't overwrite the bootloader with the font.

    The basic code and the few examples I added take up 3,223 words along with 640 words (1280 bytes) for the font itself.
    So, you now need a PIC with at least 4.4K free of program memory and 37 bytes of free ram. And if you cut the font down from 256 to 128 characters, only 3.8K of free program space is needed...even less if you cut the font down even farther.

    I pre-pended all of the variable names with CLCD, so you shouldn't have a problem with variables overwriting each other unless you've got a variable that starts out with CLCD.

    I wrote this code to run on a PIC18F4620 'cause that's about all I use these days and I'm fairly sure it'll run on any PIC18Fxxx(x) series, as long as the person using it changes the requisite registers as required (READ THE DATASHEET for the PIC!!!).

    I'm not sure if it'll run on 'lesser' PICs, i.e. 16F, 16C...it should with a few changes. It may even run on a 12Fxxx series if the code is cut down to an absolute bare minimum, the font cut down to practically nothing...but there probably won't be any useful code space leftover. PIC10Fxxx types are definitely out of the question.

    Enjoy... Graphics routines are in work and will be posted when I'm done with them...
    Attached Files Attached Files

  3. #3
    Join Date
    Nov 2003
    Location
    Sao Paulo - Brazil
    Posts
    92


    Did you find this post helpful? Yes | No

    Default Trying to Fit the Lib on a 16F877

    Hi Skimask,

    I just received my Color LCD and the breadboard from SparkFun.

    I´m trying to convert your source code to run on a 16F877 (8 Kb, 368 byts of RAM, 256 bytes of EEPROM)
    I´m doing that just because I can not find the 18F4620 here in Brazil.

    So, I did some modifications as you suggested :

    1) Changed de OSC to 10 (Mhz)

    2) The line :
    clcdENDFLASH con $FFFF 'IMPORTANT - change this value to the size of the PICs program space - 1
    was changed to :
    clcdENDFLASH con $1FFF 'IMPORTANT - change this value to the size of the PICs program space - 1

    3) At the end of the code, the Org value was changed to org 0x1F60

    4) Removed the 13 last lines used for the modified ASCII characters

    But, when I try to compile, the PBP returns some strange error messages :

    Warning[207] d:\teste_~1\nokia~2.asm 188 : Found Label after column 1. (bra)
    Error[122] d:\teste_~1\nokia~2.asm 188 : Illegal opcode (clcdoverstr)
    Message[303] d:\teste_~1\nokia~2.asm 190 : Program word too large. Truncated to core size (5465)
    Message[303] d:\teste_~1\nokia~2.asm 190 : Program word too large. Truncated to core size (7374)
    Message[303] d:\teste_~1\nokia~2.asm 190 : Program word too large. Truncated to core size (7472)
    Message[303] d:\teste_~1\nokia~2.asm 190 : Program word too large. Truncated to core size (696E)
    Message[303] d:\teste_~1\nokia~2.asm 190 : Program word too large. Truncated to core size (6723)

    I don´t understand why the code doesn´t fit in my 877, since the same source compiled for the 18F4620 takes less than 3 Kb...

    Do you have any idea or any tip to fit it on a 877 ?

    Thank you !

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by srspinho View Post
    I´m doing that just because I can not find the 18F4620 here in Brazil.
    They're available practically everywhere else in the world... You've obviously got internet access...Get one...

    Warning[207] d:\teste_~1\nokia~2.asm 188 : Found Label after column 1. (bra)
    Error[122] d:\teste_~1\nokia~2.asm 188 : Illegal opcode (clcdoverstr)
    Because there isn't a 'bra' opcode in the 16F877. The 2nd error is probably a result of the first.
    Change the bra to goto in the macro and see what happens...

    Message[303] d:\teste_~1\nokia~2.asm 190 : Program word too large. Truncated to core size (5465)

    I don´t understand why the code doesn´t fit in my 877, since the same source compiled for the 18F4620 takes less than 3 Kb...
    There's a number of different reasons. 18F registers don't multiple bank bit setting instructions every time you want to access a variable, 16F's do. Every time you want to access a register in an 18F, you just access it, period. With the 16F, you have to set either 1,2, or 3 bank bits first, then you can access it. So, for every variable access with an 18F, one word, for every variable access with a 16F, could be up to 3 instructions just to get to it. (see section 2.4 of the 16F877A datasheet and/or section 5 of the 18F4620 datasheet)

    16F877 or 16F877A?

  5. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    CHK?RP do it for you

    16F compile results is in WORDS while 18F is in BYTES
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  6. #6
    Join Date
    Nov 2003
    Location
    Sao Paulo - Brazil
    Posts
    92


    Did you find this post helpful? Yes | No

    Default

    Thank you guys !

    well, I´m trying to buy the 4620 from the Brazilian Microchip official vendor. They say that the 4620 is not an usual item (?) and they have to import it and it will take a long time.

    So, I decided to move my project to a 4550. I think this model will do the job.

    Thank you again !

    Regards

    Sérgio

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


    Did you find this post helpful? Yes | No

    Default

    srspinho

    Here is some code for the same display. I used some of Skimask's code for text manipulation. I am also sending pictures via USB from the PC. You will also see an encoder input to adjust the contrast of the display. Hope it helps.

    Dave
    Attached Files Attached Files

Similar Threads

  1. Reading in Manchester code
    By brid0030 in forum Code Examples
    Replies: 0
    Last Post: - 10th March 2009, 21:55
  2. How much code space do PBP statements use.
    By Darrel Taylor in forum Code Examples
    Replies: 5
    Last Post: - 13th February 2009, 21:31
  3. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 8th December 2008, 23:40
  4. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  5. PicBasicPro Code help!
    By michel in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 14th June 2008, 15:43

Members who have read this thread : 1

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