<?xml version="1.0" encoding="utf-8" ?>
				<!-- generator="e107" -->
				<!-- content type="Forum / topic" -->
				<rdf:RDF xmlns="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
				<channel rdf:about="http://www.8051projects.net/">
				<title>8051 Microcontroller Projects AVR PIC Projects Tutorials Ebooks Libraries codes : Forum / topic</title>
				<link>http://www.8051projects.net/</link>
				<description>Learn to make simple microcontroller projects, pic, 8051, avr and arm projects. download 8051 projects, tutorials, libraries, sample codes. join the microcontroller discussion forum and ask doubts regarding electronics. the best source for 8051 over internet.</description>
				<dc:language>en-gb</dc:language>
				<dc:date>2008-12-01T23:27:32-08:00</dc:date>
				<dc:creator>contact@nospam.com</dc:creator>
				<admin:generatorAgent rdf:resource="http://e107.org" />
				<admin:errorReportsTo rdf:resource="mailto:contact@nospam.com" />
				<sy:updatePeriod>hourly</sy:updatePeriod>
				<sy:updateFrequency>1</sy:updateFrequency>
				<sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
				<items>
				<rdf:Seq>
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t1343.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t1343.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t1343.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t1343.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t1343.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t1343.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t1343.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t1343.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t1343.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t1343.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t1343.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t1343.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t1343.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t1343.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t1343.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t1343.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t1343.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t1343.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t1343.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t1343.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t1343.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t1343.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t1343.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t1343.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t1343.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t1343.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t1343.html" />
				</rdf:Seq>
				</items>
				</channel>
						<item rdf:about="http://www.8051projects.net/forum-t1343.html">
						<title>PIC C code and Comparator Hysteresis</title>
						<link>http://www.8051projects.net/forum-t1343.html</link>
						<dc:date>2008-12-01T23:27:32-08:00</dc:date>
						<dc:creator></dc:creator>
						<dc:subject></dc:subject>
						<description>hi, would any one send me an example PIC C code to take averages of many ADC values, to get a stable one so that a comparator with hysteresis effect may be obtain.</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t1343.html">
						<title>Re: PIC C code and Comparator Hysteresis</title>
						<link>http://www.8051projects.net/forum-t1343.html</link>
						<dc:date>2008-12-01T23:27:32-08:00</dc:date>
						<dc:creator>Ajay</dc:creator>
						<dc:subject></dc:subject>
						<description>its fairly easy... create an array and store the value.. like this...unsigned long int adc_val;unsigned int adc_avg; // stores adc average valuemain() { //this is just to explain       unsigned char i;       adc_val =0;       for(i=0;i</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t1343.html">
						<title>Re: PIC C code and Comparator Hysteresis</title>
						<link>http://www.8051projects.net/forum-t1343.html</link>
						<dc:date>2008-12-01T23:27:32-08:00</dc:date>
						<dc:creator>Luqman</dc:creator>
						<dc:subject></dc:subject>
						<description>/in the following programe //Vs taking different adc values                    //when Vs&lt;=Va and when FG1=1 then LED at pin c4 should be on at Vs=Va+Va_1/2//and for the same Vs&lt;=Va but FG1=0 LED at pin c4 should be off at Vs=Va-Va_1/2//i.e. want to get flashing of LED with some delay at a slightly different voltages//so that trying to achieve a compratr with hystarisis//how it could be achieve plz suggest a practical logic to cachieve this task#include "snsr1.h"#define cutoff 255      //5V#define Va_1   10        //0.2V#define Va     51        //1V#define Vb     102      //2v#define Vc     179      //3.5vvoid main(){   int Vs;   int1 FG1,FG2,FG3,FG4;   setup_adc_ports(AN0);   setup_adc(ADC_CLOCK_INTERNAL);   setup_psp(PSP_DISABLED);   setup_spi(FALSE);   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);   setup_timer_1(T1_DISABLED);   setup_timer_2(T2_DISABLED,0,1);   setup_comparator(NC_NC_NC_NC);   setup_vref(FALSE);   // TODO: USER CODE!!while(1) {  set_adc_channel( 0 );  Vs = read_adc();  if(Vs&lt;=Va)  {    FG1=1;    Vs = Va+Va_1/2;   output_bit(PIN_C4,1);   output_bit(PIN_C5,0);   output_bit(PIN_C6,0);   delay_ms(1000);   FG1=0;   Vs = Va-Va_1/2;   output_bit(PIN_C4,0);   output_bit(PIN_C5,0);   output_bit(PIN_C5,0);  }  else if(Va&lt;Vs&lt;=Vb)     {      FG2=1;      output_bit(PIN_C4,1);      output_bit(PIN_C5,0);      output_bit(PIN_C6,0);     }           else if(Va&lt;Vs&lt;=Vc)     {      FG3=1;      output_bit(PIN_C4,0);      output_bit(PIN_C5,1);      output_bit(PIN_C6,0);     }  else     {      FG4=1;      output_bit(PIN_C4,0);      output_bit(PIN_C5,0);      output_bit(PIN_C6,1);     }   }}</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t1343.html">
						<title>Re: PIC C code and Comparator Hysteresis</title>
						<link>http://www.8051projects.net/forum-t1343.html</link>
						<dc:date>2008-12-01T23:27:32-08:00</dc:date>
						<dc:creator>Ajay</dc:creator>
						<dc:subject></dc:subject>
						<description>As i gave you an example already.. i think you did not read it carefully.. anyways you need to make just a little change in your program.Please replace Vs = read_adc();in your program with the code belowCODE:adc_val =0;<br />for&#40;i=0;i&lt;50;i++){<br />&nbsp; &nbsp; &nbsp;adc_val+ = read_adc&#40;&#41;;<br />&#125;<br />Vs = adc_val/50;<br />&nbsp;and define adc_val as unsigned long int and define i as unsigned char.. and see what you get..</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t1343.html">
						<title>Re: PIC C code and Comparator Hysteresis</title>
						<link>http://www.8051projects.net/forum-t1343.html</link>
						<dc:date>2008-12-01T23:27:32-08:00</dc:date>
						<dc:creator>Luqman</dc:creator>
						<dc:subject></dc:subject>
						<description>i really appreciate ur concern  there is Flow Chart named  FC1.doc file and modified code with ur suggestions, i m trying to achieve the following conditions1) When Vs&lt;=Va  Green LED flashes(on and off) with certain delay  and RLY1 should also be on and off with the above delay. It was achieved in comparator based circuitwith adding a flasher cct. (a comparator withhysteresis).This hysteresis effect has to implement insoftware.2) WhenVa&lt;Vs&lt;=Vb   Green LED on constantly   and RLY1 should off3) When Vb&lt;Vs&lt;=Vc   yellow LED on   and RLY2 should on4) When Vc&lt;Vs   Red LED on   and RLY3 should onplz suggest me the practical schematic(16F877 cct.) to meet  for these conditions and sugget me the corresponding modifications in the code.</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t1343.html">
						<title>Re: PIC C code and Comparator Hysteresis</title>
						<link>http://www.8051projects.net/forum-t1343.html</link>
						<dc:date>2008-12-01T23:27:32-08:00</dc:date>
						<dc:creator>Ajay</dc:creator>
						<dc:subject></dc:subject>
						<description>well whatever you are telling you can do by yourself.. i ain't giving you any code for that..but for point 1. can you first tell me what is the result you're getting with the software change i told you?</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t1343.html">
						<title>Re: PIC C code and Comparator Hysteresis</title>
						<link>http://www.8051projects.net/forum-t1343.html</link>
						<dc:date>2008-12-01T23:27:32-08:00</dc:date>
						<dc:creator>Luqman</dc:creator>
						<dc:subject></dc:subject>
						<description>actually i have some doubts in my cct. (schematic) as well, that how can i connect an LED and Relay at the same port pin a/c to my desired condition and what voltage should i give  at Vref- and Vref+. would u like to suggest me the schematic(cct.) plz.</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t1343.html">
						<title>Re: PIC C code and Comparator Hysteresis</title>
						<link>http://www.8051projects.net/forum-t1343.html</link>
						<dc:date>2008-12-01T23:27:32-08:00</dc:date>
						<dc:creator>Ajay</dc:creator>
						<dc:subject></dc:subject>
						<description>connecting led is simple..5V |----/&#092;/&#092;/&#092;/&#092;----|>|---Port Pinand for connecting relays.. i have added a document in the circuit section of the download check it. It has full explanation of the different circuits that can be used for the relays..In your case i think the Fig D of the document is the best way to connect the relay.</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t1343.html">
						<title>Re: PIC C code and Comparator Hysteresis</title>
						<link>http://www.8051projects.net/forum-t1343.html</link>
						<dc:date>2008-12-01T23:27:32-08:00</dc:date>
						<dc:creator>Luqman</dc:creator>
						<dc:subject></dc:subject>
						<description>u say that i just finish things like while(1) {----}what does it mean</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t1343.html">
						<title>Re: PIC C code and Comparator Hysteresis</title>
						<link>http://www.8051projects.net/forum-t1343.html</link>
						<dc:date>2008-12-01T23:27:32-08:00</dc:date>
						<dc:creator>Ajay</dc:creator>
						<dc:subject></dc:subject>
						<description>that was a part of my signature..   doesn't matter   did u see the circuit? i hope you wont have any problem now</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t1343.html">
						<title>Re: PIC C code and Comparator Hysteresis</title>
						<link>http://www.8051projects.net/forum-t1343.html</link>
						<dc:date>2008-12-01T23:27:32-08:00</dc:date>
						<dc:creator>Ajay</dc:creator>
						<dc:subject></dc:subject>
						<description>well selecting an EEPROM for your project is usually depends on your requirement, and also second point is the compatibility. Its not mandatory that you should use only one type of EEPROM. e.g. your project need a maximum data of 2Kb to store so, there is no point for you to use an EEPROM of 8Kb or something.. i hope you understand my point. So according to need of your project you can select EEPROM.</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t1343.html">
						<title>Re: PIC C code and Comparator Hysteresis</title>
						<link>http://www.8051projects.net/forum-t1343.html</link>
						<dc:date>2008-12-01T23:27:32-08:00</dc:date>
						<dc:creator>Luqman</dc:creator>
						<dc:subject></dc:subject>
						<description>Y does 9306 Serial EEPROM is interfaced with controllers? Is it good to interfaced it with PIC controllers?</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t1343.html">
						<title>Re: PIC C code and Comparator Hysteresis</title>
						<link>http://www.8051projects.net/forum-t1343.html</link>
						<dc:date>2008-12-01T23:27:32-08:00</dc:date>
						<dc:creator>Luqman</dc:creator>
						<dc:subject></dc:subject>
						<description>hi, ajayThere is a comparator module in PIC 16F877 how can i configure it or program it to achieve system hysteresis i.e. the stability(control) in on/off a device?</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t1343.html">
						<title>Re: PIC C code and Comparator Hysteresis</title>
						<link>http://www.8051projects.net/forum-t1343.html</link>
						<dc:date>2008-12-01T23:27:32-08:00</dc:date>
						<dc:creator>Ajay</dc:creator>
						<dc:subject></dc:subject>
						<description>you cannot achieve a perfect hysteresis in comparator. because minor fluctuations are always there. But i really don't know any other method to achieve hysteresis except taking averages. I have seen many projects (like digital thermometer etc.) where i have taken averages and its working pretty file. You can also define a particular limit upto which the o/p holds its stability.e.g. define rage for a constant value.say you want to have a value 5 for which switching is done.so define a range. like.. from 3-7 or 4-6 as per your need and amount of fluctuation. This will help you control the switching and minor fluctuations will be neglected.Also what you can have a high resolution comparator. That also will solve your purpose, but it will be a separate hardware.</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t1343.html">
						<title>Re: PIC C code and Comparator Hysteresis</title>
						<link>http://www.8051projects.net/forum-t1343.html</link>
						<dc:date>2008-12-01T23:27:32-08:00</dc:date>
						<dc:creator>Luqman</dc:creator>
						<dc:subject></dc:subject>
						<description>would u brief me an example C code to define a specific range and amount of fluctuation.How can i get C code for digital thermometer from download section at the forum</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t1343.html">
						<title>Re: PIC C code and Comparator Hysteresis</title>
						<link>http://www.8051projects.net/forum-t1343.html</link>
						<dc:date>2008-12-01T23:27:32-08:00</dc:date>
						<dc:creator>Ajay</dc:creator>
						<dc:subject></dc:subject>
						<description>I have not posted the thermometer project yet.. but i will do it. soon... instead of just using one if statementlikeif(dat6)    switch somethingelse if(dat</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t1343.html">
						<title>Re: PIC C code and Comparator Hysteresis</title>
						<link>http://www.8051projects.net/forum-t1343.html</link>
						<dc:date>2008-12-01T23:27:32-08:00</dc:date>
						<dc:creator>Luqman</dc:creator>
						<dc:subject></dc:subject>
						<description>i've downloaded ur code at download section for 89C4051 as RTC  as it is a software based RTC instead of interfacing external RTC IC's ,but i didn't understand it completely so i want to know that from where did u conceived the idea is there any resources(like tutorial) available on the net which help me to understand the software based RTC.</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t1343.html">
						<title>Re: PIC C code and Comparator Hysteresis</title>
						<link>http://www.8051projects.net/forum-t1343.html</link>
						<dc:date>2008-12-01T23:27:32-08:00</dc:date>
						<dc:creator>Ajay</dc:creator>
						<dc:subject></dc:subject>
						<description>well.. the only idea i had in mind was...60 seconds = 1 min60 min = 1hr24 hr = 1 day30/31/28 days = 1 month12 months = 1 yearSo i had this idea   using a for loop!! isn't that simple?</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t1343.html">
						<title>Re: PIC C code and Comparator Hysteresis</title>
						<link>http://www.8051projects.net/forum-t1343.html</link>
						<dc:date>2008-12-01T23:27:32-08:00</dc:date>
						<dc:creator>Ajay</dc:creator>
						<dc:subject></dc:subject>
						<description>its a biiiiggg.. code.. i cannot comment all of it... will look rubbish.. also it need time.. you can paste the part of code which u didn't understand, i will comment it here..</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t1343.html">
						<title>Re: PIC C code and Comparator Hysteresis</title>
						<link>http://www.8051projects.net/forum-t1343.html</link>
						<dc:date>2008-12-01T23:27:32-08:00</dc:date>
						<dc:creator>Luqman</dc:creator>
						<dc:subject></dc:subject>
						<description>i read 89C4051 as RTC and only understand  few functions with the help of commenst written in the code the remaining functions i did not understand would u give details of the code in a tutorial manner as u have done it in the LCD tutorial.</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t1343.html">
						<title>Re: PIC C code and Comparator Hysteresis</title>
						<link>http://www.8051projects.net/forum-t1343.html</link>
						<dc:date>2008-12-01T23:27:32-08:00</dc:date>
						<dc:creator>Luqman</dc:creator>
						<dc:subject></dc:subject>
						<description>how does the following cunction give 1 second delay?void sec1()//can be fine tuned by changing the for loop values {	bit_8 i,j;	TMOD=0x11;	for(i=0;i&lt;230;i++)		_nop_();	for(i=0;i&lt;7;i++)	{		TH1=0;		TH0=1;		TL1=0;		TL0=0;		TR1=1;		for(j=0;j&lt;119;j++)			_nop_();		while(TF1!=1)		{			for(j=0;j&lt;255;j++);				_nop_();		}		TF1=0;		TR0=1;		TR1=0;		while(TF0!=1)		{			for(j=0;j&lt;120;j++)				_nop_();		}		TF0=0;		TR0=0;	} }</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t1343.html">
						<title>Re: PIC C code and Comparator Hysteresis</title>
						<link>http://www.8051projects.net/forum-t1343.html</link>
						<dc:date>2008-12-01T23:27:32-08:00</dc:date>
						<dc:creator>Ajay</dc:creator>
						<dc:subject></dc:subject>
						<description>well i was noob at that time..   when i wrote that function.. try writing a better 1 sec delay yourself   take care of the call and jumps etc.try making 1 sec routine with the help of simple for loops.. i think thats much better..</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t1343.html">
						<title>Re: PIC C code and Comparator Hysteresis</title>
						<link>http://www.8051projects.net/forum-t1343.html</link>
						<dc:date>2008-12-01T23:27:32-08:00</dc:date>
						<dc:creator>Luqman</dc:creator>
						<dc:subject></dc:subject>
						<description>well ajay, i would like to request u plz start PIC projects and coding PIC controllers so that we can get skills to program it easily.</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t1343.html">
						<title>Re: PIC C code and Comparator Hysteresis</title>
						<link>http://www.8051projects.net/forum-t1343.html</link>
						<dc:date>2008-12-01T23:27:32-08:00</dc:date>
						<dc:creator>Ajay</dc:creator>
						<dc:subject></dc:subject>
						<description>well Luqman, i really want to start by i don't have PIC controller with me.. and i think there is not much difference in controllers..PIC AVR 8051 everything is same.. there is no difference.. whatever you make in 8051/AVR you can do the same thing in PIC to.. the only difference is features and some registers thats all..When i get a PIC IC with me... i will start another step by step tutorial for it...   Thank you for your input...</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t1343.html">
						<title>Re: PIC C code and Comparator Hysteresis</title>
						<link>http://www.8051projects.net/forum-t1343.html</link>
						<dc:date>2008-12-01T23:27:32-08:00</dc:date>
						<dc:creator>Ajay</dc:creator>
						<dc:subject></dc:subject>
						<description>I really don't remember which code/schematic.. must be lost somewhere in 1000 mails  Please post the code and schematic here in forum..</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t1343.html">
						<title>Re: PIC C code and Comparator Hysteresis</title>
						<link>http://www.8051projects.net/forum-t1343.html</link>
						<dc:date>2008-12-01T23:27:32-08:00</dc:date>
						<dc:creator>Luqman</dc:creator>
						<dc:subject></dc:subject>
						<description>hi, ajayplz go thru the schematic and code that i've sent earlier.</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t1343.html">
						<title>Re: PIC C code and Comparator Hysteresis</title>
						<link>http://www.8051projects.net/forum-t1343.html</link>
						<dc:date>2008-12-01T23:27:32-08:00</dc:date>
						<dc:creator>buddy</dc:creator>
						<dc:subject></dc:subject>
						<description></description>
						</item>
				</rdf:RDF>