Searching \ for '[PIC]:BAR GRAPH' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=pic
Search entire site for: 'BAR GRAPH'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]:BAR GRAPH'
2002\07\04@011313 by Goring, Steve

flavicon
face
Hi list ...

Hopefully someone will be able to help me out here, I am controlling the
speed of a
remote DC motor using a simple Hex switch. ( 16 discrete speed steps ( PWM
))

I could have used either an ADC or rotary encoder to get finer resolution,
but in this
application it is not necessary, in fact on or off would be just fine.

I also happen to have a 1 line 16 character lcd and thought it would be nice
to show
the speed as a bargraph ?

My problem, is that I cannot think how to get started - I have had success
in the
past with CGram so I was thinking maybe increment a register and light a
segment
on the lcd per speed step, unfortunately I now have a mental block as to
actually
implement this.

So, if someone could outline the steps that would be needed that would be
great ..

Thanks

Steve



**********************************************************************
Information in this email is confidential and may be privileged.
It is intended for the addressee only. If you have received it in error,
please notify the sender immediately and delete it from your system.
You should not otherwise copy it, retransmit it or use or disclose its
contents to anyone.
Thank you for your co-operation.
**********************************************************************

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email spam_OUTlistservTakeThisOuTspammitvma.mit.edu with SET PICList DIGEST in the body


2002\07\04@023931 by Mike Singer

picon face
Goring, Steve wrote:
> **********************************************************************
> Information in this email is confidential and may be privileged.
> It is intended for the addressee only. If you have received
> it in error,
> please notify the sender immediately and delete it from your system.
> You should not otherwise copy it, retransmit it or use or disclose its
> contents to anyone.
> Thank you for your co-operation.
> **********************************************************************

  .....PICLISTKILLspamspam@spam@MITVMA.MIT.EDU retransmitted this email and disclosed its contents to all members. Google did even more.
  Hey folks, I wouldn't like feeling I'm a sort of spy or something.

  Mike.

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservspamKILLspammitvma.mit.edu with SET PICList DIGEST in the body


2002\07\04@030337 by Andrew Errington

flavicon
face
> thought it would be nice to show
> the speed as a bargraph ?
>
> My problem, is that I cannot think how to get started

Hello,

I have done this for a Volume display on my car MP3 player.

I shall assume thet you know how to control the disply and write
characters to it.

1) Define some special characters.  These will go in the User Defined
ares of the LCD module, and can be used by sending the appropriate
character code.
The characters should represent 1 and 2 vertical bars.  Each character
cell on the LCD is 5 pixels wide, and each cell is seperated from its
neighbour by a 1 pixel gap.  If you define a character that is like
this:

00011
00011
00011
00011
00011
00011
00011

or this

11000
11000
11000
11000
11000
11000
11000

(depending on which way your bargraph goes)

and this

11011
11011
11011
11011
11011
11011
11011

then you can represent 1/2 cell steps in your bargraph.  Alternatively
you can define a solid block and just have whole cell steps.

2) Think about how you will map your speed to the bargraph.  You have 16
character cells.  If they are all full then you will be representing
full speed, or 100%.  If they are all blank you will be representing 0%.
Each cell represents 6.25% when full, or 3.125% when half full, unless
you put characters like 0 and 100 at either end.

3) Figure out the maths so that when you have a number which is to be
displayed on the bargraph you calculate how many full cell characters
you need, and whether the last one is a half cell or blank.

4) Send the appropriate characters to the screen.

Does this help?

Andy

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email .....listservKILLspamspam.....mitvma.mit.edu with SET PICList DIGEST in the body


2002\07\04@033327 by Andrew Errington

flavicon
face
Sorry, forgot to add, if the value you are displaying is a byte value
(or general power of 2) then that makes the maths very easy, and you
know, it would really help me if I actually read what you wrote (which
I just did, halfway through that sentence). The maths for your project
are *very* easy, and you don't need 1/2 cell characters.

<flustered>Of course, I knew that, and I was um, merely expanding on the
problem in case, er, others wanted to do a similar thing</flustered>

Andy

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email EraseMElistservspam_OUTspamTakeThisOuTmitvma.mit.edu with SET PICList DIGEST in the body


2002\07\04@065144 by Michael Rigby-Jones

flavicon
face
{Quote hidden}

I think a solid block is already defined in the LCD character set so you
wouldn't even need to generate your own as you don't need any better
resolution than one character block.

The easiest way is to simply send the clear/home command to the lcd, and
then write as many blocks as the value of you PWM count e.g. (sorry it's in
(pseudo) C)

void UpdateBargraph(char count) // count holds PWM value 0 -15
{
       char i;

       if(count > 15)          // clamp number of chars to send
               count = 15;

       lcd_clear();                    // send command 0x01 to LCD (clear
and home)

       for(i=0;i<=count;i++)
               lcd_write(0xFF);                // write solid block
character
}

The only downside with this is that it may cause flicker if the display is
updated very often.  To avoid this would need some cunning and some more
code to only write the characters that are needed to make the bar shorter or
longer

void UpdateBargraph(char count)
{
       static prvcount;
       char i;

       if(count > 15)                          // clamp number of chars to
send
               count = 15;

       if (count < prvcount)                   // bar graph needs to be
shorter
       {
               lcd_goto(count + 1);            // move cursor to first
blank character

               for(i=0 ;i < (prvcount - count); i++)
                       lcd_putch(' ');         // write spaces to the ends
of the display
       }
       else if (count > prvcount)              // bar graph needs to be
longer
       {
               lcd_goto(prvcount + 1); // move cursor to first blank
character

               for(i=0; i < (count - prvcount); i++)
                       lcd_putch(0xFF);        // write solid blocks
       }

       prvcount = count;                       // store current bar value
for next update
}


I presume you already have some code to control the LCD?  If not then there
are dozens of examples on the net for PIC code.  The above should be pretty
trivial to convert to assembler if that's what you are using.

Regards

Mike

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email KILLspamlistservKILLspamspammitvma.mit.edu with SET PICList DIGEST in the body


2002\07\04@164234 by Goring, Steve

flavicon
face
Thanks to all those that replied ...

Steve


**********************************************************************
Information in this email is confidential and may be privileged.
It is intended for the addressee only. If you have received it in error,
please notify the sender immediately and delete it from your system.
You should not otherwise copy it, retransmit it or use or disclose its
contents to anyone.
Thank you for your co-operation.
**********************************************************************

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email RemoveMElistservTakeThisOuTspammitvma.mit.edu with SET PICList DIGEST in the body


2002\07\11@091414 by Goring, Steve

flavicon
face
Hi Andy ...

Just got back to work today and am pleased to report that
I do indeeed have a speed bargraph ...

The theory of your code worked for me although I have
implemented it slightly differently due to the fact that
I do have physically a single row of 16 characters
but which are in fact two lines of 8 next to each other.

So thanks again ....


Steve


**********************************************************************
Information in this email is confidential and may be privileged.
It is intended for the addressee only. If you have received it in error,
please notify the sender immediately and delete it from your system.
You should not otherwise copy it, retransmit it or use or disclose its
contents to anyone.
Thank you for your co-operation.
**********************************************************************

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


More... (looser matching)
- Last day of these posts
- In 2002 , 2003 only
- Today
- New search...