• We recently switched our forum platform. If you experience any issues please email support@crystalfontz.com

Text/graphic C code for CFAF320240

Since I got this display a week ago, I have been experimenting a bit. I ported over my text and graphics stuff from another project, and I am making it available here. Its not very sophisticated, but its free.

BTW, the font files are in "column" format. I don't have any larger character sizes at the moment.

Edit 3/26/10: Update zip file to add improvements, AVR code version. Tested on a modified CFA-10006, with an ATmega2561 cpu. I'm also including the font raw files, so you can modify them with my editor.
Edit 3/30/10: Update to version "d", fix bugs in switching between 8 and 16 bit modes, use malloc() for screen copy block to allow large block copies.

Edit 02/13/2014: See post #28 in this thread for the newest Font Editor build.
Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.
 

Attachments

Last edited:
S

shp

Guest
..Hello..

hello

u include eZ8.h file in GrlLCD.c program..

can u send me the code for this "eZ8.h" file

thanks in advance..
 
Last edited:
The "eZ8.h" file is referenced in my source code because I did the project on an "Encore Z8" cpu dev board, and this file contains all of the Z8 environment definitions. If you are doing any development on a Z8, then you should have this file in your compiler suite. If you are NOT using a Z8 cpu, then this file will be of absolutely NO USE to you.

You will need to substitute the include file that is specific to your cpu, and also change the port and register names in the code to ones that are correct for your cpu. This is the case in virtually all code written for embedded processors: you must customize it for your hardware.

If you need help with that, I may (or may not) be able to help you.
 
S

shp

Guest
thanks for ur reply..

your program is ultimate..
I really need ur help..

I am using Hardware STK600 , JTAGICE2 , Display CFAF320240
Software AVR Studio 4.18 .SP1 (C language)

How can i use EZ8 file or another way to write program without using this file..??
Another question is how can i make project including more then one C files in it (AVR Studio)..??
Because you are using 4 different C files in your project...

I already write code for displaying character in CFAF320240 but without memory management so it support only 8 character pattern at a time..after it gives memory eroor..
please give your advice for this...??

Thanks in advance
 
I am using AVR Studio 4.18 .SP1 (C language). Another question is how can i make project including more then one C files in it (AVR Studio)..?? Because you are using 4 different C files in your project...
It looks like you have not learned how to use the AVR Studio. First you create a project. Then under "Source Files", you "Add Existing Source File(s)...", and select all 4 *.c files. Then under "Header Files", you "Add Existing Header File(s)...", and select all 4 *.h files.
How can i use EZ8 file or another way to write program without using this file..??
Did you read my previous post, where I said:
You will need to substitute the include file that is specific to your cpu, and also change the port and register names in the code to ones that are correct for your cpu.
I guess you did not. For your cpu you will need to include "avr/io.h", and "avr/pgmspace.h".

Since you have not posted any of your code, I can not give any further advice.
 
I decided to port my code to an AVR platform, using a slightly butchered CFA-10006 demo board, running an ATmega2561. The first post in this thread has been updated with new files.
 
S

shp

Guest
..Ultimate Work..

hello..COSMICVOID

ur work is very nice..

From ur answer i just add ur all .c & .h files in one project & try to run..but it gives error..

../Font8.h:7: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'lentbl_S'
../Font8.h:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'chrtbl_S'
../Font8.c:3: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'lentbl_S'
../Font8.c:125: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'chrtbl_S'


i do not add Font16.h & Font16.c..because i try to do only for 8 font size..
I change include file with avr/io.h
I am using 8080 16 bit..i also change that in ur program..

please reply me for this problem..
Thanks in advance..
 
../Font8.h:7: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'lentbl_S'
../Font8.h:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'chrtbl_S'
Those errors are because you are using the old Z8 version, and the "rom" keyword does not exist in the AVR compiler.

I suggest that you delete the old Z8 version, and go back to the first post in this thread, where I have put the new AVR version, and download the new code, which also has some improvements. I know this version will compile in AVR Studio 4.18 with no errors, because thats what I am using.

The last screen picture is made with a newer version that I did not post the code, but only a few changes that you don't need.
 
S

shp

Guest
Hello..COSMICVOID

Thank u very much for ur answer...

hello..COSMICVOID

please explain how u can write character in Font8.h & Font16.h
if possible then send me the code of "Experimental Font" which u do in ur screen...

thanks in advance..
 
S

shp

Guest
..Hello

Hello..COSMICVOID..

I am sorry but i was not saw ur changed attechment..so i told u for Experiment Font code...

In ur program in each file u defining
typedef unsigned char BYTE;
typedef unsigned short WORD;


but i just define this statments in main program..

For displaying Experiment Font my program gives error like
undefined reference to `chrtbl_F'
undefined reference to `lentbl_F'

which tells there is no character table for F..
Please tell about this error..

i check ur program..i understand chrtbl_L & chrtbl_S table contains all possible values of all characters in Hexa..e.g For char-A Hexa value is 41 (chrL41 in program)..

but i will not understand how u can make pattern for A like this
const WORD chrL41[7] = { 0x1C00, 0x0380, 0x0260, 0x0218, 0x0260, 0x0380,
0x1C00 };


