This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Bar graph

Hi

In my project iam measuring the leak rate.

The range of leak rate is 1.0E-11 to 1.0E-02.Up now I measured leak rate and displayed
On the 7 segment display with 0.1 resolution. Here I used look up table method I taken hole Range values In the table and iam displaying the value for corresponding voltage .
I stored values in the farm Of (1011 =1.0E-11) here "." ,"E","-" are constants.

Now I want display the leak rate on BAR graph display.
For 20 digits I have to take one led.

The fallowing values I have to show on bar graph
1E-11, 3E-11, 5E-11, 7E-11, 9E-11, 1E-10,
3E-10, 5E-10…………………………………………2E-02

ex:
1E-11 = one led should glow
3E-11 = 2 leds should glow
5E-11 = 3 leds should glow
:
:
:


How to convert table values in to bar graph display.

Thanks

Regards

Parents
  • Thanks for reply

    Here I wane glow 50 leds means I have to send 50 ones on to the port.

    My doubt is how to store the 50 ones in the array?

    Here I well use 7 latches (8 bit data * 7 latches =48 bits).

    So I well send only 8 bits on to the port. For 48 bits I want send 7 times on to the PORT.

    Ex:


    /* First 8 bits */

    C1=0;/* latch disable*/
    P1=8 bit data;
    C1=1;/* latch enable*/


    /*Second 8 bits */

    C1=0;/* latch disable*/
    P1=8 bit data;
    C1=1;/* latch enable*/


    /* Third 8 bits */

    C1=0;/* latch disable*/
    P1=8 bit data;
    C1=1;/* latch enable*/

    :
    :


    /* Seven 8 bits */

    C1=0;/* latch disable*/
    P1=8 bit data;
    C1=1;/* latch enable*/


    How to divide the 48-bit number in to seven 8-bit numbers?

    Regards
    Sri

Reply
  • Thanks for reply

    Here I wane glow 50 leds means I have to send 50 ones on to the port.

    My doubt is how to store the 50 ones in the array?

    Here I well use 7 latches (8 bit data * 7 latches =48 bits).

    So I well send only 8 bits on to the port. For 48 bits I want send 7 times on to the PORT.

    Ex:


    /* First 8 bits */

    C1=0;/* latch disable*/
    P1=8 bit data;
    C1=1;/* latch enable*/


    /*Second 8 bits */

    C1=0;/* latch disable*/
    P1=8 bit data;
    C1=1;/* latch enable*/


    /* Third 8 bits */

    C1=0;/* latch disable*/
    P1=8 bit data;
    C1=1;/* latch enable*/

    :
    :


    /* Seven 8 bits */

    C1=0;/* latch disable*/
    P1=8 bit data;
    C1=1;/* latch enable*/


    How to divide the 48-bit number in to seven 8-bit numbers?

    Regards
    Sri

Children
  • "How to divide the 48-bit number in to seven 8-bit numbers?"

    Why 48 bits?
    If you have 50 LEDs, you need 50 bits!

    Keil C51 doesn't have any data type larger than 32 bits anyhow, so you can't do it directly.

    Easiest way is probably to have a 7-byte array:

    array[0] holds bits 0-7;
    array[1] holds bits 8-15;
    :
    :
    array[6] holds bits 48-55 (note you have some spare bits here).

    Hint: Look up the Modulus operator, '%' (percentage sign), in your 'C' textbook - it will come in useful in deciding which bit to set in which byte of the array...