>I don't know why the result on your LCD is wrong. Now all you have to do >is find the bugs in your code! What I usually do at this point is back >up to the raw a/d readings and try to output those to the display. If >that works, start working through your calculation code, sending partial >results to the display. Eventually you should find where the problem lies. That was a very valuable suggestion. Thank you very much. I shall get back to you after trying the same. I have another doubt. Usually the ORP probes are calibrated with a solution of known potential. For eg: 200mV, 400mV, etc. If you dip your ORP electrode probe into the solution, you have to get the exact equivalent over the display. Some ORP display units come with a calibration option to adjust the values. As your probe ages, there may be some small signal losses which could be compensated using this option. I am planning to integrate this option to my PIC based probe. Lets assume that my display reads 196mV after x days when dipped into a 200mV solution. I am planning to add a calibrate button which when pressed while dipped in a 200mV solution, finds the actual difference between the read value and desired value and stores it in my EEPROM. This value is added to all the adc readings until next calibration. Is this a good idea or better change the reference voltage of the PIC or is there any other better option of doing it? Sairam ________________________________ From: Marcel Duchamp To: Microcontroller discussion list - Public. Sent: Sun, March 7, 2010 9:19:15 AM Subject: Re: [PIC] Orp Probe interface with PIC16F877A On 3/6/2010 6:18 PM, yamanoor sairam wrote: > Hello Mr. Marcel, I must thank you for your kind help. The opamp is > working perfectly. I am sorry that I didn't have prior experience > working with opamps. As you had suggested, I set a power supply of > 900mV from DC RPS as an input to the BNC connector. I adjusted the > offset voltage such that the output from pin 7 is exactly zero. When > I reduced my input to zero, the output voltage goes to 4.139V. >Hence, > I have a span of 4.139V for 900mV. My next issue is building a > program for this span. I have built a logic and I would like to know > whether it is correct. 4.139V is the 848th step in an ADC where 5V is > the reference. So the 900mV span varies in 848 steps i.e > 1.0625mV/step. > So I wrote a code as follows in mikroC. adc_value = > adc_read(0); // I am reading from AN0 converted_value = (long) > adc_value ; mv_value = 900 - (float)(1.0625*converted_value);// I am > converting it into a 0-900mV scale mv1_value = (long)mv_value; // I > am removing the decimals I am using the mv1_value to be printed on > the LCD. I am getting junk characters displayed on my LCD. Is this > the correct method to do it or is there an efficient way of doing > this at hardware level or in terms of software level. > > Sairam Your math numbers look correct - your 900mV to 0V input span produces and output span of 4.139V and your 10 bit A/D gives just over 1mV per bit. That looks correct. I don't know why the result on your LCD is wrong. Now all you have to do is find the bugs in your code! What I usually do at this point is back up to the raw a/d readings and try to output those to the display. If that works, start working through your calculation code, sending partial results to the display. Eventually you should find where the problem lies. If you still have problems, try posting at the mikroC forums. There are many very helpful people there. Good luck and let us know what you find out! -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist