Project23D

I'm trying to figure out how to get the LCD display the Arduino calculated variables without using the PCD8544.h libraries. I've tried to use different ones from different sites, saved under different names so I know which one I'm using, but none of them seem to work. So, I found some code that will make LCD display in bitmap, which is fine for what I want to use it for.

It works until I try to make the LCD display a variable using such code as:

//There are two memory banks in the LCD, data/RAM and commands. This //function sets the DC pin high or low depending, and then sends//the data bytevoid LCDWrite(byte data_or_command, byte data){ digitalWrite(PIN_DC, data_or_command); //Tell the LCD that we are writing either to data or a command

/* sensor outputs about 100 at rest. Analog read produces a value of 0-1023, equating to 0v to 5v."((long)sensorValue * 5000 / 1024)" is the voltage on the sensor's output in millivolts.There's a 500mv offset to subtract. The unit produces 133mv per amp of current, sodivide by 0.133 to convert mv to ma

*/

batVal = analogRead(batMonPin); // read the voltage on the divider pinVoltage = batVal * 0.00488; // Calculate the voltage on the A/D pin // A reading of 1 for the A/D = 0.0048mV // if we multiply the A/D reading by 0.00488 then // we get the voltage on the pin.

batteryVoltage = pinVoltage * ratio; // Use the ratio calculated for the voltage divider // to calculate the battery voltage

void LCDString(char *characters){ while (*characters); LCDCharacter(*characters++);}Probably a very smart compiler, which detects the endless loop here. You see the problem ?And: The code above does not match the code in the full listing.

All in all, i guess your poblem is: You want to output a number, but you only have a procedure to output a string.You have the following options: Derive a new class from the Arduino "Print" class or use sprintf()

I honestly have zero idea what any of the syntax for the LCDString means.

And, the code given, where does it go? I tried a few different ways, and either I get errors, or nothing is displayed on the on the LCD. Yes I checked the connections. I reverted back to the original code to make sure I didn't break anything.

I have to ask why you want to do this without using the libraries. The intent of the code is hard to read but I get the impression there is nothing unusual. Here is code that doesn't use the library, but does work. It is from Stuart Lewis and was the best I found, so the vital bits may be of use.

Project23D

if they worked. I'm not understanding how for an LCD screen so common, with LOTS of different libraries for it, I cannot find one that will work.

However, I would like to gain an understanding to how make an LCD screen work without the use of a library so I can make use of the other LCD screens I have that do not have publicly available libraries for, like a couple of these larger Optrex 30x4 screens I have.

And going about this project this way, I don't have to stick with one LCD screen, I can change screens without changing many lines of code.

trying to compile this mess gives the following error:"In function voidloop() error; too many arguments is 'void LCDString(char*) at this point in file. I have not made any modifications to that section of the code since I first posted this thread.

Do I need something in the 'void setup()' that converts float to char, or string or whatever the hell this is?

I tried removing the LCDString mess from the 'void loop()' and it supposedly compiles and uploads, but nothing on the LCD screen is shown

if they worked. I'm not understanding how for an LCD screen so common, with LOTS of different libraries for it, I cannot find one that will work.

I guess this might be determined by something you specifically want. I wasn't actually aware there are lots of libraries. I just use the Philips PCD8544, it does nearly everything I want, and the related on-line glyph editor provides what I want that the the library doesn't. Your code suggests that your end-product is much the same as mine, so I don't understand why you have such a problem.I might point out that there are some mysteries and limitations with the 5110. The Stuart Little programme is the only one I found not using a library that gave me a decent display. Others were streaky and/or low contrast. I tried making the setup common to all but never got to the bottom of this, and no longer have the problem now that I use the library.

Quote

And going about this project this way, I don't have to stick with one LCD screen, I can change screens without changing many lines of code.

I don't think that counts for much. It's just personal preference rather than technical advantage. You would have individual sketches for individual screens, and just call the relevant libraries for them all. I use three different screens interchangeably and don't see that a reason for dispensing with the relevant libararies.

Project23D

If you did not change the definition of LCDString(), then this procedure accepts exactly one argument, but you have passed two: [LCDString(buff,"V");], namely [buff] and ["V"], which causes he error.

