<?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:32:26-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-t10130.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t10130.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t10130.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t10130.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t10130.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t10130.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t10130.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t10130.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t10130.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t10130.html" />
				</rdf:Seq>
				</items>
				</channel>
						<item rdf:about="http://www.8051projects.net/forum-t10130.html">
						<title>Need a simple answer for a simple question</title>
						<link>http://www.8051projects.net/forum-t10130.html</link>
						<dc:date>2008-12-01T23:32:26-08:00</dc:date>
						<dc:creator></dc:creator>
						<dc:subject></dc:subject>
						<description>hi,thanks for looking...i wan to keep decrease a number till 0 in ASM mode...how i know it is already 0 or it decreased more than 0 ...how to stop it from substract more than 0 ...?same question goes to....i have a number , i wan to increase it till 255 in ASM mode too..how i know it is already 255 or it increased more than 255 ...how to stop it from adding more than 255 ...?thanks...need some suggestion...please...either it will affect the Carry in STATUS REGISTER, or...thanks...</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t10130.html">
						<title>Re: Need a simple answer for a simple question</title>
						<link>http://www.8051projects.net/forum-t10130.html</link>
						<dc:date>2008-12-01T23:32:26-08:00</dc:date>
						<dc:creator>pdi33</dc:creator>
						<dc:subject></dc:subject>
						<description>hi nic,well, if u are using 8051;if the numberwhich is stored in say register r5 is decremented,then use the following code:mov a,r5jz label1.                        ;here add the code for decrementing the variable..retlabel: .                      ;here the counter has reached zero....retthe 'jz' instuction checks if the value in accumulator is zero and jumps accordingly.For incremented variable use the JC  instruction like below (here r5 is limited to 16):mov a, r5cjne a,#10,label1.                        ;here r5 =10h.retlabel1: .                  ;here r5 not equal to 5.retNote:if the register has a value 0, then the instructionssubb r5,#01h and dec r5will set the carry flag. u can then check the carry flag using the instruction 'jc label'</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t10130.html">
						<title>Re: Need a simple answer for a simple question</title>
						<link>http://www.8051projects.net/forum-t10130.html</link>
						<dc:date>2008-12-01T23:32:26-08:00</dc:date>
						<dc:creator>shyam</dc:creator>
						<dc:subject></dc:subject>
						<description>please confirm the controller u want to use??any way PSW flags can be compared  for the above operations!</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t10130.html">
						<title>Re: Need a simple answer for a simple question</title>
						<link>http://www.8051projects.net/forum-t10130.html</link>
						<dc:date>2008-12-01T23:32:26-08:00</dc:date>
						<dc:creator>nicholastyc</dc:creator>
						<dc:subject></dc:subject>
						<description>hi i m using pic12f629 !i m so confused about this 1...can some1 explain it..thanks</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t10130.html">
						<title>Re: Need a simple answer for a simple question</title>
						<link>http://www.8051projects.net/forum-t10130.html</link>
						<dc:date>2008-12-01T23:32:26-08:00</dc:date>
						<dc:creator>Arun Kumar V</dc:creator>
						<dc:subject></dc:subject>
						<description>hello pdi33For incremented variable use the JC instruction like below (here r5 is limited to 16):mov a, r5cjne a,#10,label1. ;here r5 =10h.retlabel1:. ;here r5 not equal to 5.reti am unable to see where you are using JC instr in  the above example  nic  you have used two different terms here : Incrementing and adding, both look similar but differ in usage, you can increment in the multiples of 1 but you can add any two valuesif you are starting from say 0 and incrementing then you can know if you have reached 255 by simple CJNE A,#0FFH,xxxx  instr, but when you are adding and the result is more than 255 then you have to subb  0FFH and check the Carry flag.Arun</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t10130.html">
						<title>Re: Need a simple answer for a simple question</title>
						<link>http://www.8051projects.net/forum-t10130.html</link>
						<dc:date>2008-12-01T23:32:26-08:00</dc:date>
						<dc:creator>nicholastyc</dc:creator>
						<dc:subject></dc:subject>
						<description>H Arun, Can u please explain it in PIc languague (ASM)because i dunno about the language u used ...sorryi wan to INCF a register to 255  or DECF to 0 but i donwan them to exceed the value...thanks...but how can i check for that? ...</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t10130.html">
						<title>Re: Need a simple answer for a simple question</title>
						<link>http://www.8051projects.net/forum-t10130.html</link>
						<dc:date>2008-12-01T23:32:26-08:00</dc:date>
						<dc:creator>pdi33</dc:creator>
						<dc:subject></dc:subject>
						<description>hi arun,thanks for pointing out my errors   actually i noticed it too so i added the last statement. anyways nic needs it in PIC for which i am as newbee as him</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t10130.html">
						<title>Re: Need a simple answer for a simple question</title>
						<link>http://www.8051projects.net/forum-t10130.html</link>
						<dc:date>2008-12-01T23:32:26-08:00</dc:date>
						<dc:creator>sashijoseph</dc:creator>
						<dc:subject></dc:subject>
						<description>nicholastyc wrote ...H Arun, Can u please explain it in PIc languague (ASM)because i dunno about the language u used ...sorryi wan to INCF a register to 255  or DECF to 0 but i donwan them to exceed the value...thanks...but how can i check for that? ...You can use the instruction DECFSZ to decrement and check for zero.It has 2 parameters.. a register and a 0 or 1.The register contains the value to be deremented and the "1" puts the decremented result back in the register(a " 0 " puts the result in the W register).As long as the result is not 0,the very next instruction is executed.If the result is 0,the very next instruction is skipped and the one after that is executed.So you employ the instruction in this way... CODE:Not_Zero &nbsp;decfsz MyVal,1<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;goto Not_Zero<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;other instructions.... As long as MyVal is not zero ' goto Not_Zero' is executed,forming a loop.Once MyVal becomes 0,the goto instruction is skipped and execution starts from 'other instructions'.For incrementing to 255 you can do it this way.. CODE:Not_255 &nbsp; &nbsp;Incf MyVal,1<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Decfsz Countdown,1<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;goto Not_255<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;other instructions...   Countdown = 255 (assuming MyVa l= 0)Strange..not even a compare instruction is available for the 12fxxx.</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t10130.html">
						<title>Re: Need a simple answer for a simple question</title>
						<link>http://www.8051projects.net/forum-t10130.html</link>
						<dc:date>2008-12-01T23:32:26-08:00</dc:date>
						<dc:creator>nicholastyc</dc:creator>
						<dc:subject></dc:subject>
						<description>thanks for info...i really having problem for the encoder part...i try to use incf and decf and then btfss/btfsc STATUS,Z to check for the max 255 and min 0 !it works...but the encoder part really having big problem..its cant determine which direction correctly...Shyam can u provide me a code of encoder? thanks</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t10130.html">
						<title>Re: Need a simple answer for a simple question</title>
						<link>http://www.8051projects.net/forum-t10130.html</link>
						<dc:date>2008-12-01T23:32:26-08:00</dc:date>
						<dc:creator>shyam</dc:creator>
						<dc:subject></dc:subject>
						<description>actually u people are working on assembly...i didnt use assembly for years      so cant help on asm parts..have interfaced encoder on lpc21xx controllers  working fine but incthe procedure is the same as i explained...keep trying for a couple more days  ..  may be this weekend i'll make a code fr ya...will do it fr the 51 uC in asm..till then keep trying and have us informed.</description>
						</item>
				</rdf:RDF>