nokia lcd 5110


I've the nokia lcd 5110 module. So, I must print the decade numbers from convert Distance in cm from my HC-SR04 module. Have you idea how I can do that? Because, the PCD8544 library haves only functions which they print characters.

Check out and

The first one definately gives you the option of printing a string, using the LcdString function.


how can I convert the character-string function into number dec? I know a function String(value, DEC); Moreover, I write you my code

void loop()

  gotoXY(0, 2);
  distance = ultrasonic.Ranging(CM);
  LcdCharacter(ultrasonic.Ranging(CM));  // this functhion give me the character no decade numder !!!


I would like this

furthermore, I believe the solution is in this function,

void LcdWrite(byte dc, byte data)
  digitalWrite(PIN_DC, dc);
  digitalWrite(PIN_SCE, LOW);
  shiftOut(PIN_SDIN, PIN_SCLK, MSBFIRST, data);
  digitalWrite(PIN_SCE, HIGH);

how can I shiftout() DEC number and no byte data???


What data do you want to display on the LCD? It may just be a case of adding a number to the number you have. Check out the ASCII table:

If you want to display the number 33, the character shown will be ‘!’. To get the LCD to show the number 33, a series of steps will need to be taken:

Split the number up into digits, which we’ll store in an array:

array[0] = num % 10;
num = num / 10;
(repeat until num = 0)

If num was 33, the array will now have the values 3, 3. (Because of the way the above code processes the data, if num was 35, the array will now have the values 5, 3).

Next, turn the data in the array into a character. It is now the ASCII table comes in handy. If we assume a number of 0, we need to add 48 to it to produce the character 0. If the number is 3, we still need to add 48 to it to produce its character:

array = array + 48;
Then we need to start at the end of the array and work backwards, printing out the characters.
  array[i] = num % 10;
  num = num / 10;

arrayLegnth = i;

for(int j = 0; j < i; j++){
  array[j] = array[j] + 48;

It should work…

the solution of old problem