Pages: [1]   Go Down
Author Topic: nokia lcd 5110  (Read 1768 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

   hello,

   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.
Logged

Newcastle, England
Offline Offline
Sr. Member
****
Karma: 3
Posts: 489
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Check out http://www.arduino.cc/playground/Code/PCD8544
and http://blog.stuartlewis.com/2011/02/12/scrolling-text-with-an-arduino-and-nokia-5110-screen/

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

Onions.
Logged

My website: http://www.harryrabbit.co.uk/electronics/home.html Up and running now! (Feel free to look round!) smiley-grin

Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

  LcdString("cm");
   
  delay(3500);
}


I would like this http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1272177425

furthermore, I believe the solution is in this function,

Code:
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);
}
[code]

how can I shiftout() DEC number and no byte data???
[/code]
« Last Edit: November 26, 2011, 04:16:51 pm by john44 » Logged

Newcastle, England
Offline Offline
Sr. Member
****
Karma: 3
Posts: 489
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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: http://www.harryrabbit.co.uk/electronics/ASCII%20table.html

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.

Code:
while(num){
  array[i] = num % 10;
  num = num / 10;
  i++;
}

arrayLegnth = i;

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

while(i){
  LcdCharacter(array[i]);
  i--;
}

It should work...
Onions.
Logged

My website: http://www.harryrabbit.co.uk/electronics/home.html Up and running now! (Feel free to look round!) smiley-grin

Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

the solution of old problem



Code:
http://www.cplusplus.com/reference/clibrary/cstdlib/itoa/
Logged

Pages: [1]   Go Up
Jump to: