CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug Reports on this forum. Send them to support@ccsinfo.com

LCD Bargraph
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> Code Library
View previous topic :: View next topic  
Author Message
cyrildavids



Joined: 09 May 2009
Posts: 3

View user's profile Send private message

PostPosted: Sat May 09, 2009 2:30 am     Reply with quote

How do one configure this for a 4x 20 lcd screen with the same driver?
mutthunaveen



Joined: 08 Apr 2009
Posts: 100
Location: Chennai, India

View user's profile Send private message

wow it is a good BAR graph
PostPosted: Sun Sep 13, 2009 10:12 am     Reply with quote

I am very much thankful to you Very Happy

And I have a small problem with the display Confused flickering is on the screen. It is something like scrolling effect... same as CRT interlacing.

What I have to modify to the code to get a clear display?
Jeff7



Joined: 22 Sep 2009
Posts: 13

View user's profile Send private message

PostPosted: Sun Oct 04, 2009 10:16 pm     Reply with quote

I think that a flickering effect like that can result from very rapid updates to the display. Either add in some kind of a delay, or else have a timer-triggered flag to enable an update, perhaps every 100-200mS.


Nifty bar graph...I didn't even see this thread.
I wound up digging up something on an old blog post, and made my own addition to LCD.c. I also tied the graph levels right to ASCII codes 0-7, so printf(lcd_putc,"%c",5); would result in printing a block with 6 rows filled in.
And of course you can program in something to check for a value greater than 7, decrement the value by 8, move to row 1, and print the new value. Badda-bing, you've got a 16-row bar, albeit with a small gap above the first 8 rows.
mutthunaveen



Joined: 08 Apr 2009
Posts: 100
Location: Chennai, India

View user's profile Send private message

yea
PostPosted: Mon Oct 05, 2009 6:05 am     Reply with quote

I thought the same. I mean increasing the delay (LCD refresh rate).

Thanks for your reply.

When I decrease the refresh rate then the interactive bar graph is struggling to display the sudden changes happening.

Anyway thanks Cool
mbradley



Joined: 11 Jul 2009
Posts: 118
Location: California, USA

View user's profile Send private message Visit poster's website

PostPosted: Mon Dec 14, 2009 2:00 am     Reply with quote

Here is one from my site, works with the eadog driver, but you can tweek it to work with most any lcd that has custom chr's.

First call: gBarGraphIni(); to program the custom chr's.

Then call the graph function with a pos, max. This is what POS in MAX
so 50,100 would be half way, same as 256, 512.

gBarGraph(row,pos,max);

If you need a graph that does not span the entire row, then use the advanced one. WIDTH is the chr's positions wide.

gAdvBarGraph(row,col,width,pos,max)

Code:

// note: this calls the functions in the EA-DOGM driver

// sets up the programmable chr's for use as a bar graph
//uses custom chrs 1 to 5
void gBarGraphIni(void)
{
   int i;
   for (i=0; i<8; i++) { eaDogM_WriteByteToCGRAM(0b00001000 + i,0b0010000); }
   for (i=0; i<8; i++) { eaDogM_WriteByteToCGRAM(0b00010000 + i,0b0011000); }
   for (i=0; i<8; i++) { eaDogM_WriteByteToCGRAM(0b00011000 + i,0b0011100); }
   for (i=0; i<8; i++) { eaDogM_WriteByteToCGRAM(0b00100000 + i,0b0011110); }
   for (i=0; i<8; i++) { eaDogM_WriteByteToCGRAM(0b00101000 + i,0b0011111); }
}

void gBarGraph(char row, unsigned int16 pos, unsigned int16 max)
{
   int8 i,m,r;
   int32 n;

   eaDogM_SetPos(row,0);
   n = ( (pos * 80) / max );
   m = n / 5; // i love integer math, 6/5 = 1 not 1.2 :)
   r = n - (m * 5); // get the remainder
   for (i=0; i<m; i++) { eaDogM_WriteChr(5); } // block chr
   eaDogM_WriteChr(r);
   for (i=(m+1); i<16; i++) { eaDogM_WriteChr(0x20); } // end spaces
}

void gAdvBarGraph(char row, char col, char width, unsigned int16 pos, unsigned int16 max)
{
   int8 i,m,r;
   int32 n;

   eaDogM_SetPos(row,col);
   n = ( (pos * (width*5)) / max );
   m = n / 5; // i love integer math, 6/5 = 1 not 1.2 :)
   r = n - (m * 5); // get the remainder
   for (i=0; i<m; i++) { eaDogM_WriteChr(5); } // block chr
   eaDogM_WriteChr(r);
   for (i=(m+1); i<width; i++) { eaDogM_WriteChr(0x20); } // end spaces
}


_________________
Michael Bradley
www.mculabs.com
Open Drivers and Projects
sandrosachser



Joined: 27 Nov 2013
Posts: 1

View user's profile Send private message

PostPosted: Thu Mar 24, 2016 11:14 am     Reply with quote

Hello. At first, thank you so much by informations. Is it possible use this bargraph code with LCD 20x4 ? (Note: I use FLEXLCD library) Thank you again.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> Code Library All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group