There must be a better way....How??

Any general or miscellaneous queries that do not fit into the other forum catagories

Moderators: Benj, Mods

Post Reply
boa279
Posts: 38
Joined: Mon Sep 15, 2008 11:47 pm
Contact:

There must be a better way....How??

Post by boa279 »

I was just playing with something and noticed how tedious it was to get what I want accomplished. This came from an Idea to make a scale of sorts where a pressure sensor measures weight. The program lets you pick a low limit on an ADC component (the scale) and sets that at zero percent. Then you set the high end of the scale by moving the ADC to where you want. The code subracts the low reading from the high reading to get the range then divides it by "10" so either led's or an LCD can show each 10 percent increment as you move the ADC around that range.

The problem I was finding is how much it took to get get they LED's or LCD to display the 10% increments I want....What if I wanted to show every percent instead of every 10? It would take days if I had to put code in 100 times for each percent the way Ive done it with 10%. Id really be grateful if someone could take a look at my code and explain a better way of doing it....or make a simple example and let me see what it looks like so I can try myself. THANKS!!
Attachments
PLAYWITHINCREMENTS.fcf
(29.89 KiB) Downloaded 307 times

User avatar
goldwingers
Posts: 118
Joined: Wed Sep 06, 2006 1:22 pm
Location: London
Been thanked: 1 time
Contact:

Re: There must be a better way....How??

Post by goldwingers »

Hi Boa, I downloaded you FCD file but you left out the range macro.. One other little thing you may have to look at is Port A for the leds. As the analog inputs are on port A but this could be changed to port E. Try changing all your outputs into one macro and call them through variables, that may make the process somewhat smaller

Ian

boa279
Posts: 38
Joined: Mon Sep 15, 2008 11:47 pm
Contact:

Re: There must be a better way....How??

Post by boa279 »

goldwingers wrote:Hi Boa, I downloaded you FCD file but you left out the range macro..
Not sure what happened but I just downloaded it and the RANGE_SET macro is there.
goldwingers wrote:One other little thing you may have to look at is Port A for the leds. As the analog inputs are on port A but this could be changed to port E.
Good catch 8)
goldwingers wrote:Try changing all your outputs into one macro and call them through variables, that may make the process somewhat smaller
Im not sure I quite understand this one....Since each 10 percent is a different set of outputs I don't understand how it will be smaller by making each output set its own macro....and that still doesn't solve the fact I would have to do this 100 times to get each percent to display on the LCD...unless I'm misunderstanding what your trying to say.

THANKS FOR THE COMMENTS THOUGH!!

Post Reply