piclist 2000\06\07\110726a >
Thread: LCD Graphics Routines
www.piclist.com/techref/io/lcd/pic.htm?key=lcd
flavicon
picon face BY : Sergio Masci email (remove spam text)



{Quote hidden}

The simplest way to do this (also turns out to be the most efficent in
terms of processing power) is to have a list of all the points on your
gage that will be effected by whatever it is you are trying to messure.
Say you have a range between 0 and 99, divide your list into 100
sections. Section 0 contains all the points that will be in the on state
at value 0, section 1 contains all the points that will be in the on
state at value 0 and 1, section 2 contains all the points that will be
in th on state at value 0 and 1 and 2. Now when your value moves from 0
to 5 you set all the pixels on that belong to section 5 when the value
moves down (from 5) to 3 you set all the pixels off that belong to
sections 5 and not section 3. when the value again goes up to 6 (from 3)
you set all the pixels on that belong to section 6 and not section 3.

If the range is 0 to 99 but the steps between each division are too big,
multiply the range so that the steps become smaller (keep 100 divisions
just increase the resolution).

If the list of pixels is kept ordered (section 0, section 1, section 2
etc) then you can superimpose each section onto a common list and have
pointers to the sections in the common list. With a little creative
pointer aritmetic you end up with a list of points that must be turned
on or off and an incredibly tight and efficient loop.

This method allows you to have both a needle and flood fill gage with
superimposed divisions, numbers etc.

e.g.


                  |   |   <- section 4   --|       GOING UP
                  |   |                    |
                  |   |                    |-- All pixels that must
              |       |   <- section 3     |   be turned on when value
              |       |                    |   moves from 2 to 4
              |       |                    |
          |           |   <- section 2   --|
          |           |
          |           |
      |               |   <- section 1
      |               |
      |               |
  |                   |   <- section 0


                      ^
                      |
                      common list of pixels





                  |   |   <- section 4   --|       GOING DOWN
                  |   |                    |
                  |   |                    |-- All pixels that must
              |       |   <- section 3   --|   be turned off when value
              |       |                        moves from 4 to 3
              |       |
          |           |   <- section 2
          |           |
          |           |
      |               |   <- section 1
      |               |
      |               |
  |                   |   <- section 0


                      ^
                      |
                      common list of pixels


This isn't taken from a game but a commercial product called XEBOT.
This is the internal mechanism it uses to update user defined gages.
The user describes a gage using two curves and XEBOT does the rest.
Sorry XEBOT wont run on a PIC.

Sergio Masci
Sentient Real Time Systems Ltd
http://www.xcprod.com/titan

<m12zhMi-001sIbC@thor.srts.co.uk> 7bit

In reply to: <FFD4860870E0D2119F8C0008C7894980023D39DB@caeis01nok> from "Peter Betts" at Jun 07, 2000 04:45:16 PM
See also: www.piclist.com/techref/io/lcd/pic.htm?key=lcd
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) LCD Graphics Routines

month overview.

new search...