Again wishes for the Glcd..

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Mikat
Posts: 258
Joined: Wed Nov 29, 2006 6:32 pm
Location: Finland
Has thanked: 7 times
Been thanked: 36 times
Contact:

Again wishes for the Glcd..

Post by Mikat »

Hi.

I have been requested updates for the glcd component for a long time.
Now the prices of the tft displays has has gone so low that at least I like the see component for tft touchscreen..
Is there any change to get that kind of component, at least Pic 24 series has enough power to that, and threre seems to be 8bit nad 16bit library at the arduino for tft touchscreen...
Is it how hard to port the arduino code at the Flowcode?
How the other Flowcode users think about the glcd component, it would be nice to hear have any other same kind of thoughts...
If you think a display like this http://iteadstudio.com/store/index.php? ... cts_id=263
at that price, at least I don't see any reason to use monochrome glcd or the character lcd...
And that iTead display isn't the only one, same kind display can find in ebay below 24$....

So it would be nice to hear komments about that from other users, and the Matrix Multimedia developers.

Mika

User avatar
Steve
Matrix Staff
Posts: 3418
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: Again wishes for the Glcd..

Post by Steve »

Hi Mika,

Thanks for the post.

Whilst alpha-numeric displays generally use the same driver chip (or a clone), there are many different driver chips used in gLCDs. And of course, each one needs its own code and to be tested. It would be great to support all gLCDs in Flowcode, but the task is a massive one.

However, we are gradually improving our support for gLCDs and we have plans in V5 to make it easier for users (and ourselves) to create or modify the gLCD code in Flowcode so they can use their preferred module.

In fact, we currently have support for a touchscreen gLCD from 4D in Flowcode and we will soon be releasing an E-block for this module.

Mikat
Posts: 258
Joined: Wed Nov 29, 2006 6:32 pm
Location: Finland
Has thanked: 7 times
Been thanked: 36 times
Contact:

Re: Again wishes for the Glcd..

Post by Mikat »

Hi.

Yep, i know the driver problem, the character driver are almost all the same, and the monochrome glcd are often ks108 or tc6963..
And the tft controllers are quite a list...
The reason why I am asking is the arduino code how hard to port on the flowcode is that there http://henningkarlsen.com/electronics/library.php?id=39 is arduino code for HX8347-A, ILI9325D, ILI9327 and SSD1289 controllers.
And if the porting is possible, I am thinking to take it a "winter project"... So if you have some time to chekt the code of that link, and tell could it be modified to flowcode...

Just take a quick look at the codes, and the arduino code had some functions that the flowcode pic version doesn't support, like sin cos in the rotate character function.. But most of the code seem to be "pixel setting and calculating", so I take look the Flowcode glcd component, and it seem to have quite same functions..
So could it be possible to use flowcode glcd component as the "base", and just try to build new glcd_sendbyte macro, witch communicates via paraller bus of those controllers?
Of course at least the init macro must be changed too, could I but use the glcd component "pixel calculations" macros, so I don't have to to reinvent the wheel.
By the way, where is the flowcode glcd component ACSII table, it seems not to be in GLCD.C...

"In fact, we currently have support for a touchscreen gLCD from 4D in Flowcode." Could you clarify that?



Mika

User avatar
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: Again wishes for the Glcd..

Post by Benj »

Hello Mika,

Looking at the link you posted it seems that the code has been pre-compiled to stop you from porting it to another compiler. However there are generally loads of examples out there so we don't have to rely on the arduino pre-compiled nonsense.

Sin and cos can be done to a certain degree using a look up table approach, please see this article.
http://www.matrixmultimedia.com/article.php?a=50

dsPIC, ARM and AVR support sin and cos functions directly.

You could use one of the gLCD files here as a starting point or you could reverse engineer the gLCD component.
http://www.matrixmultimedia.com/Flowcode_Components.php

The ASCII data for the gLCD component is available in the EXT properties. If you compile the code to C then you will get the ascii data as an array.

We have a new range of E-block on route, 3 of these involve graphical display modules from 4D systems. We have a small colour LCD, A large LCD touchscreen and a VGA controller all of which are controlled using a single UART connection. The code for these is already part of Flowcode v4.5 though we have not currently added the settings in the gLCD component properties to allow them to be selected.

When v5 is released I would like to add as many gLCD controller IC's as possible so if you would like to help on this project by designing some more beta components then I should be able to support you.

Mikat
Posts: 258
Joined: Wed Nov 29, 2006 6:32 pm
Location: Finland
Has thanked: 7 times
Been thanked: 36 times
Contact:

Re: Again wishes for the Glcd..

Post by Mikat »

Good morning Ben.

I try to get something out.
The multiple controllers is some kind of problem...
I think that I start those controllers witch are in the arduino code example, it seems that only the init and the "data sent" parts are different..
The problem is that I don't have very much extra time, I am studying at electrical engineer, and taking care of my 3,5 year daughter...
So I probably need quite a lot of help, especially because I am very poor at programming...
But I take a little bit look at the flowcode glcd component, and try to understand it..
On thing is that I need to use those displays at landscape orientation, so I look the print macro...

Can I have landscape orientation at the character if the part of the print macri is modified at this:

Code: Select all

// for portrait

for (xpix=0;xpix<6;xpix++)    //For 6 ASCII bytes 0 - 5 loop vaakarivit 0-5  
        {
            for (width=0;width<Fontwidth;width++) // loop  fontin leveysasetus
            {
                ycount = 0;
                for (ypix=0;ypix<8;ypix++)    //For 8 data bits in bytes 0 - 7 //loop pystyrivit 0-7  
                {
                    for (height=0;height<Fontheight;height++) // loop  fontin korkeusasetus
                    {
                        if (test_bit(temp[xpix],ypix)) // test onko kys pixeli piirrettävä
                        {
                            Plot(X + xcount, Y + ycount); //  pixeli x+ pystyrivi, y+ vaakarivi
                        }
                        else if (Transparent == 0)
                        {
                            gLCD_Window(X+xcount+1, Y+ycount+1, X+xcount+1, Y+ycount+1);
                            gLCD_SendByte(MX_GFXLCD_PARAM, GFX_Back_Color);
                        }
                        ycount++;
                    }
                }
                xcount++;
            }
        }
    }
	
To this:

Code: Select all

	// for landscape
	for (ypix=0;ypix<6;ypix++)    //For 6 ASCII bytes 0 - 5 loop vaaka rivit 0-5  
        {
            for (width=0;width<Fontwidth;width++) // loop  leveysasetus
            {
                ycount = 0;
                for (xpix=0;xpix<8;xpix++)    //For 8 data bits in bytes 0 - 7 //loop pystyrivit 0-7  
                {
                    for (height=0;height<Fontheight;height++) // loop fontin korkeusasetus
                    {
                        if (test_bit(temp[xpix],ypix)) // test onko kys pixeli piirrettävä
                        {
                            Plot((X + 8) - xcount, Y + ycount); //  pixeli (x+8)- pystyrivi, y+ vaakarivi
                        }
                        else if (Transparent == 0)
                        {
                            gLCD_Window(X+xcount+1, Y+ycount+1, X+xcount+1, Y+ycount+1);
                            gLCD_SendByte(MX_GFXLCD_PARAM, GFX_Back_Color);
                        }
                        ycount++;
                    }
                }
                xcount++;
            }
        }
    }
So what I am trying to do there is rotate the character 90deg at clockwise....

T:MIka

Mikat
Posts: 258
Joined: Wed Nov 29, 2006 6:32 pm
Location: Finland
Has thanked: 7 times
Been thanked: 36 times
Contact:

Re: Again wishes for the Glcd..

Post by Mikat »

Ben, any comments about that code?


Mika

User avatar
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: Again wishes for the Glcd..

Post by Benj »

Hello Mika,

Looks ok to me, the main question is have you tried it out on the hardware? Let me know if not and I will have a better look for you.

Mikat
Posts: 258
Joined: Wed Nov 29, 2006 6:32 pm
Location: Finland
Has thanked: 7 times
Been thanked: 36 times
Contact:

