Phillips PCD8544 control


The LCD is connected to the arduino like in the example PCD8544 under the Playground section of the Arduino. I am currently using this library to talk to the LCD: Is there available a better library (one which might even allow me to use small graphics on the LCD)?

So far I managed to link a 3310 LCD to the arduino and display values, and draw lines of pixels. But I have a small question(hopefully small): how can I make a graph that modifies every time I measure a value from A0? I know I am supposed to manipulate each pixel (which I did but I get a line and that's about it) but my programming skills are.... low.

Thank you, A

If you checkout the development version of the library from svn, you'll see that it now has a method to draw bitmaps to the display.

You position the cursor where you want your bitmap to be drawn, and then you pass an array of bytes to the drawBitmap function (each byte corresponds to an 8-pixel column).

This means it is limited to displaying graphics whose height is a multiple of 8, but it clips the graphics if you draw too close to the edge... :)

The problem is that these displays are not pixel-addressable, you can only write 8 pixels at a time (a column), they also don't allow their internal memory to be read. To update a single pixel you have to redraw the column, which means you also have to keep the whole display state in RAM on the ATmega. I don't need to draw vector graphics on the display, so I haven't got around to implement generic drawing operations (not yet anyway).

But to answer your question specifically: it depends on what kind of graphic you want to draw. The easiest one would be a bar graph.

For example, for a graph that occupies the lower two lines of the display (i.e. 48x16 pixels):

byte graph[48 * 2] = { 0x00, 0x00, ..., 0x00 };
int x = 0;

void loop() {
  int value = map(analogRead(0),  0, 1023, 0, 15);

  if (value >= 8) {
    // fill the lower column all black: graph[(x % 48) + 48] = 0xff
    // use bit arithmetic to set some of the bits of the upper byte
  } else {
    // fill the upper column all white: graph[x % 48] = 0x00
    // use bit arithmetic to set some of the bits of the lower byte


  lcd.setCursor(0, 4);
  lcd.drawBitmap(graph, 48, 16);

Now this is not the most efficient way to do it, but it would work I guess.


Thanks for the detailed reply. I found out today that there was an updated version of that library and I made the update.
A bar graph is actually verry useful for what I had in mind, because it allowes for a quick view on changes made to the signal input.

Unfortunately you lost me a little when it comes to bit arithmetic… :(.

What do the “…” mean in this line: byte graph[48 * 2] = { 0x00, 0x00, …, 0x00 }; ? (as you can already guess, my C programming skills are… well… low… )

How can I make the bar graph become black as the value increases and dissapear as the value decreases ? Do I need to make an if/else and use the x++ if the measured value increases and x-- if the value decreases ?

Is it possible to draw vertical bar graphs ? Although I think I will get in the same problem with the fact that I need to draw 8 lines at a time no ?


The kind of chart that I was talking about is this:

I was thinking about this, and drawing charts can be really useful, so I've added a new method to the library to draw a chart element (a column). :)

So, just checkout/update to the latest development version and look at the included "thermometer" example for how to use it.

Also, you can look and the "drawColumn" method. It should answer your other questions.

Thank you for the reply.

I will update my files and start playing with the example and if I have any more questions I will return. :)