<?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>2009-01-07T22:16:25-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-t6482.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t6482.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t6482.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t6482.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t6482.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t6482.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t6482.html" />
				</rdf:Seq>
				</items>
				</channel>
						<item rdf:about="http://www.8051projects.net/forum-t6482.html">
						<title>binary down counter.... using PIC16F84A</title>
						<link>http://www.8051projects.net/forum-t6482.html</link>
						<dc:date>2009-01-07T22:16:25-08:00</dc:date>
						<dc:creator></dc:creator>
						<dc:subject></dc:subject>
						<description>i having problem of my work with input from portA (controls the descending count from 16 to 0) to the output portB (dispaly the binary out by turning on the led).... i want to get input state from port A( on/off), if on the down counter start from letting all 4 LED's and soon, then the program loop itself back after all Led is off (or count zero)... if the state if off ( it holds the Led's state )....here is my work program....CODE:void main&#40;&#41; &#123;<br />&nbsp; int i=0;<br />&nbsp; PORTB = 0;<br />&nbsp; TRISB = 0; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // PORTB is output<br />&nbsp; TRISA = 1; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // PORTA is input<br /><br />&nbsp; do &#123;<br />&nbsp; if &#40;PORTA != 0x01&#41;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i++;<br />&nbsp; Delay_ms&#40;1000&#41;;<br />&nbsp; switch &#40;i&#41; &#123;<br />&nbsp; case 1: PORTB = 0x0F;<br />&nbsp; case 2: PORTB = 0x0E;<br />&nbsp; case 3: PORTB = 0x0D;<br />&nbsp; case 4: PORTB = 0x0C;<br />&nbsp; case 5: PORTB = 0x0B;<br />&nbsp; case 6: PORTB = 0x0A;<br />&nbsp; case 7: PORTB = 0x09;<br />&nbsp; case 8: PORTB = 0x08;<br />&nbsp; case 9: PORTB = 0x07;<br />&nbsp; case 10: PORTB = 0x06;<br />&nbsp; case 11: PORTB = 0x05;<br />&nbsp; case 12: PORTB = 0x04;<br />&nbsp; case 13: PORTB = 0x03;<br />&nbsp; case 14: PORTB = 0x02;<br />&nbsp; case 15: PORTB = 0x01;<br />&nbsp; case 16: PORTB = 0x00;<br />&#125;<br />&nbsp; Delay_ms&#40;1000&#41;;<br />&nbsp; &#125; while &#40;1&#41;;<br />&#125;using mikroC compiler.... it display some error...how can i solve this porblem???????.....</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t6482.html">
						<title>Re: binary down counter.... using PIC16F84A</title>
						<link>http://www.8051projects.net/forum-t6482.html</link>
						<dc:date>2009-01-07T22:16:25-08:00</dc:date>
						<dc:creator>Ajay</dc:creator>
						<dc:subject></dc:subject>
						<description>may i know what error your are getting?</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t6482.html">
						<title>Re: binary down counter.... using PIC16F84A</title>
						<link>http://www.8051projects.net/forum-t6482.html</link>
						<dc:date>2009-01-07T22:16:25-08:00</dc:date>
						<dc:creator>sashijoseph</dc:creator>
						<dc:subject></dc:subject>
						<description>Well I just copy-pasted your code in MicroC and its compiling fine without errors.So start a new project,select the proper controller and default configuration.....should compile without problems.</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t6482.html">
						<title>Re: binary down counter.... using PIC16F84A</title>
						<link>http://www.8051projects.net/forum-t6482.html</link>
						<dc:date>2009-01-07T22:16:25-08:00</dc:date>
						<dc:creator>Ajay</dc:creator>
						<dc:subject></dc:subject>
						<description>you're welcome!so is it working now</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t6482.html">
						<title>Re: binary down counter.... using PIC16F84A</title>
						<link>http://www.8051projects.net/forum-t6482.html</link>
						<dc:date>2009-01-07T22:16:25-08:00</dc:date>
						<dc:creator>jimmymax2020</dc:creator>
						<dc:subject></dc:subject>
						<description>thnks... it was an error of setting the clock..... now i have finish compiling it with a new project...my problem now is that no output was generated when i start to on the portA after i put it to the ciruit board.....so i developed another program.....CODE:void main &#40;&#41;<br />&nbsp; &nbsp; &nbsp; &nbsp; &#123;<br />&nbsp; int i=0;<br />&nbsp; &nbsp; &nbsp; &nbsp; while&#40;1&#41; // loop forever //<br />&nbsp; &nbsp; &nbsp; &nbsp; &#123;<br />&nbsp; &nbsp; &nbsp; &nbsp; TRISB=0;<br />&nbsp; &nbsp; &nbsp; &nbsp; TRISA=1;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if &#40;PORTA != 0x01&#41;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i++;<br />&nbsp; if &#40;i=1&#41;<br />&nbsp; &#123;delay_ms&#40;1000&#41;;<br />&nbsp; &nbsp;PORTB = 0x0F;<br />&nbsp; &nbsp;delay_ms&#40;1000&#41;;<br />&nbsp; &#125;<br />&nbsp; if &#40;i=2&#41;<br />&nbsp; &#123;delay_ms&#40;1000&#41;;<br />&nbsp; &nbsp;PORTB = 0x0E;<br />&nbsp; &nbsp;delay_ms&#40;1000&#41;;<br />&nbsp; &#125;<br />&nbsp; if &#40;i=3&#41;<br />&nbsp; &#123;delay_ms&#40;1000&#41;;<br />&nbsp; &nbsp;PORTB = 0x0D;<br />&nbsp; &nbsp;delay_ms&#40;1000&#41;;<br />&nbsp; &#125;<br />&nbsp; if &#40;i=4&#41;<br />&nbsp; &#123;delay_ms&#40;1000&#41;;<br />&nbsp; &nbsp;PORTB = 0x0C;<br />&nbsp; &nbsp;delay_ms&#40;1000&#41;;<br />&nbsp; &#125;<br />&nbsp; if &#40;i=5&#41;<br />&nbsp; &#123;delay_ms&#40;1000&#41;;<br />&nbsp; &nbsp;PORTB = 0x0B;<br />&nbsp; &nbsp;delay_ms&#40;1000&#41;;<br />&nbsp; &#125;<br />&nbsp; if &#40;i=6&#41;<br />&nbsp; &#123;delay_ms&#40;1000&#41;;<br />&nbsp; &nbsp;PORTB = 0x0A;<br />&nbsp; &nbsp;delay_ms&#40;1000&#41;;<br />&nbsp; &#125;<br />&nbsp; if &#40;i=7&#41;<br />&nbsp; &#123;delay_ms&#40;1000&#41;;<br />&nbsp; &nbsp;PORTB = 0x09;<br />&nbsp; &nbsp;delay_ms&#40;1000&#41;;<br />&nbsp; &#125;<br />&nbsp; if &#40;i=8&#41;<br />&nbsp; &#123;delay_ms&#40;1000&#41;;<br />&nbsp; &nbsp;PORTB = 0x08;<br />&nbsp; &nbsp;delay_ms&#40;1000&#41;;<br />&nbsp; &#125;<br />&nbsp; if &#40;i=9&#41;<br />&nbsp; &#123;delay_ms&#40;1000&#41;;<br />&nbsp; &nbsp;PORTB = 0x07;<br />&nbsp; &nbsp;delay_ms&#40;1000&#41;;<br />&nbsp; &#125;<br />&nbsp; if &#40;i=10&#41;<br />&nbsp; &#123;delay_ms&#40;1000&#41;;<br />&nbsp; &nbsp;PORTB = 0x06;<br />&nbsp; &nbsp;delay_ms&#40;1000&#41;;<br />&nbsp; &#125;<br />&nbsp; if &#40;i=11&#41;<br />&nbsp; &#123;delay_ms&#40;1000&#41;;<br />&nbsp; &nbsp;PORTB = 0x05;<br />&nbsp; &nbsp;delay_ms&#40;1000&#41;;<br />&nbsp; &#125;<br />&nbsp; if &#40;i=12&#41;<br />&nbsp; &#123;delay_ms&#40;1000&#41;;<br />&nbsp; &nbsp;PORTB = 0x04;<br />&nbsp; &nbsp;delay_ms&#40;1000&#41;;<br />&nbsp; &#125;<br />&nbsp; if &#40;i=13&#41;<br />&nbsp; &#123;delay_ms&#40;1000&#41;;<br />&nbsp; &nbsp;PORTB = 0x03;<br />&nbsp; &nbsp;delay_ms&#40;1000&#41;;<br />&nbsp; &#125;<br />&nbsp; if &#40;i=14&#41;<br />&nbsp; &#123;delay_ms&#40;1000&#41;;<br />&nbsp; &nbsp;PORTB = 0x02;<br />&nbsp; &nbsp;delay_ms&#40;1000&#41;;<br />&nbsp; &#125;<br />&nbsp; if &#40;i=15&#41;<br />&nbsp; &#123;delay_ms&#40;1000&#41;;<br />&nbsp; &nbsp;PORTB = 0x01;<br />&nbsp; &nbsp;delay_ms&#40;1000&#41;;<br />&nbsp; &#125;<br />&nbsp; if &#40;i=16&#41;<br />&nbsp; &#123;delay_ms&#40;1000&#41;;<br />&nbsp; &nbsp;PORTB = 0x00;<br />&nbsp; &nbsp;delay_ms&#40;1000&#41;;<br />&nbsp; &nbsp;i=0;<br />&nbsp; &#125;<br /><br />&nbsp; &#125;<br />&#125;i have compile this without error and it thus work in counting down (binary)...when i input on(or 1)  to  portA..... but then it continues to count down.... my main objective is to control the output if i input signal to portA.... if not it holds the last state......is there a problem with my new code  ?</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t6482.html">
						<title>Re: binary down counter.... using PIC16F84A</title>
						<link>http://www.8051projects.net/forum-t6482.html</link>
						<dc:date>2009-01-07T22:16:25-08:00</dc:date>
						<dc:creator>Ajay</dc:creator>
						<dc:subject></dc:subject>
						<description>instead of writing thisCODE:if &#40;PORTA != 0x01&#41;writeCODE:if &#40;PORTA &amp; 0x01 != &nbsp;0x01&#41;move the following statements out of while(1) loop because they are to be configured only once at the starting of main program.CODE:TRISB=0;<br />TRISA=1;I really don't know why aren't you getting any kind of error or something.. coz your if statements are wrong..instead ofCODE:if &#40;i=14&#41;you have to writeCODE:if &#40;i==14&#41;for all if statements... Please make the changes and try again</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t6482.html">
						<title>Re: binary down counter.... using PIC16F84A</title>
						<link>http://www.8051projects.net/forum-t6482.html</link>
						<dc:date>2009-01-07T22:16:25-08:00</dc:date>
						<dc:creator>jimmymax2020</dc:creator>
						<dc:subject></dc:subject>
						<description>i have compiled the changes you give... i have also tested in my circuit..... i just make the code: if (PORTA &amp; 0x01 !=  0x00)to satisfy the circuitry connection........thanks....i really appreciate the help.....</description>
						</item>
				</rdf:RDF>