Re: Again wishes for the Glcd..

Post by Mikat »

No i haven't try..
My point was just that can it be done that way, and am I understand how that print character code works...
Ill try first to get the ks108 monochrome work at 90deg rotated, and if I can do that then I order the 240x320 tft, make pcb and start to play with it...
I had couple other projects going on, the 5-8 Amp 3 phase charger on 5Hp outboard engine (quite limited space 130x12mm), and the bldc motor on car wiper motor, so the time for the tft project is now quite limited, maybe winter I have more time...


Mika

Mikat
Posts: 258
Joined: Wed Nov 29, 2006 6:32 pm
Location: Finland
Has thanked: 7 times
Been thanked: 36 times
Contact:

Re: Again wishes for the Glcd..

Post by Mikat »

Hi.

Little bit of progress, the custom component wont crash the Flowcode anymore, but I can't get it compiled, few macros gives error "//Error Reading Code For default:" and I can't find why, so more help needed... Component file attached...
By the way Ben what does the gLCD_Window macro at the flowcode color glcd component?
Attachments
PIC_custom2.c
(26.64 KiB) Downloaded 398 times

User avatar
Steve
Matrix Staff
Posts: 3418
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: Again wishes for the Glcd..

Post by Steve »

There are lots of issues with this code.

There's a missing semicolon near the end of the <LCD_Set_Back_Color> function.

This line is wrong: lowByte = char LCD_Back_Color;

You'd be better off removing the "GetDefines" hidden function and putting the defines in a /*DefinesCode_Start*/ & End section.

The "paramtypes" for some of the functions are not enumerated (i.e. do not start with 1=char, etc.).

Mikat
Posts: 258
Joined: Wed Nov 29, 2006 6:32 pm
Location: Finland
Has thanked: 7 times
Been thanked: 36 times
Contact:

Re: Again wishes for the Glcd..

Post by Mikat »

Steve could you clarify me this a little bit...
"The "paramtypes" for some of the functions are not enumerated (i.e. do not start with 1=char, etc.)."

User avatar
Steve
Matrix Staff
Posts: 3418
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: Again wishes for the Glcd..

Post by Steve »

Instead of things like this...

Code: Select all

[MacroParameters_LCD_Set_Back_Color]
char
char
char
...you need to have this...

Code: Select all

[MacroParameters_LCD_Set_Back_Color]
1=char
2=char
3=char

Mikat
Posts: 258
Joined: Wed Nov 29, 2006 6:32 pm
Location: Finland
Has thanked: 7 times
Been thanked: 36 times
Contact:

Re: Again wishes for the Glcd..

Post by Mikat »

Hi.

I am blind, I am definitely blind... :shock:
I'll try to search error on those parameter, but no...
But let's get back to subject.
I'll fix those errors you point, and few others, and now the component goes through the compiler. BUT there are 3 macros witch won't compile...
The macros LCD_Init , LCD_Display_Clear and LCD_Set_Pixel gives this kind of error in program c-code "//Error Reading Code For default:"...
So if you kindly could look the code whats wrong with those macros, I've try to look them for hours, but no..
Sorry to bother you Steve, but I am a real rookie what comes to programming, and I really like to have that tft component for ssd1289 (and il9320, il9325) driver chips..
Probably if I get the component working, the code will be quite easy to modify other drivers too, if the driver uses the 8080 system bus interface, the only thing witch need to modify, is the init code...

But here is the files...
The code is not ready to drive display, it need lot of changes in pixel settings, but first I like to have it compiled ok..
Attachments
Flowcode1.msg.txt
Comp messages
(2.21 KiB) Downloaded 319 times
Flowcode1.c
Program C file
(23.1 KiB) Downloaded 331 times
PIC_Custom2.c
Component
(26.83 KiB) Downloaded 297 times

User avatar
Steve
Matrix Staff
Posts: 3418
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: Again wishes for the Glcd..

Post by Steve »

Problems here:

Code: Select all

...
[MacroParameters_LCD_Set_Fore_Color]
1=char
2=har
3char

...

