Does anyone knwo where i can find some code on how to create a bar graph which changes according to values / pulses? I built a lcd tacho, which get a signal from the car's ecu. I display the rpm on the top line of the lcd. What i want to do now, is display a bar graph of that value on the second line. I'm using a pic16F84A with a hd44780 lcd. My code is in assembler it would be nice to get some simple examples on how to do this.
I want to display solid block as a start and then later use some custom characters. That sounds like a good idea yes, but i'm struggling to implement it as code. Does no-one know where I can find some examples in assembler?
To define the first 8 characters you send command 0x40 + address of character data. So, to write to character 5 you would send command 0x40+(5*8) = 0x68 followed by writing 8 data bytes. Try sending the following,
Command 0x68
Data 0xff,0xff,0,0,0,0,0,0
Command 0x80
Data 0x05
You should get a semi filled character in position 0 on the top line of the display.
Now try altering the 8 data bytes in the second line.
Assuming that you want the bar to move from left to right on the display and the display is 16 characters wide, this would give you 6*16=96 positions. I counted the gap between chars as a pixel so the movement would be smooth.
The simplest way to convert your 0-95 number into characters would be two lookup tables. One containing the number of solid chars to display and the second containing the character to display after the full ones.
You are also going to need to fill the remaining spaces with blanks, otherwise your bar graph is only going to go up, not back down. For example, if your number of bars is 47, then 48 to 95 need to be blank spaces. I hope I am being clear enough.