Technical discussions about Freescale Microcontrollers: M68HC11. (Freescale Semiconductor is a Subsidiary of Motorola).
Hi, I am new to HC11.I am doing a tiny project. It is a water tank regulator. The tank will be filled with sensors(potentiometer), and i shall use A/D to convert and display it thru SCI. My problem here is: i need 4 sensors and only generate 1 output(multichannel/single?) and display the output!how to combine 4 output from the sensors and combine into 1 output to be display?the conversion has to be continous as the result shown is real time. i will also have to be able to regulate the water level.for instance, if water lvl is now at 90% i will have to release the water(eg: in this case light up the LED). i would really appreciate any help here. THANKS
In a message dated 2/15/2006 3:46:56 A.M. Eastern Standard Time, crazejuice@craz... writes: It is a water tank regulator. The tank will be filled with sensors(potentiometer), and i shall use A/D to convert and display it thru SCI. My problem here is: i need 4 sensors and only generate 1 output(multichannel/single?) and display the output!how to combine 4 output from the sensors and combine into 1 output to be display?the conversion has to be continous as the result shown is real time. i will also have to be able to regulate the water level.for instance, if water lvl is now at 90% i will have to release the water(eg: in this case light up the LED). =============================================== There must be some other requirement the professor wants that you havent copied from the assignment sheet. If you only have one tank and one valve, why have 4 pots? Redundancy? How is it supposed to respond if one pot indicates low water, one says high water, one says 'just right'? (I guess you didn't really mean the tank was filled with sensors...) [Non-text portions of this message have been removed]
Edvin wrote:
> Hi,
> I am new to HC11.I am doing a tiny project. It is a water tank regulator.
Rest assured that, if this is homework, your professor is
reading this.
> The tank will be filled with sensors(potentiometer), and i shall use
> A/D to convert and display it thru SCI.
Hmm. I don't see any "regulation" here.
> My problem here is:
> i need 4 sensors and only generate 1 output(multichannel/single?) and
> display the output!how to combine 4 output from the sensors and
> combine into 1 output to be display?the conversion has to be continous
> as the result shown is real time.
What are the real time constraints? I'd guess you don't have
any, as this is a homework problem.
Define "display".
One possibility is, if you have something which can interpret ANSI
escape sequences for cursor control, then to embed them in the
output.
You could write some code to do a multi-port conversion
of the A/D for four of the ports. Then...
You could write a loop like this...
Define FirstSensor 1
Define LastSensor 4
Forever
ReadSensors
For Sensor in FirstSensor to LastSensor Do
PositionCursor(Sensor)
AsciiDigits = ConvertValue(Value(Sensor))
SendString(AsciiDigits)
If Value(Sensor) >= TestValue(Sensor) Then
DumpWater(Sensor)
End If
Next Sensor
End For
End Forever
> i will also have to be able to regulate the water level.for instance,
Ah, now we get to some nitty gritty.
> if water lvl is now at 90% i will have to release the water(eg: in
> this case light up the LED).
Don't forget to add hysteresis if necessary.
Also, make sure either to overwrite all previous data,
or clear the field before writing new data.
If you are using BUFFALO, don't forget that it uses
PORTE.0 as a contol pin, and you can't really use it
for A/D.
If you are using assembler, don't forget to set up
a stack!
> i would really appreciate any help here.
> THANKS
HTH
Hope this isn't homework, because your prof is reading this.
Mike
--
p="p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}
This message made from 100% recycled bits.
You have found the bank of Larn.
I can explain it for you, but I can't understand it for you.
I speak only for myself, and I am unanimous in that!
Firstly,thanks for the reply..
What i wrote was using machine language..i think the one u explained
is using VHDL?
This is something i wrote
ldaa ADR1
staa REG
ldaa ADR2
staa REG2
.
..
...
As my desired program is to gather all 4 digital signals from 4
sensors and then make it as a whole.
for instance..4 sensors are placed at different level.
I would like to display only 1 output at different water level.My case
if i have 4 different outputs from 4 sensors...how to sum them up to
become 1?
i hope i am clear at this.hehe...thanks guys
--- In m68HC11@m68H..., Mike McCarty <Mike.McCarty@...> wrote:
>
> Edvin wrote:
> > Hi,
> > I am new to HC11.I am doing a tiny project. It is a water tank
regulator.
>
> Rest assured that, if this is homework, your professor is
> reading this.
>
> > The tank will be filled with sensors(potentiometer), and i shall use
> > A/D to convert and display it thru SCI.
>
> Hmm. I don't see any "regulation" here.
>
> > My problem here is:
> > i need 4 sensors and only generate 1 output(multichannel/single?) and
> > display the output!how to combine 4 output from the sensors and
> > combine into 1 output to be display?the conversion has to be continous
> > as the result shown is real time.
>
> What are the real time constraints? I'd guess you don't have
> any, as this is a homework problem.
>
> Define "display".
>
> One possibility is, if you have something which can interpret ANSI
> escape sequences for cursor control, then to embed them in the
> output.
>
> You could write some code to do a multi-port conversion
> of the A/D for four of the ports. Then...
>
> You could write a loop like this...
>
> Define FirstSensor 1
> Define LastSensor 4
>
> Forever
> ReadSensors
> For Sensor in FirstSensor to LastSensor Do
> PositionCursor(Sensor)
> AsciiDigits = ConvertValue(Value(Sensor))
> SendString(AsciiDigits)
> If Value(Sensor) >= TestValue(Sensor) Then
> DumpWater(Sensor)
> End If
> Next Sensor
> End For
> End Forever
>
> > i will also have to be able to regulate the water level.for instance,
>
> Ah, now we get to some nitty gritty.
>
> > if water lvl is now at 90% i will have to release the water(eg: in
> > this case light up the LED).
>
> Don't forget to add hysteresis if necessary.
>
> Also, make sure either to overwrite all previous data,
> or clear the field before writing new data.
>
> If you are using BUFFALO, don't forget that it uses
> PORTE.0 as a contol pin, and you can't really use it
> for A/D.
>
> If you are using assembler, don't forget to set up
> a stack!
>
> > i would really appreciate any help here.
> > THANKS
>
> HTH
>
> Hope this isn't homework, because your prof is reading this.
>
> Mike
> --
> p="p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}
> This message made from 100% recycled bits.
> You have found the bank of Larn.
> I can explain it for you, but I can't understand it for you.
> I speak only for myself, and I am unanimous in that!
>
This is actually a simulation that my friend would like to try out. the main problem i am facing is how to combine 4 results to become 1. ok, i will explain again. okay make it this way... lets say: an apartment has 5 levels, each level is like a sensor in my project. ok, let say the elevator is at lvl 3 now. i wan my display to show lvl3, instead of showing the values of each sensors in lvl 1,2,3. I asked my lecturer how can i use pot as a sensor.he gave me an idea.its like, when ur water level is at 2, sensor 1 and 2(the lower 1's) will be colder hence giving different digital output as the one above. i once tot can i sum all of the values from each pot, but it doenst seems to be working... after i got the digital values, i will hv to convert it to % using ASCII. the problem is how to sum the values... i am confused --- In m68HC11@m68H..., BobGardner@... wrote: > > > In a message dated 2/15/2006 3:46:56 A.M. Eastern Standard Time, > crazejuice@... writes: > > It is a water tank regulator. > The tank will be filled with sensors(potentiometer), and i shall use > A/D to convert and display it thru SCI. > My problem here is: > i need 4 sensors and only generate 1 output(multichannel/single?) and > display the output!how to combine 4 output from the sensors and > combine into 1 output to be display?the conversion has to be continous > as the result shown is real time. > i will also have to be able to regulate the water level.for instance, > if water lvl is now at 90% i will have to release the water(eg: in > this case light up the LED). > > > > =============================================== > There must be some other requirement the professor wants that you havent > copied from the assignment sheet. If you only have one tank and one valve, why > have 4 pots? Redundancy? How is it supposed to respond if one pot indicates low > water, one says high water, one says 'just right'? (I guess you didn't > really mean the tank was filled with sensors...) > > > [Non-text portions of this message have been removed] >
BobGardner@BobG... wrote:
> There must be some other requirement the professor wants that you havent
> copied from the assignment sheet. If you only have one tank and one valve, why
> have 4 pots? Redundancy? How is it supposed to respond if one pot indicates low
> water, one says high water, one says 'just right'? (I guess you didn't
> really mean the tank was filled with sensors...)
I presumed he had 4 tanks with one sensor each, and 4 LEDs.
YMMV
Mike
--
p="p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}
This message made from 100% recycled bits.
You have found the bank of Larn.
I can explain it for you, but I can't understand it for you.
I speak only for myself, and I am unanimous in that!
its one tank with 4 sensors(potentiometer )
this is my lecturer idea.so i took up the challenge and try to work it
out
--- In m68HC11@m68H..., Mike McCarty <Mike.McCarty@...> wrote:
>
> BobGardner@... wrote:
> > There must be some other requirement the professor wants that you
havent
> > copied from the assignment sheet. If you only have one tank and
one valve, why
> > have 4 pots? Redundancy? How is it supposed to respond if one pot
indicates low
> > water, one says high water, one says 'just right'? (I guess you
didn't
> > really mean the tank was filled with sensors...)
>
> I presumed he had 4 tanks with one sensor each, and 4 LEDs.
>
> YMMV
>
> Mike
> --
> p="p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}
> This message made from 100% recycled bits.
> You have found the bank of Larn.
> I can explain it for you, but I can't understand it for you.
> I speak only for myself, and I am unanimous in that!
>
Edvin wrote:
> This is actually a simulation that my friend would like to try out.
> the main problem i am facing is how to combine 4 results to become 1.
> ok, i will explain again.
> okay make it this way...
>
> lets say:
> an apartment has 5 levels, each level is like a sensor in my project.
> ok, let say the elevator is at lvl 3 now. i wan my display to show
> lvl3, instead of showing the values of each sensors in lvl 1,2,3.
>
> I asked my lecturer how can i use pot as a sensor.he gave me an
> idea.its like, when ur water level is at 2, sensor 1 and 2(the lower
> 1's) will be colder hence giving different digital output as the one
> above.
Ah, ok. You can simply look at the values, and convert them into
Covered/NotCovered states. Be sure to include some hysteresis,
so you don't get oscillation.
> i once tot can i sum all of the values from each pot, but it doenst
> seems to be working...
Well, depends. You could do that if you weight the inputs.
> after i got the digital values, i will hv to convert it to % using ASCII.
> the problem is how to sum the values...
> i am confused
See above.
Put the sensors at the locations of interest. If the bottom
one is uncovered, then report < 25%. If the bottom one is
covered, but the middle one is uncovered, report 25-50%.
If the bottom two are covered, then report 75-90%.
If the top one is covered (put it at the 90% point)
then report 90%, and dump.
Mike
--
p="p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}
This message made from 100% recycled bits.
You have found the bank of Larn.
I can explain it for you, but I can't understand it for you.
I speak only for myself, and I am unanimous in that!
Edvin wrote:
> Firstly,thanks for the reply..
I prefer that you not top post. Thanks for your
cooperation.
> What i wrote was using machine language..i think the one u explained
> is using VHDL?
Nope. It's called pseudo code. It's just an ad hoc language
I made up as I went, for purposes of communicating the
computatonal procedure. (Not algorithm, because it doesn't
terminate.)
> As my desired program is to gather all 4 digital signals from 4
> sensors and then make it as a whole.
Put the sensors at the positions you are interested in,
and digitize the inputs with a little hysteresis, both
in time and in value.
[snip]
It really wasn't necessary to quote my entire message.
Only the parts you actually responded to were useful.
Mike
--
p="p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}
This message made from 100% recycled bits.
You have found the bank of Larn.
I can explain it for you, but I can't understand it for you.
I speak only for myself, and I am unanimous in that!
> -----Original Message----- > From: m68HC11@m68H... > [mailto:m68HC11@m68H...]On Behalf > Of Edvin > Sent: Wednesday, February 15, 2006 1:52 PM > To: m68HC11@m68H... > Subject: [m68HC11] Re: A/D with sensors! > > > its one tank with 4 sensors(potentiometer ) > this is my lecturer idea.so i took up the challenge and try to work it > out Hello Edvin, Maybe your lecturer meant that you should use the sensors to indicate just on or off (sensor is under or above water level). Regarding the program there is no magic. Imagine yourself sitting inside a box. On the wall you have four lamps 1-4 where nr 1 is connected to the lowest sensor. You can easily see that if for example light 1+2 are lit the level is somewhere between position of sensor 2 and sensor 3. To get more precision the sensors could be actually be some potentiometers arranged so that nr 1 will give 0-100% signal for level 0-1m, nr 2 0-100% for level 1-2m and so on. In this case you will have four scales 0-100% on the wall in your box and will read for example: Sensor 1 = 100% Sensor 2 = 100% Sensor 3 = 50% Sensor 4 = 0% which indicates level 2.5 m. You will also understand that there are combinations that are not logical (for example if sensor 1 was 0% in the example) and deal with them someway. You can design this by asking yourself what you (= the program in the box) is expected to output and then deside on what type of sensor arrangement is required for the job. Good luck, Anders
Edvin wrote:
> Hi,
> I am new to HC11.I am doing a tiny project. It is a water tank regulator.
> The tank will be filled with sensors(potentiometer), and i shall use
> A/D to convert and display it thru SCI.
> My problem here is:
> i need 4 sensors and only generate 1 output(multichannel/single?) and
> display the output!how to combine 4 output from the sensors and
> combine into 1 output to be display?the conversion has to be continous
> as the result shown is real time.
> i will also have to be able to regulate the water level.for instance,
> if water lvl is now at 90% i will have to release the water(eg: in
> this case light up the LED).
>
> i would really appreciate any help here.
> THANKS
Here's another possibility. Connect all the thermistors in series.
Like this...
o Vout
R1 | T1 T2 T3 T4
+5v o--/\/\-+-/\/\---/\/\---/\/\---/\/\---o Gnd
Put the ground end at the bottom of the tank.
As each thermistor gets covered, its resistance goes up,
and the voltage out also goes up. R1 could be about 10k,
as is each thermistor. Vout goes to a single A/D port.
A little math or experimentation with a voltmeter
(high impedance, not a 20Kohm/V) will give you the
info you need.
Mike
--
p="p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}
This message made from 100% recycled bits.
You have found the bank of Larn.
I can explain it for you, but I can't understand it for you.
I speak only for myself, and I am unanimous in that!
From original post - - - - crazejuice@craz... writes: It is a water tank regulator. The tank will be filled with sensors(potentiometer), and i shall use A/D to convert and display it thru SCI. > > > > Here's another possibility. Connect all the thermistors in series. > > Like this... > > o Vout > > R1 | T1 T2 T3 T4 > > +5v o--/\/\-+-/\/\---/\/\---/\/\---/\/\---o Gnd > > > > Put the ground end at the bottom of the tank. > > > > As each thermistor gets covered, its resistance goes up, > > and the voltage out also goes up. R1 could be about 10k, > > as is each thermistor. Vout goes to a single A/D port. > > A little math or experimentation with a voltmeter > > (high impedance, not a 20Kohm/V) will give you the > > info you need. > > > > Mike > > -- > > Nice idea but there may be a problem if the water temp is not constant? > Hey guys -- where did I miss the U turn in this thread?? This started out with potentiometers as sensors. Now its thermistors??????? No, wonder the original poster seems confused?? Maybe been sniffing too much crazejuice?? I still haven't seen this problem well defined. Fundamental axiom of data processing, "If you store a data item in two or more places in a program, eventually one of those will be wrong". Embedded control systems version of above, "If you use n (where n > 1) sensors to sense a property, n-1 of those will be wrong" Question for extra credit; "filled with sensors(potentiometer)" How many sensors(potentiometer) will the tank hold when its filled?? Bob Smith