[MacroParameters_LCD_Set_Back_Color]
1=char
2=har
3char

...
Plus, put all code between these tags:

Code: Select all

/*Macro_GetDefines_Start*/
...
...
/*Macro_GetDefines_End*/
into a new section:

Code: Select all

/*DefinesCode_Start*/
...
...
/*DefinesCode_End*/
When you do this, you need to remove the following lines at the start and end:

Code: Select all

}  //Dummy end of function to allow defines to be added correctly
and

Code: Select all

// Dummy function to close the defines section off
void CUSTOM_Dummy_Function();
void CUSTOM_Dummy_Function()


	{
You also have two bits like the following and need to remove one of them:

Code: Select all

/*InitialisationCode_Start*/
/*InitialisationCode_End*/

/*InterruptCode_Start*/
/*InterruptCode_End*/
And this line is in error;

Code: Select all

lowByte = char LCD_Back_Color;

Mikat
Posts: 258
Joined: Wed Nov 29, 2006 6:32 pm
Location: Finland
Has thanked: 7 times
Been thanked: 36 times
Contact:

Re: Again wishes for the Glcd..

Post by Mikat »

Done all of those..
Still those 3 macros won't compile to c file, same error as above...
Here is the fixed files...
Attachments
PIC_Custom2.c
Component
(26.6 KiB) Downloaded 316 times
Flowcode1.msg.txt
Messages
(2.13 KiB) Downloaded 301 times
Flowcode1.c
Program c file
(22.66 KiB) Downloaded 304 times

User avatar
Steve
Matrix Staff
Posts: 3418
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: Again wishes for the Glcd..

Post by Steve »

The code still has lots of errors. For example:

Code: Select all

[MacroParameters_LCD_Set_Fore_Color]
1=char
2=har
3=char

...

[MacroParameters_LCD_Set_Back_Color]
1=char
2=har
3=char
Also, the 3 macros which do not compile fail because some the /*...*/ tags have an additional tab character at the end (I had to use a HEX editor to work this out).

And there are other compilation issues because you are not defining these at all in your code:

Code: Select all

#define MX_DATA_PORT 		%a
#define MX_DATA_TRIS		%b
#define MX_CONTROL_PORT		%c
#define MX_CONTROL_TRIS		%d
#define MX_CS	      %e
#define MX_CD		%f
#define MX_RD		%g
#define MX_RW			%h

Mikat
Posts: 258
Joined: Wed Nov 29, 2006 6:32 pm
Location: Finland
Has thanked: 7 times
Been thanked: 36 times
Contact:

Re: Again wishes for the Glcd..

Post by Mikat »

Thanks.

Removing that extra tab fixed the problem...
Yep seems that I am blind...
Isn't those dataport etc. defined in Flowcode, the component properties tab?
At least those seems to be in program c code

Code: Select all

//Custom2(0): //Defines:
#include <string.h>

//Common defines
#define MX_DATA_PORT 		portc
#define MX_DATA_TRIS		trisc
#define MX_CONTROL_PORT		portd
#define MX_CONTROL_TRIS		trisd
#define MX_CS	      1
#define MX_CD		2
#define MX_RD		3
#define MX_RW			4


Or am I wrong again?

Mika

User avatar
Steve
Matrix Staff
Posts: 3418
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: Again wishes for the Glcd..

Post by Steve »

You are using the custom component, not the gLCD component. The custom component has a "custom" property screen (and no component connection screen).

A better approach may be to develop your code by editing the actual gLCD component C code file. However, do make sure you maintain a backup of the original if you do this.

Alternatively, you can use the standard gLCD component (with the original C code file) and use Flowcode V4's "code customization" feature to alter the macros for the component. Once you have this working, you can then drag the code out and create your own C code component file from it.

Mikat
Posts: 258
Joined: Wed Nov 29, 2006 6:32 pm
Location: Finland
Has thanked: 7 times
Been thanked: 36 times
Contact:

Re: Again wishes for the Glcd..

Post by Mikat »

Hi.

Ok. At the moment I am editing the custom glcd component, and thinking to use that component like the ks108 diplays...
I don't even know the hardware pin setup yet, the display probably arrives at next week, and the most important thing is to get the "low level" driver working (the 8080 bus), I think that is the hardest part... I just take macros for the PIC_glcd component, because the is the color setup ready... I am so rookie at the programming, so I don't want to start this for a empty screen...
But now I think I'll wait the hardware, and then get back to business.. But big thanks for you Steve, you havr e been very big help to me, again...

Mika

Mikat
Posts: 258
Joined: Wed Nov 29, 2006 6:32 pm
Location: Finland
Has thanked: 7 times
Been thanked: 36 times
Contact:

Re: Again wishes for the Glcd..

Post by Mikat »

Hi guys.

The display arrived yesterday, and some progress has come.
Ssd1289 small.JPG
Ssd1289 small.JPG (32.32 KiB) Viewed 16178 times
Now the code needs quite lot of work, the display has some interference, and the code could be faster, because the ssd1289 increments the vertical address counter automatic, and the horizontal mode need to be done..
But it works... :D

Mika

Sparkoids
Posts: 267
Joined: Mon Sep 14, 2009 10:34 am
Has thanked: 30 times
Been thanked: 19 times
Contact:

Re: Again wishes for the Glcd..

Post by Sparkoids »

If this type of display ever gets released for Flowcode please put me down for one...

Well done Mika!

Mikat
Posts: 258
Joined: Wed Nov 29, 2006 6:32 pm
Location: Finland
Has thanked: 7 times
Been thanked: 36 times
Contact:

Re: Again wishes for the Glcd..

Post by Mikat »

Sparkoids wrote:If this type of display ever gets released for Flowcode please put me down for one...
Well, I will share the custom component when I get it ready, it takes probably few months.. But the hardware is other thing, it's up to you or the Matrix Multimedia...
At the moment I am stuck at the 16bit 8080 bus, because those displays are hardwired with the ps pins(DAMN!), which are used for bus selection. The drawback for the 16bit bus is that the display takes 20 i/o pins, and the speed isn't that much better tahn 8bit...
Ben or Steve, how can I edit the custom component, that the ext properties box have more than 10 rows of the defines?
Because I need at least 12....


Mika

Mikat
Posts: 258
Joined: Wed Nov 29, 2006 6:32 pm
Location: Finland
Has thanked: 7 times
Been thanked: 36 times
Contact:

Re: Again wishes for the Glcd..

Post by Mikat »

Seems that I am talking quite alone here, but let's put some update again..
This is what the project looks now..
landscape.JPG
landscape.JPG (35.74 KiB) Viewed 16149 times
The code runs quite fast, the display is updated in that picture about 2,5 times per second, and that faster I can't get it running...
The MCU is 18F4620 @ 40MHz..

Ben or Steve, is there any way to get more those defines in custom component?

User avatar
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: Again wishes for the Glcd..

Post by Benj »

Hello,

I dont think there is an easy way to add more defines into the custom component but Steve will have a better idea about this.

Great you have got it working though. Maybe you could hard code any extra definitions into the C file for now?

To get the display updating faster you could maybe use a dsPIC33 running at 80MIPs rather then your current device running at 10MIPS.

Mikat
Posts: 258
Joined: Wed Nov 29, 2006 6:32 pm
Location: Finland
Has thanked: 7 times
Been thanked: 36 times
Contact:

Re: Again wishes for the Glcd..

Post by Mikat »

Well, the update speed is quite ok for me..
But it's hard to get faster, now the code uses lot of the auto increment of address counter, so the MCU just updates the data and control ports, and the address counter when the x address changes...
I try to test the display at 18F46k80 @64MHz, but the pickit 2 don't support the k80 versions, not even the newest device file :?
If the definition is hard to add, maybe I could just use global variables, like the landscape variable, which is set to 1 at the component code and if the display is set to portrait, use c code to set the landscape variable to 0, and depending that variable decide to which code to use, how about that?
Another problem is the touchscreen, it uses the Spi bus, but the data port uses those pins, so I need to move 64 pin devices to test the touchscreen :(

Post Reply