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

CFAG128128B Driver

cubicleman

New member
Hoping someone can help me. I've inherited some C code for a microcontroller that displays information on a CFAG128128 LCD. The code makes some calls lcd_graphics_move, lcd_write_command, etc. I assume it requires compilation and linking with drivers for this LCD. Where can I get the drivers for the CFAG128128B-TMIVZ LCD?

Some additonal info: I'm using Microchip's MPLAB ICD3 with it's Hi-Tech software PICC18 C compiler for an 18F4525.

Thanks in advance for any advice / information.
Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.
 
Here is a link to a thread that has attached source code that you might be able to use: https://forum.crystalfontz.com/show...160B-font-editor-and-C-code&p=19164#post19164
Note that even though the topic is "CFAG160160B", the CFAG128128B uses the same controller chip, and I have used this code on both displays successfully. You will have to use slightly different init sequence values for the smaller display. You would have to change some function names to use this GRLCD.c "driver" code with your app code, and compile them together, but thats no big deal.

You can ignore the fontedit files in that zip file, as that program has been superceeded, as mentioned in the post. But the font files themselves (and others in the new editor linked to) will be necessary if you are doing text in graphics mode. If you are using character mode, then this doesn't apply.

There are several threads dealing with the similarities of those two displays, and I have done a fair amount of troubleshooting these displays, so you should do forum level searches on each of the part numbers, and read about what was discussed in those threads. It will clarify some problems that may occur if you don't do the correct init sequence.

If you have more questions, ask.
 

cubicleman

New member
Cosmic...much thanks. I've resolved most of the LCD functionality, but I can't seem to get the ADC functionality working. I'm using a Hi-Tech C compiler with MicroChip's MPLAB IDE. It gets the following error:

Error [500] C:\Program Files\HI-TECH Software\PICC-18\STD\9.52\lib\pic861-c.lib(wtoft.obj), 0 undefined symbols
_mul(PRF_GLCD_PIC.obj) _output_low(PRF_GLCD_PIC.obj) ?_mul(PRF_GLCD_PIC.obj) _make8(PRF_GLCD_PIC.obj) ?_output_low(PRF_GLCD_PIC.obj) ?_make8(PRF_GLCD_PIC.obj) ?_output_high(PRF_GLCD_PIC.obj) ?_output_d(PRF_GLCD_PIC.obj) _read_adc(PRF_GLCD_PIC.obj) _output_high(PRF_GLCD_PIC.obj) ?__sprintf(PRF_GLCD_PIC.obj)....

it seems like the library doesn't know these functions (make8, sprintf, output_low, output_high, output_d, read_adc, delay_ms, delay_us).

In my searches for similar items on web, I see people using make8 to basically split a 16 bit integer into 2 registers. I assume I don't have something configured in the Microchip/HI-TECH sdk correctly. Do I need to somehow get another library to be used? It looks like it generated the object file (PRF_GLCD_PIC.obj) so I'm assuming it's a link issue.
 
... it seems like the library doesn't know these functions (make8, sprintf, output_low, output_high, output_d, read_adc, delay_ms, delay_us).

In my searches for similar items on web, I see people using make8 to basically split a 16 bit integer into 2 registers. I assume I don't have something configured in the Microchip/HI-TECH sdk correctly. Do I need to somehow get another library to be used? It looks like it generated the object file (PRF_GLCD_PIC.obj) so I'm assuming it's a link issue.
You can probably write some of these helper functions yourself, and put them into another file that's part of your project. Be sure to put the function prototypes in a header file that is #include'ded in the other files.

You're probably right about make8(); and output_low(), output_high() sound similar; I can't guess what output_d() is supposed to do. Maybe if you attached part of your code file, I could tell from the context what these functions are expected to do. As for delay_ms() and delay_us(), those sound like millisecond and microsecond delays, which would have to be written taking your cpu speed into account. For best accuracy, a cpu timer would be used; otherwise just a count-down loop where you set some value experimentally to get the loops to take 1 us or 1 ms to complete.

To get sprintf(), you'll have to link to your compiler's "stdio" library. The read_adc() will presumably have to start a read cycle on the ADC channel, wait for data to convert, and return the converted value.

Are you experienced at writing C code? Maybe your compiler has some of these kinds of functions already in some library, and you just simply need to include that library's header file in your app file, and link to it. I have used MPLAB, but I don't use PIC chips often, and I use assembly language for small programs, so I'm not familiar what's included in the C libraries that come with the package.
 
Top