Whack !! Ouch !! Gotta stop whacking my forehead like that. Ok, that's easy. So if my load measurement is say 45000 then I need the first ( 65535/30 = ~2184, 45000/2184 = ~21 ) 21 LEDS lit. Shift out 9 zeros then 21 ones. I guess I was making a mountain out of a mole hill !! Regarding the Borland Forum, I enjoyed being a part of that community and I missed it when it changed. The members of this list seem to share the same spirit and I'm glad to be a part of it. Eric -----Original Message----- From: Gerhard Fiedler [SMTP:lists@HOME.COM] Sent: Monday, February 22, 1999 2:09 AM To: PICLIST@MITVMA.MIT.EDU Subject: Re: How to display 0 - 100% on an LED bar At 23:41 02/21/99 -0600, Eric Oliver wrote: > Several years ago, I belonged to the Borland C++ forum on CIS. It was >there that I learned to program. Over time I was able to give back to that >group. that was really a good forum, many years ago! :) or is that :( ? >I would like to pose a question. I'm not really planning to use this >algorithm at this time, but I just bought three LED chips from Radio Shack. >I'm sure most of you know the item. Each chip consists of ten LEDs in a >bar configuration. You can mount any number of them side by side to form a >chain of bars. I used them to test my PIC hooked up to some 595s. > >But I was thinking that they could be used to convey information in the >form of a bar. With values ranging from 0% to 100%. For instance, if you >chained three chips, the first green, the next yellow and the last one was >red. Say you were monitoring spindle load on a machine. As the load >progresses from 0% to ~33% the green LEDs would light in succession, as it >moved past 33% through ~66% the yellow LEDs would begin to light and so on. > >So what I can't figure out is how to translate the load ( in the previous >example ) to the bit representation needed to shift to the 595s. Just as >an example, let's say the spindle load is measured and the result would be >between 0 and 65535. Now, we would need 30 bits to control all 30 LEDs. >How would you go about converting the load to the 30 bit number ? you don't need a 30bit number just because you want to drive a 30led bar :) all you need is a number from 0 to 30, which boils down to a simple division, if your representation is linear. 0->0%->no led, 65535->100%->all (30) leds. that's 30 intervals for 65535, hence each interval (corresponding to one led more) is 65535/30... you divide your load by this number, and get the number of leds to switch on. ge