GLCDs
GLCDs
Hi,
I am currently trying to get a GLCD working using flowcode. The module I am working on uses the KS0108 controller chip, which seems to be quite common for these mono dot matrix LCDs. Unlike the small 2/4 line LCDs, the datasheets seem to be quite unhelpful...
....So has anyone else been working with these? If so any help would be GREATLY appreciated...
I don't supose Matrix have ever considered writing a component for one of these? We use the 2 line LCD component a lot and have found it really easy to use.
Many thanks in advance for any help anybody can give.
- 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: GLCDs
Hello
There is now a beta Flowcode component to drive KS0108 and KS0107 mono 128 x 64 pixel displays.
This code is available from here,
http://www.matrixmultimedia.com/Flowcode_Components.php
There is now a beta Flowcode component to drive KS0108 and KS0107 mono 128 x 64 pixel displays.
This code is available from here,
http://www.matrixmultimedia.com/Flowcode_Components.php
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: 258
- Joined: Wed Nov 29, 2006 6:32 pm
- Location: Finland
- Has thanked: 7 times
- Been thanked: 36 times
- Contact:
Re: GLCDs
Hi Ben.
I quickly tested that Glcd beta component,and it works fine..
But it dont have print number macro,so how an i print some like a/d con value?
And is it possible to reduce "default" font size to 5x7 or even 6x4?
I know that those font sizes are really small,but it gives little smaller font on double font size and that is usefull at least to me...
I quickly tested that Glcd beta component,and it works fine..
But it dont have print number macro,so how an i print some like a/d con value?
And is it possible to reduce "default" font size to 5x7 or even 6x4?
I know that those font sizes are really small,but it gives little smaller font on double font size and that is usefull at least to me...
- 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: GLCDs
Hello
Sorry I missed off the print number function. This updated component code file should now provide the print number functionality.
As for changing font sizes yes this is possible. Theoretically all you would have to do is edit the font arrays that are defined near the start of the component code. If you scaled down the values of each byte so that the 2 least significant bits are always 0 then there is your 6 pixel font etc.
Sorry I missed off the print number function. This updated component code file should now provide the print number functionality.
As for changing font sizes yes this is possible. Theoretically all you would have to do is edit the font arrays that are defined near the start of the component code. If you scaled down the values of each byte so that the 2 least significant bits are always 0 then there is your 6 pixel font etc.
- Attachments
-
- KS0108.zip
- (8.48 KiB) Downloaded 603 times
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
- 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: GLCDs
Hello
The connections for the Graphic LCD are laid out in the custom code c file. Please refer to the readme for instructions on how to change the pins / ports for the LCD.
The connections for the Graphic LCD are laid out in the custom code c file. Please refer to the readme for instructions on how to change the pins / ports for the LCD.
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: 258
- Joined: Wed Nov 29, 2006 6:32 pm
- Location: Finland
- Has thanked: 7 times
- Been thanked: 36 times
- Contact:
Re: GLCDs
Ben,tested the new component,it prints the number but when i set the print number macro,and print the variable witch is 3 digit long,the display prints the number 7 digit long,and the 4 last number are the same..
Same thing with the print string macro,if the string size is 5 and the string is like 12,3,the display prints 12,33..
Is there bug,or something what i dont understand?
By the way,is it possible to use onewire temp sensor component and the ks108 component at same program,both are custom component,so it seems impossible...
Same thing with the print string macro,if the string size is 5 and the string is like 12,3,the display prints 12,33..
Is there bug,or something what i dont understand?
By the way,is it possible to use onewire temp sensor component and the ks108 component at same program,both are custom component,so it seems impossible...
- 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: GLCDs
Hello Mikat
Ok I will look into the problem of the numbers being repeated. I did not notice this during testing.
In the latest version of Flowcode 3.4.7 there is custom code 2 that can be used. Therefore you can have the onewire code in your program too by renaming one of the custom_code.c files to custom_code2.c
Ok I will look into the problem of the numbers being repeated. I did not notice this during testing.
In the latest version of Flowcode 3.4.7 there is custom code 2 that can be used. Therefore you can have the onewire code in your program too by renaming one of the custom_code.c files to custom_code2.c
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: 258
- Joined: Wed Nov 29, 2006 6:32 pm
- Location: Finland
- Has thanked: 7 times
- Been thanked: 36 times
- Contact:
Re: GLCDs
Ben,have you got time to check that print problem?
I tested i bit more,and it seems that printnumber print 6 number,no matter what,so its the same it the value of printed variable 2 or 22222,the print is 222222...
And the printstring function prints the lenght of string,even if the string value is 2...
By the way,the i2c,custom1 and 2 component have custom_dummy_functions,so it dont compile if two of those components are used...
I solve the problem by renaming those custom1,custom2 etc,is it ok...
I tested i bit more,and it seems that printnumber print 6 number,no matter what,so its the same it the value of printed variable 2 or 22222,the print is 222222...
And the printstring function prints the lenght of string,even if the string value is 2...
By the way,the i2c,custom1 and 2 component have custom_dummy_functions,so it dont compile if two of those components are used...
I solve the problem by renaming those custom1,custom2 etc,is it ok...
- 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: GLCDs
Hello
Sorry I have spotted the bug and fixed the problem in the C code driver. Attached is the updated C code file.
Sorry I have spotted the bug and fixed the problem in the C code driver. Attached is the updated C code file.
- Attachments
-
- Custom_Code.c
- (22.04 KiB) Downloaded 480 times
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: 258
- Joined: Wed Nov 29, 2006 6:32 pm
- Location: Finland
- Has thanked: 7 times
- Been thanked: 36 times
- Contact:
Re: GLCDs
Ben,the print number macro works fine now,but should the print string macro print the lengt of string,even if the value is shorter,like str[6],and value is 2,should it print 222222?
By the way,how i get the degree sing (Β°) in that custom glcd?
By the way,how i get the degree sing (Β°) in that custom glcd?
- 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: GLCDs
Hello Mikat
I will look into the string problem for you as it should only print out the data held in the string.
As for adding the degree sign. Have a look in the custom code .c file for the ASCII data array. Simply choose an ASCII character that you are unlikley to use and edit the data so that you create the degree character. Then send the ASCII value that you chose to overwrite and the degree symbol will appear. The data is arranged into 5 columns each with 8 rows, therefore each character is defined by 5 byte variables.
I will look into the string problem for you as it should only print out the data held in the string.
As for adding the degree sign. Have a look in the custom code .c file for the ASCII data array. Simply choose an ASCII character that you are unlikley to use and edit the data so that you create the degree character. Then send the ASCII value that you chose to overwrite and the degree symbol will appear. The data is arranged into 5 columns each with 8 rows, therefore each character is defined by 5 byte variables.
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
- 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: GLCDs
Hello
Ok I have ironed out the print string bug now too. Hopefully this should all be ok now. Let me know if there are any more bug spots.
Ok I have ironed out the print string bug now too. Hopefully this should all be ok now. Let me know if there are any more bug spots.
- Attachments
-
- Custom_Code.c
- (22.01 KiB) Downloaded 397 times
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
Re: GLCDs
Hi Ben,
Haven't been in the forum for quite a time as I have been working on other projects. But, I am now to be back on the control panel project which sparked my original query - almost a year down the line. I did manage to get PICs to generate text on the display by manually sending the correct sequence of instruction codes and data bytes, it was nice to see things on the screen but was way too cumbersome for what we needed to do.
Anyway, now I have surfed back in to catchup on all things Flowcode I will have a play with the macro.
Many thanks for the help you have provided (even though I haven't personally used it as yet).
Now to post a new thread with a query regarding CAN.
Best Regards
Dan
Haven't been in the forum for quite a time as I have been working on other projects. But, I am now to be back on the control panel project which sparked my original query - almost a year down the line. I did manage to get PICs to generate text on the display by manually sending the correct sequence of instruction codes and data bytes, it was nice to see things on the screen but was way too cumbersome for what we needed to do.
Anyway, now I have surfed back in to catchup on all things Flowcode I will have a play with the macro.
Many thanks for the help you have provided (even though I haven't personally used it as yet).
Now to post a new thread with a query regarding CAN.
Best Regards
Dan
-
- Posts: 258
- Joined: Wed Nov 29, 2006 6:32 pm
- Location: Finland
- Has thanked: 7 times
- Been thanked: 36 times
- Contact:
Re: GLCDs
Hi Ben. The print string macro seems to working right now,many thanks..
When you have time,could you change the custom c code,so the data port and the cs1,cs2,enable,etc could be changed in component properties box in Flowcode...
Now i had to edit the custom c file every time when i compile code for different pcb layout...
When you have time,could you change the custom c code,so the data port and the cs1,cs2,enable,etc could be changed in component properties box in Flowcode...
Now i had to edit the custom c file every time when i compile code for different pcb layout...
- 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: GLCDs
Hello Mikat
Glad its all working correctly now.
Modifying the component code to allow you to define your own ports and pins in Flowcode is fairly simple.
Near the top of the Custom_Code.C file you will find the following section.
Simply replace with this.
Once you have done this you can enter the parameters directly into the properties of the custom component in Flowcode.
Unfortunatly this way means that you will have to re-enter the parameters for every program you create that uses the custom component. A work around for this is to create a blank Flowchart containing a custom component, define your connections as needed and then use this file as a template for creating programs with that particular set of pin connections.
Glad its all working correctly now.
Modifying the component code to allow you to define your own ports and pins in Flowcode is fairly simple.
Near the top of the Custom_Code.C file you will find the following section.
Code: Select all
//Common defines
#define MX_DATA_PORT portd //%a
#define MX_DATA_TRIS trisd //%b
#define MX_CONTROL_PORT portc //%c
#define MX_CONTROL_TRIS trisc //%d
#define MX_CS1 0 //%e
#define MX_CS2 1 //%f
#define MX_DAT_INST 2 //%g
#define MX_ENABLE 3 //%h
#define MX_READ_WRITE 4 //%i
Code: Select all
//Common defines
#define MX_DATA_PORT %a
#define MX_DATA_TRIS %b
#define MX_CONTROL_PORT %c
#define MX_CONTROL_TRIS %d
#define MX_CS1 %e
#define MX_CS2 %f
#define MX_DAT_INST %g
#define MX_ENABLE %h
#define MX_READ_WRITE %i
Unfortunatly this way means that you will have to re-enter the parameters for every program you create that uses the custom component. A work around for this is to create a blank Flowchart containing a custom component, define your connections as needed and then use this file as a template for creating programs with that particular set of pin connections.
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: 258
- Joined: Wed Nov 29, 2006 6:32 pm
- Location: Finland
- Has thanked: 7 times
- Been thanked: 36 times
- Contact:
Re: GLCDs
Hi Ben.
Is it how big job to modify that ks108 code to support 192x64 displays? I i understand correctly,the chip select just goes to 01 to 10 when the adress goes over 128...
Is there any change that you coul to that?
Mika
Is it how big job to modify that ks108 code to support 192x64 displays? I i understand correctly,the chip select just goes to 01 to 10 when the adress goes over 128...
Is there any change that you coul to that?
Mika
- 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: GLCDs
Hello Mika
Yes this should be fairly easy to do. You should be able to find the part of the C code that deals with the horizontal addressing and add in an extra address locations.
If you get stuck then let me know and I will take a look.
Yes this should be fairly easy to do. You should be able to find the part of the C code that deals with the horizontal addressing and add in an extra address locations.
If you get stuck then let me know and I will take a look.
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: 258
- Joined: Wed Nov 29, 2006 6:32 pm
- Location: Finland
- Has thanked: 7 times
- Been thanked: 36 times
- Contact:
Re: GLCDs
Ben,how can i mark that the adressa is between 2 values,like 63-127 in c language?
I mean that code
if(mx_currentx < 64)
{
clear_bit(MX_CONTROL_PORT, MX_CS2); //Select chip 1
set_bit(MX_CONTROL_PORT, MX_CS1);
}
else if(mx_currentx >= 64)
{
clear_bit(MX_CONTROL_PORT, MX_CS1); //Select chip 2
set_bit(MX_CONTROL_PORT, MX_CS2);
There should probably be that if the x adr is between 64 - 127 select chip 2...
By the way,how those clear and set goes in 3 "chip values"?
I mean that code
if(mx_currentx < 64)
{
clear_bit(MX_CONTROL_PORT, MX_CS2); //Select chip 1
set_bit(MX_CONTROL_PORT, MX_CS1);
}
else if(mx_currentx >= 64)
{
clear_bit(MX_CONTROL_PORT, MX_CS1); //Select chip 2
set_bit(MX_CONTROL_PORT, MX_CS2);
There should probably be that if the x adr is between 64 - 127 select chip 2...
By the way,how those clear and set goes in 3 "chip values"?
- 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: GLCDs
Hello
You can do the following.
if(mx_currentx < 64)
{
}
else if(mx_currentx >= 64 && mx_currentx < 128)
{
}
else if(mx_currentx >= 128)
{
}
The set and clear functions act to toggle a single bit (0-7) in a 8-bit register or variable.
Hope this helps.
You can do the following.
if(mx_currentx < 64)
{
}
else if(mx_currentx >= 64 && mx_currentx < 128)
{
}
else if(mx_currentx >= 128)
{
}
The set and clear functions act to toggle a single bit (0-7) in a 8-bit register or variable.
Hope this helps.
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: 258
- Joined: Wed Nov 29, 2006 6:32 pm
- Location: Finland
- Has thanked: 7 times
- Been thanked: 36 times
- Contact:
Re: GLCDs
Hi Ben.
I tried to got working that 192x64 display,but no luck,i cant get anything on that chip3 "area"....
By the way,the "normal" ks108 code draws pixels at 64 to 192,so the third chip is 0-63...
Ill take that back,got working,the problem was that the third chip goes firs,and uses cs command 00...
I tried to got working that 192x64 display,but no luck,i cant get anything on that chip3 "area"....
By the way,the "normal" ks108 code draws pixels at 64 to 192,so the third chip is 0-63...
Ill take that back,got working,the problem was that the third chip goes firs,and uses cs command 00...
-
- Posts: 258
- Joined: Wed Nov 29, 2006 6:32 pm
- Location: Finland
- Has thanked: 7 times
- Been thanked: 36 times
- Contact:
Re: GLCDs
Ben,do you have change to test that ks108 code so that you move the controlport to portb?
Because i have tried to get it working but no way,it wont work on port b,the init messes the whole port working,if i set the control pins at b7 to b3,and put the blinking led at b0,the led works untill i put the init lcd macro to flowline...
It would be very nice to have that code work other port than portc,because the timer 1 osc,pwm,spi/i2c and rs232 is that port,so it has many other use..
Because i have tried to get it working but no way,it wont work on port b,the init messes the whole port working,if i set the control pins at b7 to b3,and put the blinking led at b0,the led works untill i put the init lcd macro to flowline...
It would be very nice to have that code work other port than portc,because the timer 1 osc,pwm,spi/i2c and rs232 is that port,so it has many other use..
- 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: GLCDs
Hi Mikat
Yeah its fairly easy to switch port of the driver file. Open the file and browse to the following section of code.
Change the port and tris registers to suit your application. You can even change the control pin allocation if you wish by editing the numbers.
Yeah its fairly easy to switch port of the driver file. Open the file and browse to the following section of code.
Code: Select all
#define MX_DATA_PORT portd //%a
#define MX_DATA_TRIS trisd //%b
#define MX_CONTROL_PORT portc //%c
#define MX_CONTROL_TRIS trisc //%d
#define MX_CS1 0 //%e
#define MX_CS2 1 //%f
#define MX_DAT_INST 2 //%g
#define MX_ENABLE 3 //%h
#define MX_READ_WRITE 4 //%i
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: 258
- Joined: Wed Nov 29, 2006 6:32 pm
- Location: Finland
- Has thanked: 7 times
- Been thanked: 36 times
- Contact:
Re: GLCDs
The port and the pins are configured in flowcode,like you advise above,the problem is that the code dont work if i change the control pins on portb...
The code allows fine the change the control pins,but i can get it working when i change the controlport.
so can you test that code works controls on portb?
The code allows fine the change the control pins,but i can get it working when i change the controlport.
so can you test that code works controls on portb?