18F87J50 - BMPDrawer Slow

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

AshleyL_TEFOLPTYLTD
Posts: 3
Joined: Mon Sep 02, 2019 3:38 am
Been thanked: 1 time
Contact:

18F87J50 - BMPDrawer Slow

Postby AshleyL_TEFOLPTYLTD » Mon Sep 02, 2019 4:35 am

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
Attachments
Screen images test.rar
(255.11 KiB) Downloaded 25 times

User avatar
Benj
Matrix Staff
Posts: 14442
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4505 times
Been thanked: 4186 times
Contact:

Re: 18F87J50 - BMPDrawer Slow

Postby Benj » Mon Sep 02, 2019 10:19 am

Hi Ash,

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

AshleyL_TEFOLPTYLTD
Posts: 3
Joined: Mon Sep 02, 2019 3:38 am
Been thanked: 1 time
Contact:

Re: 18F87J50 - BMPDrawer Slow

Postby AshleyL_TEFOLPTYLTD » Mon Sep 02, 2019 11:33 pm

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

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1172
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 371 times
Been thanked: 593 times
Contact:

Re: 18F87J50 - BMPDrawer Slow

Postby QMESAR » Tue Sep 03, 2019 4:36 am

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
These users thanked the author QMESAR for the post:
Benj (Tue Sep 03, 2019 10:54 am)
Rating: 5.26%
 

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8476
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2435 times
Been thanked: 3487 times
Contact:

Re: 18F87J50 - BMPDrawer Slow

Postby medelec35 » Tue Sep 03, 2019 6:06 am

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.
These users thanked the author medelec35 for the post:
Benj (Tue Sep 03, 2019 10:53 am)
Rating: 5.26%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

AshleyL_TEFOLPTYLTD
Posts: 3
Joined: Mon Sep 02, 2019 3:38 am
Been thanked: 1 time
Contact:

Re: 18F87J50 - BMPDrawer Slow

Postby AshleyL_TEFOLPTYLTD » Tue Oct 29, 2019 3:44 am

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
These users thanked the author AshleyL_TEFOLPTYLTD for the post:
Benj (Tue Oct 29, 2019 10:48 am)
Rating: 5.26%