please explain this..

I try to open CV_FonEd file..but it gives error like "File array size too large"
Also tell about this..

Thanks in advance
 
Last edited:
In ur program in each file u defining
typedef unsigned char BYTE;
typedef unsigned short WORD;
but i just define this statments in main program..
Originally I had the typedefs in each header, and that was OK with the Zilog compiler, but the AVR regarded redundant typedefs as an error, so I had to change it. I decided the typedef include was best arrangement.
For displaying Experiment Font my program gives error like
undefined reference to `chrtbl_F'
undefined reference to `lentbl_F'
which tells there is no character table for F.. Please tell about this error..
You probably did not add the "fat_16.c" and "fat_16.h" to your project.
... i will not understand how u can make pattern for A like this
const WORD chrL41[7] = { 0x1C00, 0x0380, 0x0260, 0x0218, 0x0260, 0x0380, 0x1C00 };
please explain this..
Each WORD is one column of 16 bits height. The LSB is the top row, the MSB is the bottom row.
Code:
[SIZE="4"]1C00 0380 0260 etc.
  0   0   0  etc.
  0   0   0
  0   0   0
  0   0   0
  0   0   0
  0   0   1
  0   0   1
  0   1   0
  0   1   0
  0   1   1
  1   0   0
  1   0   0
  1   0   0
  0   0   0
  0   0   0
  0   0   0
[/SIZE]
In the LCDChar() function, each column is written to the screen, one bit for each row. This is the reason to set the controller to advance the cursor in the vertical direction, instead of the usual horizontal direction.
Code:
	LCDCmd(0x11);
	LCDData(0x6878);// set vertical addr increment, to write
			// pixels downward, column by column
I try to open CV_FonEd file..but it gives error like "File array size too large". Also tell about this..
I think you try to open a file that is not a raw font file; like maybe you try "font16.c". There are 3 font files in the zip that can be opened with CV_FontEd.exe: "font16", "font8", "fat_16", with no extension on the filename. Fat_16 is the 'experimental' font.

Where are you located?
 
S

shp

Guest
..Hello

Hello..COSMICVOID

Thank u for ur reply..
you are right..i forgot to include Fat_16.c file in project..
Now i have all files included in project..
thank you very much for ur explanation of character display....I try to understand that

if i want Font with size 20 then how can i make length table & character table..??

Thanks in advance
 
Last edited:
S

shp

Guest
hello..

hello..COSMICVOID

Explain me steps for length array & lenght table to creating font size 8 or font size 16..(which u make in ur project)...Using that way i want to make code for font size 20...

thanks in advance..
 
I assume that you are able to get the Font Editor to work, so you can see the bit patterns for all the characters in my files.

When the editor saves the "C" (or asm) output files, all the characters are checked to see how many columns of bits are used. If there are blank columns to the left of the first bits, those columns are included in the width count. Also, columns after the character can be included by putting an alternating bit pattern in the last column used (0x55 or 0xAA or 0x5555 or 0xAAAA). The editor will remove the [0x55/AA] and substitute a 0x00, counting all columns until that. This count is put into the lentbl_x[] array, to tell what is the width of each character in the file.
Code:
[SIZE="3"]const BYTE lentbl_L[96] =
{
        5, 4, 3, 8, 7, 8, 8, 2, 
        6, 6, 7, 5, 2, 5, 4, 6, 
.....[/SIZE]
So, the first char has 5 columns, the 2nd has 4 columns, etc.

The bits array for each char is a list of 16-bit numbers, one WORD for each column in the char. I explain that in my earlier post.
Code:
[SIZE="3"]const WORD chrL20[5] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 };
const WORD chrL21[4] = { 0x0000, 0x17F8, 0x0000, 0x0000 };
const WORD chrL22[3] = { 0x001C, 0x0000, 0x001C };[/SIZE]
The problem you will have with a 20 pixel high char is that you will have to use either 3 BYTES or 2 WORDS (or 1 unsigned long [32 bits]) to hold the 20 rows of bits. This will require a lot of changes in the LCDChar() function to handle different font sizes.

One other factor made me decide to limit my editor to only 16 bits size... the larger characters are difficult to design by hand to make them look nice. It is much easier to use one of the other font converter programs to take Windows Fonts and convert them to bitmap. Those will look much nicer than handmade.

Where are you located?
 
S

shp

Guest
hello..

hello...COSMICVOID

I try to understand LCDChar()..

In this function if i pass 'A' in this function then after a = chr - firstchr_L; statement which value pass Decimal (65 - 32) or Hexa (41 - 32) of 'A' ...
After this which value of 'A' going in this statements

len = lentbl_L[a]; // number of columns
bitp = chrtbl_L[a]; // bitmap data pointer


Also tell me about this statements

CJ_code & FONT16
mask & bits


can u please explain me this statements..

I try to understand LCDText()..
In this if i write strg.cj_code = FONT16 + ABSJ..then what is the value of column after this statement column = JustTbl - a...??

thanks in advance
 
Last edited:
Top