I recently found a Nokia 3310 LCD (PCD8544). I used the examples given here: http://www.arduino.cc/playground/Code/PCD8544
And managed to talk to the LCD.
The wiring scheme is the one in the example.
But here come my questions:
how do I print on the LCD a value measured at the analog pin A0?
For example, if I measure a 2.32 V value on the A0... how do I print that on the LCD, given the fact that the example works with char's ?
How do I output on the LCD a graph ?
For example: I want to measure continuously a value from pin A0 and display it as a graph to view the way the signal modifies.
To turn a nibble into a char simply logical or it with 0x30;
So if you have a byte value in a variable called val then:-
char char1 = (val >> 4) | 0x30; // use the top nibble
char char2 = (val & 0xf) | 0x30; // use the bottom nibble
see:- http://www.arduino.cc/playground/Code/BitMath
Second question is simply a matter of using the variable value to control the position (say the Y position) of a graphic on the screen.
If I understand correctly, "val" is the value I read from the A0 input (in my case), but what I don't understand is why use only top nibble (if I remember correctly, a nibble is represented by 4 bits of a byte ).
As far as I could test, it only prints on my LCD integer values. I made val = 5.35 and on the LCD I got 5.
Negative values are not being printed.. just some unreadable character.
If I use this piece of code:
gotoXY(24,3);
LcdCharacter(ASCII2[5]);
LcdCharacter(0x2e);
LcdCharacter(0x33);
LcdCharacter(0x35);
It prints 5.35 whitout a problem... however this is static.. I need to change it....
Is there any function similar to itoa that works with fractional values ?
I made a breakthrough. After a lot of searching, I managed to find this PCD8544 library. in the example code supplied with this library it is demonstrated the reading of a temperature from analog pin and print to LCD.
Although I resolved the issue with the LCD display, now I find myself in another situation: how do I measure a negative value with Arduino, since it cannot measure negative values ?
I was thinking of using an operational amplifier as a voltage comparator but I have no idea how to make the circuit itself.
I want to compare the signal input with 0 and when I get the biggest value... then pass it through another op amp connected (i suppose it's simpler) as a inverting voltagr follower to invert the sign.
I guess I hit a big wall... and... don't know how to get out...
Hope someone can help.