Page 1 of 1

18F87J50 - BMPDrawer Slow

Posted: Mon Sep 02, 2019 4:35 am
by AshleyL_TEFOLPTYLTD
Hey Guys,

We are working on moving the code for some of our controllers here from MicroC to Flowcode;

the issue I am currently struggling to solve is the draw speed of images to a TFT Proto display, MI0283QT-9A (RS: 791-6378), from a PIC18F87J50, with a 8MHz external crystal oscillator.

I found that whilst it runs at a reasonable speed in the simulation (although still quite slow), it runs roughly 4x slower. I tried playing around with the clock speeds to only minimal success whereas our old solution using MicroC runs almost 2x the speed that the simulation runs the screen draw.

I have included a test image with the code, in the actual solution I am drawing to almost the entire display with a similar pixel depth.

any help you provide would be much appreciated
Ash

Re: 18F87J50 - BMPDrawer Slow

Posted: Mon Sep 02, 2019 10:19 am
by Benj
Hi Ash,

Are you using the PLL to multiply the microcontroller speed? 8MHz directly is pretty slow and would explain the slow display.

Re: 18F87J50 - BMPDrawer Slow

Posted: Mon Sep 02, 2019 11:33 pm
by AshleyL_TEFOLPTYLTD
Benj wrote:Hi Ash,

Are you using the PLL to multiply the microcontroller speed? 8MHz directly is pretty slow and would explain the slow display.

Hey Benj,

Yeah I used the divide by 12 function in the "project options/configure" section which should've set it to run at 48MHz I thought. not sure if I need to be putting in a bit of C or something, if flowcode isn't actually writing that information to the chip or something else is causing it to run slow

Ash

Re: 18F87J50 - BMPDrawer Slow

Posted: Tue Sep 03, 2019 4:36 am
by QMESAR
Hi,
in my opinion you are not running at 48Mhz
why are you setting the OSCON and Tune registers when using external clock you should only enable PLL , I also do think your divide by 12 is wrong for an 8Mhz clock .
Check the datasheet Oscillator settings and set it properly

Re: 18F87J50 - BMPDrawer Slow

Posted: Tue Sep 03, 2019 6:06 am
by medelec35
Have you completed a 1 second test? its always worth doing that test.
Its the first thing I do when starting a new project.
At least you can determine if issue is with oscillator settings or not.

Re: 18F87J50 - BMPDrawer Slow

Posted: Tue Oct 29, 2019 3:44 am
by AshleyL_TEFOLPTYLTD
Hey Guys,

Thanks for all your replies, we have fixed the problem it is simply a case of misunderstood wording in how some of the settings are described.
in case it helps anyone else, we;

- set the clock speed (under build/project_options/general_options) to 48MHz
- set the 0x1 to 0xf7ac
- set the 0x2 to 0xffc5
- set the 0x3 to 0xfff8

so I found that the PLL Config needed to be set to what my external clocks speed was - 8MHz or divide by 2, and that my clock speed needed to be changed back in general options to 48MHz

and we also needed to set the OSCCON and OSCTUNE as below;

- OSCCON = 0b11110100
- OSCTUNE = 0b01000000

hope this might be useful to someone else in the future

kind regards
Ash