Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 08, 2016, 06:56:50 06:56


Login with username, password and session length


Pages: [1]
Print
Author Topic: [REQ:] BARGRAPH CODE FOR 16x2 IN BASCOM  (Read 4758 times)
0 Members and 1 Guest are viewing this topic.
charudatt
Active Member
***
Offline Offline

Posts: 110

Thank You
-Given: 47
-Receive: 69


« on: November 06, 2009, 06:39:00 18: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 Offline

Posts: 170

Thank You
-Given: 36
-Receive: 60


Still alive...


« Reply #1 on: December 13, 2009, 01:04:00 01: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
***
Offline Offline

Posts: 110

Thank You
-Given: 47
-Receive: 69


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

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

Posts: 170

Thank You
-Given: 36
-Receive: 60


Still alive...


« Reply #3 on: December 14, 2009, 11:28:07 23: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):
http://www.youtube.com/watch?v=N2vefMl8DVM

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, 11:35:49 23:35 by DarkClover » Logged

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


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC