(SOLVED) Problem with LM35, ADC0804 and 89s52 interface
Wed May 09 2012, 07:03 pm
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.
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
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, 02:33 am
I hope this is better
http://static3.album.ee/files/1068/50/orig_26712615_7S3c.jpg
http://static3.album.ee/files/1068/50/orig_26712615_7S3c.jpg
Fri May 11 2012, 01:24 am
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
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
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
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).
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
@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
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
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..
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..
Powered by e107 Forum System