Discussion in "8051 Discussion Forum" started by    rvs    May 9, 2012.
Wed May 09 2012, 07:03 pm
#1
I have a school project and I can't make it work correctly. I used diagram and code from this page http://www.eprlabs.com/2011/11/89s52-based-temperature-sensor-using-adc/. I added reset button, relay and ISP for programming. Now, the program shows values from 011 to 014 at room temperature (about 24 degrees in Celsius). Can anyone help me with writing the code, so it would work correctly? In the code I'm using right now, the relay isn't used at all.
Looking forward to solutions!

Raivo


Picture of diagram is
http://static3.album.ee/files/1068/45/orig_26711343_BgYl.jpg

Names of elements in diagram are not correct, because Eagle didn't have correct items and I used items, that had same size/number of legs/function for printig on board.


[ Edited Tue May 15 2012, 12:29 pm ]
Thu May 10 2012, 01:52 am
#2
I am not able to see the circuit clearly. can you attach the full resolution image in post instead of directly posting it?
Thu May 10 2012, 01:53 am
#3
[Topic moved to 8051 Discussion forum]
Thu May 10 2012, 02:33 am
#4
I hope this is better
http://static3.album.ee/files/1068/50/orig_26712615_7S3c.jpg
Fri May 11 2012, 01:24 am
#5
you're using a different sensor that what is used on that website. I mean that website uses LM35 whereas you're using LM50 so calibration table will change i guess. Do check datasheets of both the sensors and do the modifications accordingly.
Fri May 11 2012, 01:53 am
#6
I'm using LM35. Like I said in previous post, I had to use elements that Eagle had in it (I used LM50 in diagram for printig on board because it was the same size and holes fitted on board).
Fri May 11 2012, 02:30 am
#7
yeah one more thing which is missing in your circuit is.. ADC0804 VREF is connected to VCC where as in your case its left unconnected. please do that change coz Vref will have direct effect on the ADC readings, as its the reference voltage for calculating the ADC value.
Fri May 11 2012, 01:08 pm
#8
Thank you! Got it working! It isn't still on on room temperature, it shows abooud +- 1 degree, but that is not a big deal at the moment.

Now second part of my problem. I need to get relay to switch (for example) at 27 degrees Celsius. Could someone please write me the code for it (so I could copy-paste it to my original code).
Fri May 11 2012, 05:19 pm
#9
@rvs , its really simple , just take the value from ADC into a register and compare it to required value , depending on the output (if register value is zero , less than or equal to) you can either set or reset the pin to which you have your relay connected

and dont expect someone to write a code for you , try it urself and if the problem exists we are all here to help you
Fri May 11 2012, 06:55 pm
#10
I know the principle of how it shoul be done, but I don't can't write it in assembler code, I don't understand what (or where) is #38H, #0EH, #06H....

It takes from register 1 and puts it into #38H? Then it calls register 1 again? Why does it move register 1 to so many places?


It's simpler to say that I don't know assembler code..

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

Michailqfh
Fri Mar 29 2024, 01:53 am
Bobbyerilar
Thu Mar 28 2024, 08:08 am
pb58
Thu Mar 28 2024, 05:54 am
Clarazkafup
Thu Mar 28 2024, 02:24 am
Walterkic
Thu Mar 28 2024, 01:19 am
Davidusawn
Wed Mar 27 2024, 08:30 pm
Richardsop
Tue Mar 26 2024, 10:33 pm
Stevencog
Tue Mar 26 2024, 04:26 pm