That much I figured as much. But, having zero idea what to change it to, or where can I find different options? Options such as changing the LCDString definition to something else entirely, to enable 'printing' of float data, or modifying it to print changing float data.

Project23D

ok, I tried the libraries, both from Adafruit, and PCD8544.h. Errors, errors, more errors. Shit having to do with abstract, not being able to define something that is in the top of the damn code. What the hell is going on here?

This shit is really pissing me off. What in the hell am I doing wrong here?

Someone please point this dumb ass in the right direction about how to use a damn display

Adafruit, and PCD8544.h. Errors, errors, more errors. This shit is really pissing me off. What in the hell am I doing wrong here?

Probably quite a lot; and all the errors are probably yours and not the libraries'. But nothing that isn't fixable.

Rather than the usual admonition to post your code that you will soon get from all and sundry, here is some that works, using a library. If you can't get a result then maybe, just maybe, there is something wrong with the library, in which case try this.

It has just occurred to me that you could have stuffed up the wiring. There is a bit of variation in the wiring of the 5110. This would be negated if you have ever had anything readable, but I'm not sure you have.

Project23D

I did get the code to compile successfully this time. I've had it compile fine without the library before, but the 'LCDString' and my knowledge of the that sector only allowed a static display on the LCD. I could adjust the contrast all that jazz, but could not get the code to update the display.

This library does display changing data on the display, however, it's very light contrast, and only displaying the last line of instructions:

Project23D

First, the lines of code that I wanted to do their thing, and display the resulting information on the screen.

In the 'void setup()' I had 'lcd.begin(12,6)'. Apparently to the PCD8544.cpp file, I saw this particular line wasn't correct for this particular application. In the 'PCD8544 begin' section, the initial setup, there was was no need to describe the amount of columns or lines/rows. So I removed the 12,6 and now just have 'lcd.begin()'.

Then in the code that pertains to the particular set of information that needed to be displayed on a certain LCD line, I used the 'lcd.setCursor(x,x)'.

From the original bits of code I but together the delay was 10ms. That was too fast and the voltage and other stuff really changed too fast, so I set that to 1500ms.

to change the contrast, I thought from the non-library code that I originally posted, I could add the line 'this->send(PCD8544_CMD 0xB5)' under the 'begin' parameters. That didn't an apparent thing. I ended up changing a few hex codes to eventually end up where the bias is what changed the LCD contrast. That line was 'this->send(PCD8544_CMD 0x15)'.

And so it also seems to me, this crap is using hex to communicate with the screen and '0xba' is for a different command that '0xBa'.

Thanks for the assistance. I've learned a little about C and C++ from the mess. I understand how it works, for me it's just a matter of knowing syntax, and all the sub-processes/commands involved to do ONE thing. And that ONE thing could be one of many things to do another ONE process.

While I said I no longer have the problem now that I use the library, I suspect the real story is that the library just happens to have the settings OK with the information I now display. I had three non-library programmes and the only one that worked was Stuart LIttle's. I played around with the hex stuff to no avail. I then made Little's commands common to all three. It helped the others but not enough. It appears that the quality of the display is partly determined by the nature of the information displayed.

I think I got some info on contrast from this magnum opus.http://ianlangelectronic.webeden.co.uk/#/lcd-module-0/4569058582

Note also:

I understand these devices are surplus, so their price may reflect their compliance with specification. In short, the contrast issue may be partly down to luck. I have two and they are both OK for my needs, but one has a blue backlight which is quite useless and better left off.

I'm trying to figure out how to get the LCD display the Arduino calculated variables without using the PCD8544.h libraries. I've tried to use different ones from different sites, saved under different names so I know which one I'm using, but none of them seem to work. So, I found some code that will make LCD display in bitmap, which is fine for what I want to use it for.

It works until I try to make the LCD display a variable using such code as:

The correct answer was a simple "you must pass a string to LCDString, not a string and a value, so you must create in advance a string containing the text and the values you want to be displayed".There's nothing wrong in using the playground sample source for this display...

The actual issue is: HOW to create a string containing text AND values?I'm trying with sprintf and it quite works:

This works fine, except that I can't figure out how to print always in the same position, text is being added after the already printed text!Does it depends on Sprintf being concatenating, or in LcdString updating the print position?!?