Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

LCD Progress bar

Status
Not open for further replies.

Sai Shoby

Newbie
Joined
Oct 22, 2020
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
25
Hi all,
I am using I2C 2x20 oled display. I want to make a VU meter for my audio signal. for the first step I try to see the progress bar in my LCD. In most of the examples, they use Lcd_out, Lcd_Cmd(), Lcd_Chr_Cp(), Lcd_Cmd(),Lcd_Chr() but i dont have this function in I2c Lcd Library. I am using #include "I2C_LCD.C".

Please help me to write a code for this
 

Hi

Please understand that we don't know what microcontroller, type of LCD, schematic, IDE, compiler, language....you use.

Klaus
 

hello,

it seems you have a TEXTE LCD ...


so the only way to do bargraph is to define 8 caracters in CGRAM to represent the 8 steps
inside one char ..
you have 20 chars wide LCD => you can get 8x20=160 steps into your bargraph
new 1rst char have only one pixel wide , 8 pixels Height
second char have 2 pixel wide ... 8 pixel height
..and so on
last is a black cractere 8x8

The value to display must be sclaled before to 160 (full range)
then you divide your value by 8 , to write this number of char ( plain char) on the line (if >=1)
following by the rest (of division) to select the CGRAM charctere by %8 (modulo 8)
and add it as last char on the line
(needs some limits checking to do in software .)



example of char definition
on my LCD2119 I2C ..
not used here for bargraph ...

Code:
void Cree_8_cars_CGRAM()
{
unsigned char b1,b2;
 I2C1_Start();
 I2C1_Wr(LCD_ADR); // i2c slave Adress
 I2C1_Wr(0x00);
 // Cde Set_CGRAM address to 0  =>  (0x40 + adresse=0 )
 I2C1_Wr(0x40);
// I2C1_Start();
 I2C1_Repeated_Start() ;
 I2C1_Wr(LCD_ADR); // i2c slave Adress
 I2C1_Wr(0x40);// set CGRAM adress
// blanc  
I2C1_Wr(0b00000000);
I2C1_Wr(0b00000000);
I2C1_Wr(0b00000000);
I2C1_Wr(0b00000000);
I2C1_Wr(0b00000000);
I2C1_Wr(0b00000000);
I2C1_Wr(0b00000000);
I2C1_Wr(0b00000000);

// degre C
I2Cx_Wr(0b00000000);
I2Cx_Wr(0b00001110);
I2Cx_Wr(0b00010001);
I2Cx_Wr(0b00001110);
I2Cx_Wr(0b00000000);
I2Cx_Wr(0b00000000);
I2Cx_Wr(0b00000000);
I2Cx_Wr(0b00000000);

// The Euro currency character can be recognized by the 0/1 pattern (see Figure 48)
I2C1_Wr(0x06); // 00110
I2C1_Wr(0x09); // 01001
I2C1_Wr(0x08); // 01000
I2C1_Wr(0x1E); // 11110
I2C1_Wr(0x1E); // 11110
I2C1_Wr(0x08); // 01000
I2C1_Wr(0x09); // 01001
I2C1_Wr(0x06); // 00110

  // petit rectangle
I2C1_Wr(0b0000000);
I2C1_Wr(0b0000000);
I2C1_Wr(0b0011111);
I2C1_Wr(0b0010001);
I2C1_Wr(0b0011111);
I2C1_Wr(0b0000000);
I2C1_Wr(0b0000000);
I2C1_Wr(0b0000000);
I2C1_Stop();
}
 

but, you will see some gap between each step
because
Only bit 0 to bit 5 of the CGRAM address are set by the Set_CGRAM command.

else use a Graphic LCD as Nokia 5110
version 84x48 or 96x64
then bargraph could be contineous .. pixel by pixel

some LCD have allready , in ROM some specific char to draw vertical or horizontal bargraph
but with 5 pixel wide in horizontal mode or only 6 pixel in vertical mode
 

Attachments

  • chars_for_barre.jpg
    chars_for_barre.jpg
    211 KB · Views: 77

Hello,

i wrote this example for 18F47K42 and classique LCD2x16, driven in 4bits mode.
but could be adapted to other MCU
and use you LCD I2C syntaxe instead of MikroC LCD library
The main item is to build the specifics chars into the CGRAM
Then use them to draw the bargraph...
With a TEXTE LCD , you get a blank space between each step of one char
impossible to fill this gap.. else you have to use a GRAPHIC LCD
or find out a Text LCD with Font characteres in 8x8 bits ..
i don't know if that exist ?

Bargraph_EA0_B.jpg
 

All character LCD driver IC on the market are compatible with Hitachi HD44780 controller, supporting 5x8 and optionally 5x10 dot matrix. They require LCD glasses with inter-character gap, thus no chance to display a continuous bar graph.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top