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
18F87J50 - BMPDrawer Slow
Moderator: Benj
-
- Posts: 3
- Joined: Mon Sep 02, 2019 3:38 am
- Been thanked: 1 time
- Contact:
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: 18F87J50 - BMPDrawer Slow
Hi Ash,
Are you using the PLL to multiply the microcontroller speed? 8MHz directly is pretty slow and would explain the slow display.
Are you using the PLL to multiply the microcontroller speed? 8MHz directly is pretty slow and would explain the slow display.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 3
- Joined: Mon Sep 02, 2019 3:38 am
- Been thanked: 1 time
- Contact:
Re: 18F87J50 - BMPDrawer Slow
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
- QMESAR
- Valued Contributor
- Posts: 1287
- Joined: Sun Oct 05, 2014 3:20 pm
- Location: Russia
- Has thanked: 384 times
- Been thanked: 614 times
- Contact:
Re: 18F87J50 - BMPDrawer Slow
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
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
https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: 18F87J50 - BMPDrawer Slow
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.
Its the first thing I do when starting a new project.
At least you can determine if issue is with oscillator settings or not.
Martin
-
- Posts: 3
- Joined: Mon Sep 02, 2019 3:38 am
- Been thanked: 1 time
- Contact:
Re: 18F87J50 - BMPDrawer Slow
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
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