Entire Forum This board This topic Members Entire Site
 Welcome, Guest. Please login or register.Did you miss your activation email? June 22, 2018, 04:30:07 04:30 1 Hour 1 Day 1 Week 1 Month Forever Login with username, password and session length
 Pages: [1]
 Author Topic: [REQ:] BARGRAPH CODE FOR 16x2 IN BASCOM  (Read 5279 times) 0 Members and 1 Guest are viewing this topic.
charudatt
Active Member

Warned
Offline

Posts: 113

Thank You
-Given: 50

 « on: November 06, 2009, 11:39:00 11:39 »

I am looking for a code snippet do display 8 DMX channel values on a 16x2 LCD (Second Line) using Bargraphs + AVR + BASCOM.

I searched the net but could not find any, there are codes for showing vu-meter but the bargraph is horizontal. I want them vertical.

Any help

regards

 Logged
DarkClover
Active Member

Offline

Posts: 170

Thank You
-Given: 37

Still alive...

 « Reply #1 on: December 12, 2009, 06:04:00 18:04 »

If you want them vertical you can use the same code. Just change the LCD routines
to "write-custom-chars" and then you can draw the values vertical.
You just need to calculate them a little bit because one char has 7*5 (8*5) dots.

If you have two lines (2 chars in one column = 1 bar):
The lower and the upper char of the first column are both 50% of the whole value (100% = 10 for example).
The lower char displays every value from 0%-49% and the upper one from 50%-100%.
I use this methode if I need to read all ADC channels for example.

Simple Calculation:
k = 10 = 100%
x = input (0-10+)

y=((100/k)*x) --> Input signal in %

1.0) if y <= 49 then clear the upper char
1.1) ROUND( y/7 ) --> amount of filled lines for the lower char

2.0) else if y > 49 then fill the lower char completely
2.1) ROUND( (y-50)/7 ) --> amount of filled lines for the upper char

optional:
3.0) else if y > 10 then fill lower+upper char or ERROR

4.0) else clear lower+upper char

Maybe I'll upload some pictures tomorrow if I have time to.
 Logged

Not thinking means to believe what others say!
TRY & ERROR... the fundamental principle our existence is based on
charudatt
Active Member

Warned
Offline

Posts: 113

Thank You
-Given: 50

 « Reply #2 on: December 13, 2009, 10:03:46 10:03 »

Looking forward to some examples with pictures, if you can, specially on how to "write-custom-chars"
 Logged
DarkClover
Active Member

Offline

Posts: 170

Thank You
-Given: 37

Still alive...

 « Reply #3 on: December 14, 2009, 04:28:07 16:28 »

I had a little bit time today so I made a very simple example.

Here are pictures from the theory set up to practice:
http://img121.imageshack.us/img121/6674/lcd1.jpg
http://img706.imageshack.us/img706/1736/lcd2.jpg
http://img38.imageshack.us/img38/2751/lcd3w.jpg
http://img13.imageshack.us/img13/8853/lcd4.jpg

And there is a video from the test program I made (sorry for the blurred image -> cellphone camera):

And last but not least a tutorial on how to create custom chars for character LCD:
http://www.8051projects.net/lcd-interfacing/lcd-custom-character.php

Here is some code snippet from my very very simple calculation of the
vertical values as described in my previous post.

Code:
y = 100;
y /= k;
y *= x;

if(y<=50){
y /= 8;
lcd_gotoxy(0,1);
lcd_putc(y);
}
else if(y>50){
y -= 50;
y /= 8;

lcd_gotoxy(0,1);
lcd_putc(0x07);
lcd_gotoxy(0,0);
lcd_putc(y);
}

lcd_putc(0x07); means use the 8. custom char which is the full block alias the indicator for 50% (8*5 dots).
0x01 is just the line on the ground (1*5 dots) and 0x04 is half of a block = 25% (4*5 dots)
 « Last Edit: December 14, 2009, 04:35:49 16:35 by DarkClover » Logged

Not thinking means to believe what others say!
TRY & ERROR... the fundamental principle our existence is based on
 Pages: [1]