<?xml version="1.0" encoding="utf-8"?>
				<!-- generator="e107" -->
				<!-- content type="Forum / topic" -->
				<rss  version="2.0">
				<channel>
				<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>

<language>en-gb</language>
				<copyright>2008 Rickey's World</copyright>
				<managingEditor>contact@nospam.com (Ajay Bhargav)</managingEditor>
				<webMaster>contact@nospam.com (Ajay Bhargav)</webMaster>
				<pubDate>Wed, 07 Jan 2009 18:05:07 -0800</pubDate>
				<lastBuildDate>Wed, 07 Jan 2009 18:05:07 -0800</lastBuildDate>
				<docs>http://backend.userland.com/rss</docs>
				<generator>e107 (http://e107.org)</generator>
				<ttl>60</ttl>
				<textInput>
				<title>Search</title>
				<description>Search 8051 Microcontroller Projects AVR PIC Projects Tutorials Ebooks Libraries codes</description>
				<name>query</name>
				<link>http://www.8051projects.net/search.php</link>
				</textInput>
						<item>
						<title>Digital clock with relay</title>
<link>http://www.8051projects.net/forum-t8579.html</link>
<description><![CDATA[Hello Ajay,<br />        I learnt from your info page that u are from Khanna, Punjab.<br />        I am checking Port status by multi-meter. I checked by LED also. Results were very abrupt. Sometimes, P1.4 did not light LED whereas P1.5, P1.6, P1.7 lighted LED. Sometimes, none lighted. Sometimes, all lighted. Tomorrow, I will try to make an infinite loop by SJMP.<br />        I want to know another thing. Do you have code of <span style='color:#cc0000'>digital clock</span> using <span style='color:#cc0000'>DS1307</span> in <span style='color:#ff0000'>C</span> also? But, using DS1307 or any other RTC with RAM.<br /><br />Thanking you in anticipation,<br />Anupam Attri]]></description>
<pubDate>Tue, 15 Apr 2008 03:11:09 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t8579.html</guid>
</item>
						<item>
						<title>Re: Digital clock with relay</title>
<link>http://www.8051projects.net/forum-t8579.html</link>
<description><![CDATA[Hello Ajay,<br />        I tried the Digital Clock code of C [beta] on hardware. Its working great. There is no problem in display and all and its really great. thanks for this help.<br />       I read the code. Ihave few doubts. Can you help me in them:<br />Doubt 1: What is the function biuld_ram? what is the significance of 56 in FOR Loop? All Iknow is that RAM size of RTC is 56K.<br />Function:<br />void build_ram()<br />{<br />	bit_8 i;<br />	wrt_cmd(0x40);<br />	for(i=0;i&lt;56;i++)<br />		wrt_byte(cgram[i]);<br />}<br /><br />Doubt 2: How is receive_data working? What is the significance of 1d in FOR Loop?<br /><br />Doubt 3: I found another thing that the alarm is not stored in RTC RAM. It is stored in the RAM of controller. That is, if the power supply fails, then the real time will be retained but not the alarm time. It is to be set again. If it is so, then can you help me in setting the alarm timeing RTC RAM? How to write the two parameters ahour and amin in RTC RAM? And reading from RTC RAM?<br />Please reply!!<br />]]></description>
<author>contact@nospam.com (Ajay Bhargav)</author>
<pubDate>Tue, 15 Apr 2008 15:25:52 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t8579.html</guid>
</item>
						<item>
						<title>Re: Digital clock with relay</title>
<link>http://www.8051projects.net/forum-t8579.html</link>
<description><![CDATA[Hello Ajay, <img src='http://www.8051projects.net/e107_images/emotes/yahoo/1.gif' alt='' style='vertical-align:middle; border:0' />  <br />      i have made few changes in the code. This is to store alarm time in RTC RAM... Please see if these changes will storer alarm in RTC RAm and execute accordingly...<br />Initially, the RTC RAM is configured as<br />rtc_ini_val[0]	-> sec<br />rtc_ini_val[1]	-> min<br />rtc_ini_val[2]	-> hrs<br />rtc_ini_val[3]	-> day<br />rtc_ini_val[4]	-> date<br />rtc_ini_val[5]	-> month<br />rtc_ini_val[6]	-> year<br />rtc_ini_val[7]	-> control register<br />rtc_ini_val[8]	-> '~'//signature byte<br /><br />Other two RAM locations that I created<br />rtc_ini_val[9]	-> amins<br />rtc_ini_val[10] -> ahours<br /><br />For this the changes that I made:<br />1) static bit_8 rtc_recv_val[11] _at_ 0x30;<br />   static bit_8 rtc_ini_val[11];<br /><br />2) In rtc_check(void)<br />	Two more additions<br />	rtc_ini_val[9]=0x00;<br />	rtc_ini_val[10]=0x52;<br /><br />3) In recv_data()<br />	In for Loop, I changed the if statement<br />	if(y&lt;=10)	//It was y&lt;=6<br />	//y&lt;=10 to cover whole 10 locations<br />	// rest same<br /><br />4) In set_alarm()<br />   I commented, //amins=dec_hex(amins);<br />		//ahours=dec_hex(ahours);<br />   I replaced above statements with<br />   rtc_ini_val[9]=dec_hex(amins);<br />   rtc_ini_val[10]=dec_hex(ahours);<br />   if(ampm)<br />	rtc_ini_val[10]+=-x60;<br />   else<br />	rtc_ini_val[10]+=ox40;<br />   RTC_INI();<br /><br />5) In void check_alarm() //comparing values directly from RTC RAM<br />   if (rtc_ini_val[10]==rtc_recv_val[2])<br />	if (rtc_ini_val[9]==rtc_recv_val[1])<br />	{<br />	 aoff=1;<br />	 aon=1;<br />	}<br /><br />Please check these changes. I guess these are sufficient.<br />Please reply]]></description>
<author>contact@nospam.com (Ajay Bhargav)</author>
<pubDate>Tue, 15 Apr 2008 19:31:39 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t8579.html</guid>
</item>
						<item>
						<title>Re: Digital clock with relay</title>
<link>http://www.8051projects.net/forum-t8579.html</link>
<description><![CDATA[Sorry for late reply <img src='http://www.8051projects.net/e107_images/emotes/yahoo/1.gif' alt='' style='vertical-align:middle; border:0' />  Now lets discuss your doubts...<br /><div class='quote_top'>AnupamAttri wrote ...</div><div class='quote'>Doubt 1: What is the function biuld_ram? what is the significance of 56 in FOR Loop? All Iknow is that RAM size of RTC is 56K.<br />Function:<br />void build_ram()<br />{<br />bit_8 i;<br />wrt_cmd(0x40);<br />for(i=0;i<56;i++)<br />wrt_byte(cgram[ i ]);<br />}<br /></div><br />the above function is for LCD not RTC. to build special characters..<br /><div class='quote_top'>AnupamAttri wrote ...</div><div class='quote'>Doubt 2: How is receive_data working? What is the significance of 1d in FOR Loop?<br /></div><br />1d is used for synchronization.. but only first 7 bytes are being stored as you can see in that loop.<br /><br /><div class='quote_top'>AnupamAttri wrote ...</div><div class='quote'>Doubt 3: I found another thing that the alarm is not stored in RTC RAM. It is stored in the RAM of controller. That is, if the power supply fails, then the real time will be retained but not the alarm time. It is to be set again. If it is so, then can you help me in setting the alarm timeing RTC RAM? How to write the two parameters ahour and amin in RTC RAM? And reading from RTC RAM?<br /></div><br />all you need to do is write those values to RTC ram..<br />i tell you the sequence.. you can do that using the functions available in rtc.c<br />[ send start ] [ send RTC Addr + Wr ] [ send sub add  ] [ send data to write ] [ sequential data if there ] [ send stop ]<br /><br />Sub address is the address of RTC's internal ram where you want to store data.<br />sequential data is fed if you have to store more than one byte.. e.g. if you want to store 5 values.. starting from sub address 10H, then first value will go to 10H, second to 11H and so on...<br /><br />Hope you understand..]]></description>
<author>contact@nospam.com (Ajay Bhargav)</author>
<pubDate>Wed, 16 Apr 2008 05:24:00 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t8579.html</guid>
</item>
						<item>
						<title>Re: Digital clock with relay</title>
<link>http://www.8051projects.net/forum-t8579.html</link>
<description><![CDATA[regarding changes you made in the program.. <br /><br />rtc_ini_val[9] -> amins<br />rtc_ini_val[10] -> ahours<br /><br />The above are not needed.<br /><br />1) static bit_8 rtc_recv_val[11] _at_ 0x30;  // This one is fine....<br />static bit_8 rtc_ini_val[11];  // Not needed.. keep is same as original..<br /><br />addtion 2 is not needed either...<br /><br />addition 3 is fine...<br /><br />Addition 4 is wrong.. as i explained in my post earlier, you need to send those alarm values separately to RTC ram. RTC_INI function is called only for initialization of RTC.<br /><br />In addition 5, you need to compare the current time with alarm time..<br />that would be..<br />rtc_recv_val[2] with rtc_rcv_val[8]<br />and <br />rtc_recv_val[1] with rtc_recv_val[9]]]></description>
<author>contact@nospam.com (Ajay Bhargav)</author>
<pubDate>Wed, 16 Apr 2008 05:55:48 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t8579.html</guid>
</item>
						<item>
						<title>Re: Digital clock with relay</title>
<link>http://www.8051projects.net/forum-t8579.html</link>
<description><![CDATA[Hello Ajay,<br />     Thanks for the reply.<br />     I have understood the answers to doubt 1 &amp; 2. But, answer to doubt 3 ( that is to store alarm in RTC RAM) is not very clear. What I have understood is that the function RTC_INI() in the code of rtc.c is same what you have written:<br />[ send start ] [ send RTC Addr + Wr ] [ send sub add ] [ send data to write ] [ sequential data if there ] [ send stop ]<br />It is:<br />void RTC_INI(void)<br />{<br />	bit_8 t;	<br />	for(t=0;t&lt;9;t++)<br />	{<br />		start_rtc();		           //[ send start ] These comments are written by me.<br />		send_adr(0xd0);	 	    //[ send RTC Addr + Wr ]<br />		send_adr(t);		        //[ send sub add ]<br />		send_adr(rtc_ini_val[t]);//[ send data to write ]<br />		stop_rtc();		         //[ send stop ]<br />	}<br />	wrt_cmd(0x1);<br />}<br /><br />1. Calling function start_rtc();<br /><br />2. For send_adr(0xd0).<br />I don't understand how is RTC Addr + Wr is 0xd0 in send_adr(0xd0).<br /><br />3. For send_adr(t)<br />I have understood sub add as ranging from 0, 1, 2,... upto 8. total 9.<br />t=0 -> sec<br />t=1 -> min<br />t=2 -> hrs<br />t=3 -> day<br />t=4 -> date<br />t=5 -> month<br />t=6 -> year<br />t=7 -> control register<br />t=8 -> '~'//signature byte<br /><br />4. send_adr(rtc_ini_val[t])<br />Data to write are values to be fed at addresses 0x00, 0x01,... upto 0x08. That is sec, min, hrs, day... And, these updated values are stored in rtc_ini_val[t] array.<br />And, this is sequential data.<br /><br />5. Calling function stop_rtc();<br /><br />In nut-shell, I have understood that values of the alarm, that is "ahour" and "amin" are to be stored in rtc_ini_val[t] array (where, t=8 and 9 and taking 10 as '~' signature byte)<br />rtc_ini_val[8] = ahour;<br />rtc_ini_val[9] = amin;<br /><br />Please reply whether what i have understood is correct or not.<br />]]></description>
<author>contact@nospam.com (Ajay Bhargav)</author>
<pubDate>Thu, 17 Apr 2008 01:55:14 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t8579.html</guid>
</item>
						<item>
						<title>Re: Digital clock with relay</title>
<link>http://www.8051projects.net/forum-t8579.html</link>
<description><![CDATA[i said.. rtc_ini is specially written for initializing RTC..<br />its not for storing stuff.. this function is called only if needed otherwise not<br /><br />so write in simple way as mentioned.. no need to call rtc_ini]]></description>
<author>contact@nospam.com (Ajay Bhargav)</author>
<pubDate>Thu, 17 Apr 2008 05:56:21 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t8579.html</guid>
</item>
						<item>
						<title>Re: Digital clock with relay</title>
<link>http://www.8051projects.net/forum-t8579.html</link>
<description><![CDATA[Hi Ajay!<br />      I guess I have disturbed you a lot. I am sorry for that. But, pleasse understand me; I have not understood the syntax <br />"[ send start ] [ send RTC Addr + Wr ] [ send sub add ] [ send data to write ] [ sequential data if there ] [ send stop ]" completely. That is why i need some example of it to how to do it. I have tried to find one example out of your code only. I guess storing real time in RTC RAM is same as storing alarm time in RTC RAM, except that there are fixed registers of real-time and no register for alarm time. So, I set the example of how real time is set or changd. It is changed by calling the function "rtc_set()". right? <br />If I am wrong, then please explain me by some example. Please write its code.<br />If I am right till here, then I would like to highlight how this function works (as per my understanding.).<br />1.Values of min, hr, etc. are received from RTC and stroed in 8051 RAM in rtc_recv_val[t] array.<br />2.Values are processed and changed by setting temperory variables like hour, min, month, etc.<br />3.Once set, values of variables hour, min, etc are stored back into array rtc_recv_val[t].<br />4. Finally, RTC_INI() function is called. This function sets the values in the RTC RAM again.<br />Actually, initial values are set by calling the function rtc_check(). rtc_check() calls the function RTC_INI().<br />I have linked my 4 points with the function example below.<br />If you see function rtc_set().<br />                     rtc_set()<br />{<br />	mins = hex_dec(rtc_recv_val[1]);// 1.fetching data from RTC RAM<br />	// 2.Then follows the function of setting the variables or mins. I have omitted the in-between statements.<br />	rtc_ini_val[1] = dec_hex(mins);// 3.storing back the variable to array<br />	rtc_ini_val[2] = dec_hex(hours);<br />	RTC_INI();//4.Calling RTC_INI(). This again sets the RTC RAM<br />	wrt_cmd(1);//Then follws the function of LCD<br />}<br /><br />If I wrong, then please explain me by some example. I have not understood the syntax.<br />]]></description>
<author>contact@nospam.com (Ajay Bhargav)</author>
<pubDate>Thu, 17 Apr 2008 14:28:55 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t8579.html</guid>
</item>
						<item>
						<title>Re: Digital clock with relay</title>
<link>http://www.8051projects.net/forum-t8579.html</link>
<description><![CDATA[Hello Ajay,<br />      I checked the hardware. There are few bugs in the code.<br />1. In the display, it never displays PM. It always displays AM, whether it is AM or PM? I checked the code then, I found that statement<br />if(((rtc_recv_val[2])&amp;20)==20)<br />		wrt_data(pmam[1]);<br />	else<br />		wrt_data(pmam[0]);<br />is wrong. It will always jump to else because in hex 24 is 18. There is no point of 0x20. So, I wrote statement<br />if(((rtc_recv_val[2]+0x14)&amp;20)==20)<br /><br />		wrt_data(pmam[1]);<br />	else<br />		wrt_data(pmam[0]);<br />This adds 14 hex.<br />When tried this on hardware, then it displayed PM, but results were not satisfactory.<br /><br />2. Another bug is that the alarm doesn't work. Even when set, control doesn't move to alarm function. I tried this using CRO. The state of P1.4 didn't change.<br />When you implemented this on hardware, then was alarm working?<br /><br />If you find solution to above two problems, then please reply.<br />By the way, can you find some time to chat with me. please tell me when can this be possible.<br />Thank you!!!1]]></description>
<author>contact@nospam.com (Ajay Bhargav)</author>
<pubDate>Thu, 17 Apr 2008 19:18:02 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t8579.html</guid>
</item>
						<item>
						<title>Re: Digital clock with relay</title>
<link>http://www.8051projects.net/forum-t8579.html</link>
<description><![CDATA[Hello Ajay,<br />I compared your C[beta] code with assembly language code. There what you have done is ANDing hour with 20hex and then comparing it with 00hex and not 20 hex. If one writes in C, then it would be:<br />if((rtc_recv_val[2]&amp;20)==00)// This statement was: if(((rtc_recv_val[2])&amp;20)==20)<br />{<br />wrt_data(pmam[1]);<br />else<br />wrt_data(pmam[0]);<br />}<br /><br />Although I don't understand the logic of comparing with 00hex directly without any prior addition, but i checked your asm code on hardware and it was bug-free with respect to AM-PM error.<br />But, please see for alarm. Although I could not fine any bug; logic seems to be correct, but alarm didn't work.<br />Please see my previous posts for RTC RAM problem. Please explain me it as you have stored Real Time.]]></description>
<author>contact@nospam.com (Ajay Bhargav)</author>
<pubDate>Fri, 18 Apr 2008 01:47:23 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t8579.html</guid>
</item>
						<item>
						<title>Re: Digital clock with relay</title>
<link>http://www.8051projects.net/forum-t8579.html</link>
<description><![CDATA[Hello Ajay,<br />I wrote following code for the above problem:<br />if((rtc_recv_val[2]&amp;0x20)!=00)<br />{<br />wrt_data(pmam[1]);<br />else<br />wrt_data(pmam[0]);<br />}<br />with a change in:<br />if(rtc_recv_val[2]&amp;0x20!=0x00)<br />		ampm=1;//it was ampm=0;<br />	else<br />		ampm=0;//it was ampm=1;<br />It worked fine during display, but during setting the time, it was abit abrupt. AM-PM toggle every one gives intrupt for time set. But, display gives the same what is set.<br />Please reply to my above problems. I guess you are vey busy. But, please reply as soon as you are free.]]></description>
<author>contact@nospam.com (Ajay Bhargav)</author>
<pubDate>Fri, 18 Apr 2008 17:32:19 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t8579.html</guid>
</item>
						<item>
						<title>Re: Digital clock with relay</title>
<link>http://www.8051projects.net/forum-t8579.html</link>
<description><![CDATA[Please reply to my doubts!!! Currently, I am facing problem in storing the alarm time in RTC RAM. I am making hit-n-trial. But, all are unsuccessful... Please explain me by some example as I have not understood the syntax or please see the previous posts of mine. Please help me!!!]]></description>
<author>contact@nospam.com (Ajay Bhargav)</author>
<pubDate>Sat, 19 Apr 2008 06:11:25 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t8579.html</guid>
</item>
						<item>
						<title>Re: Digital clock with relay</title>
<link>http://www.8051projects.net/forum-t8579.html</link>
<description><![CDATA[Hello Ajay,<br />         I am trying to store two alarms in RTC RAM and retrieve them from it to 8051 RAM. Now, there is problem that I am facing. When I boot or give supply to controller, it doesn't show anything; just one black row at top.<br />         Last time when I faced this problem, I guessed, it was due to the memory overlapping in controller. So, I changed the address of the received data as:<br />static bit_8 rtc_recv_val_alarml[7] _at_ 0x37;<br />          This had resolved the problem. But now, I am clueless about the bug. I don't know how to resolve it. Please reply!!!]]></description>
<author>contact@nospam.com (Ajay Bhargav)</author>
<pubDate>Tue, 22 Apr 2008 03:02:02 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t8579.html</guid>
</item>
						<item>
						<title>Re: Digital clock with relay</title>
<link>http://www.8051projects.net/forum-t8579.html</link>
<description><![CDATA[this is what i was saying..<br /><br /><div class='code_box'>CODE:</div><div class='code_highlight' style='unicode-bidi: embed; direction: ltr'><div class="c" style="font-family: monospace;">start_rtc<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />send_adr<span style="color: #66cc66;">&#40;</span>0xD0<span style="color: #66cc66;">&#41;</span>;<br />send_adr<span style="color: #66cc66;">&#40;</span>0x09<span style="color: #66cc66;">&#41;</span>;<br />send_adr<span style="color: #66cc66;">&#40;</span>alarmhr<span style="color: #66cc66;">&#41;</span>;<br />send_adr<span style="color: #66cc66;">&#40;</span>alarmmin<span style="color: #66cc66;">&#41;</span>;<br />stop_rtc<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />&nbsp;</div></div><br /><br />PS: Sorry for late reply.. i was kind of busy in other work...]]></description>
<author>contact@nospam.com (Ajay Bhargav)</author>
<pubDate>Sat, 19 Apr 2008 08:02:16 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t8579.html</guid>
</item>
						<item>
						<title>Re: Digital clock with relay</title>
<link>http://www.8051projects.net/forum-t8579.html</link>
<description><![CDATA[Hello Ajay,<br />        Thanks for the reply. I implemented it. I guess correctly. But, but I can't check it unless I retrieve the values back from RTC RAM. I tried but, I could not. There are several doubts in it.<br />1. What is this synchronization byte "1d" in recv_data() For Loop? Why is it 1d or how does it work?<br />2.I tried receiving values but the display becomes very abrupt.<br />Please explain me how can I receive data from RTC RAM. I guess, when I retrieve data from RTC RAM, then that data writes on the code. There is memory overlapping. Please suggest how should I do it?]]></description>
<author>contact@nospam.com (Ajay Bhargav)</author>
<pubDate>Sat, 19 Apr 2008 19:49:36 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t8579.html</guid>
</item>
						<item>
						<title>Re: Digital clock with relay</title>
<link>http://www.8051projects.net/forum-t8579.html</link>
<description><![CDATA[Hello Ajay!<br />        I just tried by myself to retrieve data from RTC RAM and it worked. The problem was of memory mapping only. Thanks for all your help. Right now, I don't have any doubt other than how "1d" of recv_data is working. Otherwise, I have retrieved data from RTC RAM. Once again thanks fro your code and other supports.]]></description>
<author>contact@nospam.com (Ajay Bhargav)</author>
<pubDate>Sat, 19 Apr 2008 20:10:45 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t8579.html</guid>
</item>
						<item>
						<title>Re: Digital clock with relay</title>
<link>http://www.8051projects.net/forum-t8579.html</link>
<description><![CDATA[you can lower the count and see.. well at the time i designed the clock display was grabled so i changed the value, i thought i am reading rtc too fast or something.. its just a hit and trial value.. nothing specific.. you can keep the count to number of bytes to be read. see if it works for u]]></description>
<author>contact@nospam.com (Ajay Bhargav)</author>
<pubDate>Sat, 19 Apr 2008 20:52:53 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t8579.html</guid>
</item>
				</channel>
				</rss>