<?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><a rel="license" href="http://creativecommons.org/licenses/by-nc/2.5/in/" target="_blank"><img alt="Creative Commons License" width="80" height="15" style="border-width:0" src="http://i.creativecommons.org/l/by-nc/2.5/in/80x15.png" target="_blank" /></a>This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc/2.5/in/" target="_blank">Creative Commons Attribution-Noncommercial 2.5 India License</a>.<a href='http://www.8051projects.net/disclaimer.htm' target='_blank' />Rickey's World Disclaimer</a></copyright>
				<managingEditor>Ajay Bhargav - contact@nospam.com</managingEditor>
				<webMaster>contact@nospam.com</webMaster>
				<pubDate>Mon, 01 Dec 2008 23:47:23 -0800</pubDate>
				<lastBuildDate>Mon, 01 Dec 2008 23:47:23 -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>Help on ICDWarn0044:  Target has an invalid calibration memory value (0x3FFF)</title>
<link>http://www.8051projects.net/forum-t9898.html</link>
<description><![CDATA[<span style='color:#3366ff'><br />Connecting to MPLAB ICD 2<br />...Connected<br />Setting Vdd source to MPLAB ICD 2<br />Target Device PIC12F629 found, revision = Rev 0x10<br />ICDWarn0044:  Target has an invalid calibration memory value (0x3FFF).  Continue?<br />ICD0200: Operation Aborted (Warning 43).<br />MPLAB ICD 2 Ready</span> <br /><br />Having this problem when trying to program the piC12F629 !<br />Help... i successfully programmed 1 of my same pic, but later on i used another pic, when i wan to program it it pops up """"ICDWarn0044:  Target has an invalid calibration memory value (0x3FFF).  Continue?"""""<br /><br />then i put back my another pic, its still the same although i tried it with my 1st pic which was successful, its now also have this warning...<br /><br />any help is very much appreaciated.<br /><br />]]></description>
<pubDate>Wed, 04 Jun 2008 23:52:14 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t9898.html</guid>
</item>
						<item>
						<title>Re: Help on ICDWarn0044:  Target has an invalid calibration memory value (0x3FFF)</title>
<link>http://www.8051projects.net/forum-t9898.html</link>
<description><![CDATA[hi Ajay, i already have the most updated firmware. I did nothing wrong , and why when i trying to programme the chip its will pop up this warning!<br /><br />I am trying to program it for the LED dimmer i made the programme for...now wanted to test on it...but cant programme... =(]]></description>
<author>nicholastyc&lt;thamyc_2000@nospam.com&gt;</author>
<pubDate>Thu, 05 Jun 2008 21:12:40 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t9898.html</guid>
</item>
						<item>
						<title>Re: Help on ICDWarn0044:  Target has an invalid calibration memory value (0x3FFF)</title>
<link>http://www.8051projects.net/forum-t9898.html</link>
<description><![CDATA[try updating the firmware of ICD2.]]></description>
<author>Ajay&lt;contact@nospam.com&gt;</author>
<pubDate>Thu, 05 Jun 2008 16:48:47 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t9898.html</guid>
</item>
						<item>
						<title>Re: Help on ICDWarn0044:  Target has an invalid calibration memory value (0x3FFF)</title>
<link>http://www.8051projects.net/forum-t9898.html</link>
<description><![CDATA[PIC12F629 is not supported by the ICD2. Also most of the 12-bit instruction targets are not supported by ICD2. So you are getting this error. try replacing it with some other 16F IC and see if problem presist.<br />]]></description>
<author>Ajay&lt;contact@nospam.com&gt;</author>
<pubDate>Tue, 10 Jun 2008 15:29:42 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t9898.html</guid>
</item>
						<item>
						<title>Re: Help on ICDWarn0044:  Target has an invalid calibration memory value (0x3FFF)</title>
<link>http://www.8051projects.net/forum-t9898.html</link>
<description><![CDATA[i need help!!]]></description>
<author>nicholastyc&lt;thamyc_2000@nospam.com&gt;</author>
<pubDate>Mon, 09 Jun 2008 17:38:56 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t9898.html</guid>
</item>
						<item>
						<title>Re: Help on ICDWarn0044:  Target has an invalid calibration memory value (0x3FFF)</title>
<link>http://www.8051projects.net/forum-t9898.html</link>
<description><![CDATA[i will try to update you for the result later..if i got time! thanks]]></description>
<author>nicholastyc&lt;thamyc_2000@nospam.com&gt;</author>
<pubDate>Tue, 10 Jun 2008 17:13:47 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t9898.html</guid>
</item>
						<item>
						<title>Re: Help on ICDWarn0044:  Target has an invalid calibration memory value (0x3FFF)</title>
<link>http://www.8051projects.net/forum-t9898.html</link>
<description><![CDATA[hi Ajay, i programmed my pic12f629 with pickit2 , but the programme doesnot work at all...i tried to make a simple blinking program..it still doesnot work...<br />i will post the normal turn on led program, i simulated it in mplab sim, it does work to turn on the output!]]></description>
<author>nicholastyc&lt;thamyc_2000@nospam.com&gt;</author>
<pubDate>Wed, 11 Jun 2008 21:04:53 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t9898.html</guid>
</item>
						<item>
						<title>Re: Help on ICDWarn0044:  Target has an invalid calibration memory value (0x3FFF)</title>
<link>http://www.8051projects.net/forum-t9898.html</link>
<description><![CDATA[<div class='code_asm'>CODE:</div><div class='code_highlight' style='unicode-bidi: embed; direction: ltr'><div class="asm" style="font-family: monospace;"><br />ERRORLEVEL <span style="color: #ff0000;">-302</span> <span style="color: #adadad; font-style: italic;">;remove message about using proper bank</span><br /><br />#include &lt;p12f629.inc&gt;<br />__CONFIG &nbsp; &nbsp;_MCLRE_OFF &amp<span style="color: #adadad; font-style: italic;">; _CP_OFF &amp; _WDT_OFF &amp; _INTRC_OSC_NOCLKOUT &nbsp;</span><br /><br /><br />START<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">ORG</span>&nbsp; &nbsp; &nbsp;0x000<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">nop</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">nop</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">nop</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">nop</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">nop</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">nop</span><br />&nbsp; &nbsp; &nbsp; &nbsp; BCF&nbsp; &nbsp; &nbsp;STATUS,RP0<span style="color: #adadad; font-style: italic;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; CLRF&nbsp; &nbsp; GPIO<span style="color: #adadad; font-style: italic;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; MOVLW&nbsp; &nbsp;0x07&nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; MOVWF&nbsp; &nbsp;CMCON&nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">;&nbsp; &nbsp; &nbsp; &nbsp;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">BSF</span>&nbsp; &nbsp; &nbsp;STATUS,RP0&nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; movlw &nbsp; &nbsp; <span style="color: #46aa03; font-weight:bold;">b</span><span style="color: #7f007f;">'10000110'</span>&nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; movwf &nbsp; &nbsp; OPTION_REG&nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">CALL</span>&nbsp; &nbsp; 0x3FF<span style="color: #adadad; font-style: italic;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; MOVWF&nbsp; &nbsp;<span style="color: #46aa03; font-weight:bold;">OSCCAL</span><span style="color: #adadad; font-style: italic;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; MOVLW 0x08<span style="color: #adadad; font-style: italic;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; MOVWF TRISIO<span style="color: #adadad; font-style: italic;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; BCF&nbsp; &nbsp; &nbsp;STATUS,RP0<span style="color: #adadad; font-style: italic;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; BCF&nbsp; &nbsp; &nbsp;STATUS,<span style="color: #0000ff;">C</span><span style="color: #adadad; font-style: italic;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; MOVLW&nbsp; &nbsp;0x08<span style="color: #adadad; font-style: italic;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; MOVWF&nbsp; &nbsp;GPIO<span style="color: #adadad; font-style: italic;">;</span><br /><span style="color: #00007f; font-weight:bold;">LOOP</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">bsf</span> GPIO,<span style="color: #ff0000;">0</span><br />&nbsp; &nbsp; &nbsp; &nbsp; bcf GPIO,<span style="color: #ff0000;">1</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">bsf</span> GPIO,<span style="color: #ff0000;">2</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">goto</span> <span style="color: #00007f; font-weight:bold;">LOOP</span><br /><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">org</span>&nbsp; &nbsp; &nbsp;0x3ff<br />&nbsp; &nbsp; &nbsp; &nbsp; movlw&nbsp; &nbsp;0x20<br /><br /><span style="color: #0000ff;">end</span><br /><br />&nbsp;</div></div><br /><br />there is no ; between _MCLRE_OFF &amp; _CP_OFF  in my code...why when i attach, it appears...]]></description>
<author>nicholastyc&lt;thamyc_2000@nospam.com&gt;</author>
<pubDate>Wed, 11 Jun 2008 21:06:57 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t9898.html</guid>
</item>
						<item>
						<title>Re: Help on ICDWarn0044:  Target has an invalid calibration memory value (0x3FFF)</title>
<link>http://www.8051projects.net/forum-t9898.html</link>
<description><![CDATA[<div class='code_asm'>CODE:</div><div class='code_highlight' style='unicode-bidi: embed; direction: ltr'><div class="asm" style="font-family: monospace;"><span style="color: #adadad; font-style: italic;">;********************************************</span><br /><span style="color: #adadad; font-style: italic;">;***Title:Led Light Dimmer VERSION 2*********</span><br /><span style="color: #adadad; font-style: italic;">;*Author:YC THAM*****************************</span><br /><span style="color: #adadad; font-style: italic;">;**Date:12/6/2008****************************</span><br /><span style="color: #adadad; font-style: italic;">;********************************************</span><br /><br />&nbsp; &nbsp; &nbsp; &nbsp; ERRORLEVEL <span style="color: #ff0000;">-302</span> <span style="color: #adadad; font-style: italic;">;remove message about using proper bank</span><br /><br />&nbsp; &nbsp; &nbsp; &nbsp; #include &lt;p12f629.inc&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;__CONFIG &nbsp; &nbsp; &nbsp; _CP_OFF &amp<span style="color: #adadad; font-style: italic;">; _MCLRE_OFF &amp; _WDT_OFF &amp; _INTRC_OSC_NOCLKOUT &amp; _BODEN_OFF &amp; _CPD_OFF &amp;_PWRTE_OFF</span><br /><br />ORIGINAL_PWM&nbsp; &nbsp; <span style="color: #0000ff;">EQU</span>&nbsp; &nbsp; &nbsp;H<span style="color: #7f007f;">'0020'</span><br />COUNT50&nbsp;<span style="color: #0000ff;">EQU</span>&nbsp; &nbsp; &nbsp;H<span style="color: #7f007f;">'0021'</span><br />TEMP&nbsp; &nbsp; <span style="color: #0000ff;">EQU</span>&nbsp; &nbsp; &nbsp;H<span style="color: #7f007f;">'0022'</span><br />A11&nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">EQU</span>&nbsp; &nbsp; &nbsp;H<span style="color: #7f007f;">'0023'</span><br />A21&nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">EQU</span>&nbsp; &nbsp; &nbsp;H<span style="color: #7f007f;">'0024'</span><br />GPIO <span style="color: #0000ff;">EQU</span> H<span style="color: #7f007f;">'0005'</span><br />TRISIO&nbsp; <span style="color: #0000ff;">EQU</span>&nbsp; &nbsp; &nbsp;H<span style="color: #7f007f;">'0085'</span><br /><br /><span style="color: #adadad; font-style: italic;">;******MAIN********</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">ORG</span>&nbsp; &nbsp; &nbsp;0x000<br />&nbsp; &nbsp; &nbsp; &nbsp; BCF&nbsp; &nbsp; &nbsp;STATUS,RP0<span style="color: #adadad; font-style: italic;">; bank 0</span><br />&nbsp; &nbsp; &nbsp; &nbsp; CLRF&nbsp; &nbsp; GPIO<span style="color: #adadad; font-style: italic;">;&nbsp; &nbsp;clear gpio</span><br />&nbsp; &nbsp; &nbsp; &nbsp; MOVLW&nbsp; &nbsp;<span style="color: #ff0000;">07h</span>&nbsp; &nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">;&nbsp; &nbsp; &nbsp; &nbsp;set to digital I/O</span><br />&nbsp; &nbsp; &nbsp; &nbsp; MOVWF&nbsp; &nbsp;CMCON&nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">;&nbsp; &nbsp; &nbsp; &nbsp;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">BSF</span>&nbsp; &nbsp; &nbsp;STATUS,RP0&nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;&nbsp; &nbsp; &nbsp; &nbsp;bank 1</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">CALL</span>&nbsp; &nbsp; 3FFh<span style="color: #adadad; font-style: italic;">;&nbsp; &nbsp;calibrate the internal oscillator</span><br />&nbsp; &nbsp; &nbsp; &nbsp; MOVWF&nbsp; &nbsp;<span style="color: #46aa03; font-weight:bold;">OSCCAL</span><span style="color: #adadad; font-style: italic;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; MOVLW H<span style="color: #7f007f;">'0038'</span><span style="color: #adadad; font-style: italic;">;&nbsp; set the gp3,4,5 as input, gp0,1,2 as output</span><br />&nbsp; &nbsp; &nbsp; &nbsp; MOVWF TRISIO<span style="color: #adadad; font-style: italic;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; BCF&nbsp; &nbsp; &nbsp;STATUS,<span style="color: #ff0000;">5</span><span style="color: #adadad; font-style: italic;">;bank 0</span><br />&nbsp; &nbsp; &nbsp; &nbsp; BCF&nbsp; &nbsp; &nbsp;STATUS,<span style="color: #0000ff;">C</span><span style="color: #adadad; font-style: italic;">;clear carry flag</span><br />START<br />&nbsp; &nbsp; &nbsp; &nbsp; BTFSS&nbsp; &nbsp;GPIO,<span style="color: #ff0000;">3</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">; wait for On/OFF switch input</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; START<span style="color: #adadad; font-style: italic;">;&nbsp; loop for input</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">CALL</span>&nbsp; &nbsp; PREVIOUS&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;restore previous saved PWM</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; INITIAL_PWM&nbsp; &nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">;go to pwm output loop</span><br /><br />INITIAL_PWM<br />&nbsp; &nbsp; &nbsp; &nbsp; MOVLW&nbsp; &nbsp;0x38&nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">; set 0x38input</span><br />&nbsp; &nbsp; &nbsp; &nbsp; MOVWF&nbsp; &nbsp;GPIO&nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;</span><br />RESTART_PWM<br />&nbsp; &nbsp; &nbsp; &nbsp; MOVF&nbsp; &nbsp; ORIGINAL_PWM,w&nbsp; <span style="color: #adadad; font-style: italic;">; move original_pwm register data to w</span><br />&nbsp; &nbsp; &nbsp; &nbsp; MOVWF&nbsp; &nbsp;TEMP&nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;move w to temp register</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">BSF</span>&nbsp; &nbsp; &nbsp;GPIO,<span style="color: #ff0000;">0</span>&nbsp; <span style="color: #adadad; font-style: italic;">;turn on output gp0, cool white, HI</span><br />&nbsp; &nbsp; &nbsp; &nbsp; BTFSS&nbsp; &nbsp;GPIO,<span style="color: #ff0000;">1</span>&nbsp; <span style="color: #adadad; font-style: italic;">;check for gp1 condition</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">CALL</span>&nbsp; &nbsp; DELAY&nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">;delay phase shift</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">BSF</span>&nbsp; &nbsp; &nbsp;GPIO,<span style="color: #ff0000;">1</span>&nbsp; <span style="color: #adadad; font-style: italic;">;turn on output gp1, warm white, HI</span><br />&nbsp; &nbsp; &nbsp; &nbsp; BTFSS&nbsp; &nbsp;GPIO,<span style="color: #ff0000;">2</span>&nbsp; <span style="color: #adadad; font-style: italic;">;chec for gp2 condition</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">CALL</span>&nbsp; &nbsp; DELAY&nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">;delay phase shift</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">BSF</span>&nbsp; &nbsp; &nbsp;GPIO,<span style="color: #ff0000;">2</span>&nbsp; <span style="color: #adadad; font-style: italic;">;turn on output gp2, amber, HI</span><br />&nbsp; &nbsp; &nbsp; &nbsp; MOVLW&nbsp; &nbsp;d<span style="color: #7f007f;">'255'</span><span style="color: #adadad; font-style: italic;">;test on the pwm condition</span><br />&nbsp; &nbsp; &nbsp; &nbsp; ADDWF&nbsp; &nbsp;ORIGINAL_PWM,<span style="color: #ff0000;">0</span><span style="color: #adadad; font-style: italic;">;prevent loop on 0 pwm</span><br />&nbsp; &nbsp; &nbsp; &nbsp; BTFSS&nbsp; &nbsp;STATUS,<span style="color: #0000ff;">C</span><span style="color: #adadad; font-style: italic;">;if pwm cycle &gt;0 , loop for the cycles time</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; LOOP1<span style="color: #adadad; font-style: italic;">;skip cycle count loop</span><br />&nbsp; &nbsp; &nbsp; &nbsp; BCF&nbsp; &nbsp; &nbsp;STATUS,<span style="color: #0000ff;">C</span><span style="color: #adadad; font-style: italic;">; clear carry flag</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; LOOP0<span style="color: #adadad; font-style: italic;">;goto cycle count loop</span><br />LOOP0&nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; DECFSZ&nbsp; TEMP,<span style="color: #ff0000;">1</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;cycle count HI loop</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; LOOP0&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;</span><br />LOOP1&nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; MOVLW&nbsp; &nbsp;d<span style="color: #7f007f;">'255'</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;total possible cycles, 255</span><br />&nbsp; &nbsp; &nbsp; &nbsp; MOVWF&nbsp; &nbsp;TEMP&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;move to temp register for counter loop</span><br />&nbsp; &nbsp; &nbsp; &nbsp; MOVF&nbsp; &nbsp; ORIGINAL_PWM,w&nbsp; <span style="color: #adadad; font-style: italic;">;move original pwm to w for sub</span><br />&nbsp; &nbsp; &nbsp; &nbsp; SUBWF&nbsp; &nbsp;TEMP,<span style="color: #ff0000;">1</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;sub temp with original pwm</span><br />&nbsp; &nbsp; &nbsp; &nbsp; BCF&nbsp; &nbsp; &nbsp;GPIO,<span style="color: #ff0000;">0</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;turn gp0 to low</span><br />&nbsp; &nbsp; &nbsp; &nbsp; BTFSC&nbsp; &nbsp;GPIO,<span style="color: #ff0000;">1</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;check for gp1 condition</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">CALL</span>&nbsp; &nbsp; DELAY&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;delay phase shift</span><br />&nbsp; &nbsp; &nbsp; &nbsp; BCF&nbsp; &nbsp; &nbsp;GPIO,<span style="color: #ff0000;">1</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;turn gp1 to low</span><br />&nbsp; &nbsp; &nbsp; &nbsp; BTFSC&nbsp; &nbsp;GPIO,<span style="color: #ff0000;">2</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;check for gp2 condition</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">CALL</span>&nbsp; &nbsp; DELAY&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;delay phase shift</span><br />&nbsp; &nbsp; &nbsp; &nbsp; BCF&nbsp; &nbsp; &nbsp;GPIO,<span style="color: #ff0000;">2</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;turn gp2 to low</span><br />&nbsp; &nbsp; &nbsp; &nbsp; BCF&nbsp; &nbsp; &nbsp;STATUS,<span style="color: #0000ff;">C</span>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;clear carry flag</span><br />&nbsp; &nbsp; &nbsp; &nbsp; MOVLW&nbsp; &nbsp;d<span style="color: #7f007f;">'255'</span><span style="color: #adadad; font-style: italic;">;test on pwm condition</span><br />&nbsp; &nbsp; &nbsp; &nbsp; ADDWF&nbsp; &nbsp;TEMP,<span style="color: #ff0000;">0</span><span style="color: #adadad; font-style: italic;">;prevent loop on 0 pwm</span><br />&nbsp; &nbsp; &nbsp; &nbsp; BTFSS STATUS,<span style="color: #0000ff;">C</span><span style="color: #adadad; font-style: italic;">;if pwm cycle &gt;0 loop for cycles time</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span> LOOP3<span style="color: #adadad; font-style: italic;">;skip loop</span><br />LOOP2&nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; DECFSZ&nbsp; TEMP,<span style="color: #ff0000;">1</span>&nbsp; <span style="color: #adadad; font-style: italic;">;loop for cycle count</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; LOOP2&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;</span><br />LOOP3<br />&nbsp; &nbsp; &nbsp; &nbsp; BTFSS&nbsp; &nbsp;GPIO,<span style="color: #ff0000;">3</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;check on switch on/off</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; START&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;back to start if off, continue if on</span><br />&nbsp; &nbsp; &nbsp; &nbsp; BTFSC&nbsp; &nbsp;GPIO,<span style="color: #ff0000;">4</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;check for the new pwm cycle changes</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">CALL</span>&nbsp; &nbsp; SHAFT_0&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;increase/decrease on pwm cycle</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; RESTART_PWM&nbsp; &nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">;continue loop for the current condition</span><br /><br /><span style="color: #adadad; font-style: italic;">;*********************************************</span><br /><span style="color: #adadad; font-style: italic;">;** SUB-ROUTINE*******************************</span><br /><span style="color: #adadad; font-style: italic;">;*********************************************</span><br /><br />PREVIOUS:<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">BSF</span>&nbsp; &nbsp; &nbsp;STATUS,<span style="color: #ff0000;">5</span>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">; bank1</span><br />&nbsp; &nbsp; &nbsp; &nbsp; MOVLW&nbsp; &nbsp;0x10<span style="color: #adadad; font-style: italic;">;eeprom address for saving data</span><br />&nbsp; &nbsp; &nbsp; &nbsp; MOVWF&nbsp; &nbsp;EEADR<span style="color: #adadad; font-style: italic;">;go to address above 0x10</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">BSF</span>&nbsp; &nbsp; &nbsp;EECON1,RD&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">;read data in address</span><br />&nbsp; &nbsp; &nbsp; &nbsp; MOVF&nbsp; &nbsp; EEDATA,w&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;recall data to w register</span><br />&nbsp; &nbsp; &nbsp; &nbsp; BCF&nbsp; &nbsp; &nbsp;STATUS,<span style="color: #ff0000;">5</span><span style="color: #adadad; font-style: italic;">;bank0</span><br />&nbsp; &nbsp; &nbsp; &nbsp; MOVWF&nbsp; &nbsp;ORIGINAL_PWM<span style="color: #adadad; font-style: italic;">;save to original_pwm register</span><br />&nbsp; &nbsp; &nbsp; &nbsp; RETURN<br /><br /><span style="color: #adadad; font-style: italic;">;****************************************</span><br /><span style="color: #adadad; font-style: italic;">;**SAVE PWM IN EEPROM********************</span><br /><span style="color: #adadad; font-style: italic;">;****************************************</span><br /><br />SAVE_PWM:<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">BSF</span>&nbsp; &nbsp; &nbsp;STATUS,<span style="color: #ff0000;">5</span><span style="color: #adadad; font-style: italic;">; bank 1</span><br />&nbsp; &nbsp; &nbsp; &nbsp; MOVLW&nbsp; &nbsp;0x10<span style="color: #adadad; font-style: italic;">;address to save data</span><br />&nbsp; &nbsp; &nbsp; &nbsp; MOVWF&nbsp; &nbsp;EEADR<span style="color: #adadad; font-style: italic;">;go to addr 0x10</span><br />&nbsp; &nbsp; &nbsp; &nbsp; MOVF&nbsp; &nbsp; ORIGINAL_PWM,w&nbsp; <span style="color: #adadad; font-style: italic;">;move data on original_pwm to w</span><br />&nbsp; &nbsp; &nbsp; &nbsp; MOVWF&nbsp; &nbsp;EEDATA<span style="color: #adadad; font-style: italic;">;send the data to eeprom</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">BSF</span>&nbsp; &nbsp; &nbsp;EECON1,WREN&nbsp; &nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">;write enable</span><br />&nbsp; &nbsp; &nbsp; &nbsp; BCF&nbsp; &nbsp; &nbsp;INTCON,GIE&nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;clear interrupt</span><br />&nbsp; &nbsp; &nbsp; &nbsp; MOVLW&nbsp; &nbsp;H<span style="color: #7f007f;">'0055'</span>&nbsp;<span style="color: #adadad; font-style: italic;">;&lt;eeprom write sequence</span><br />&nbsp; &nbsp; &nbsp; &nbsp; MOVWF&nbsp; &nbsp;EECON2&nbsp; <span style="color: #adadad; font-style: italic;">;&lt;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; MOVLW&nbsp; &nbsp;H<span style="color: #7f007f;">'00AA'</span> <span style="color: #adadad; font-style: italic;">;&lt;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; MOVWF&nbsp; &nbsp;EECON2&nbsp; <span style="color: #adadad; font-style: italic;">;&lt;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">BSF</span>&nbsp; &nbsp; &nbsp;EECON1,WR&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">;write in progress</span><br />LOOP_WR<br />&nbsp; &nbsp; &nbsp; &nbsp; BTFSC&nbsp; &nbsp;EECON1,WR<span style="color: #adadad; font-style: italic;">; test for write process complete&gt;?</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; LOOP_WR<span style="color: #adadad; font-style: italic;">;if not complete loop till complete to ensure write successfully</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">BSF</span>&nbsp; &nbsp; &nbsp;INTCON,GIE&nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;enable interrupt</span><br />&nbsp; &nbsp; &nbsp; &nbsp; BCF&nbsp; &nbsp; &nbsp;EECON1, WREN<span style="color: #adadad; font-style: italic;">;disable write</span><br />&nbsp; &nbsp; &nbsp; &nbsp; BCF&nbsp; &nbsp; &nbsp;STATUS,<span style="color: #ff0000;">5</span><span style="color: #adadad; font-style: italic;">;bank 0</span><br />&nbsp; &nbsp; &nbsp; &nbsp; RETURN<br /><br /><span style="color: #adadad; font-style: italic;">;***************************************************</span><br /><span style="color: #adadad; font-style: italic;">;****DELAY******************************************</span><br /><span style="color: #adadad; font-style: italic;">;***************************************************</span><br />DELAY:<br />&nbsp; &nbsp; &nbsp; &nbsp; MOVLW&nbsp; &nbsp;d<span style="color: #7f007f;">'50'</span><span style="color: #adadad; font-style: italic;">; number of phase shifting loop</span><br />&nbsp; &nbsp; &nbsp; &nbsp; MOVWF&nbsp; &nbsp;COUNT50<span style="color: #adadad; font-style: italic;">;</span><br />COUNT<br />&nbsp; &nbsp; &nbsp; &nbsp; DECFSZ&nbsp; COUNT50,<span style="color: #ff0000;">1</span><span style="color: #adadad; font-style: italic;">; loop for 50 cycles</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; COUNT<span style="color: #adadad; font-style: italic;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; RETURN<br /><span style="color: #adadad; font-style: italic;">;**********************************************</span><br /><span style="color: #adadad; font-style: italic;">;**DIRECTION***********************************</span><br /><span style="color: #adadad; font-style: italic;">;**********************************************</span><br /><br />SHAFT_0:<br />&nbsp; &nbsp; &nbsp; &nbsp; CLRF&nbsp; &nbsp; A11&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;clear A11 register</span><br />&nbsp; &nbsp; &nbsp; &nbsp; CLRF&nbsp; &nbsp; A21&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;clear A21 register</span><br />&nbsp; &nbsp; &nbsp; &nbsp; BCF&nbsp; &nbsp; &nbsp;STATUS,<span style="color: #0000ff;">C</span><span style="color: #adadad; font-style: italic;">;clear carry flag</span><br />&nbsp; &nbsp; &nbsp; &nbsp; BTFSC&nbsp; &nbsp;GPIO,<span style="color: #ff0000;">4</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;check on gp4</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; SAVEBIT_A11&nbsp; &nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">;goto gp4=1 1st bit</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; SAVEBIT_A10&nbsp; &nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">;goto gp4=0</span><br />SHAFT_1<br />&nbsp; &nbsp; &nbsp; &nbsp; BTFSC&nbsp; &nbsp;GPIO,<span style="color: #ff0000;">5</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;check on gp5</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; SAVEBIT_B11&nbsp; &nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">;goto gp5=1 2nd bit</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; SAVEBIT_B10&nbsp; &nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">;goto gp5=0</span><br />SHAFT_2<br />&nbsp; &nbsp; &nbsp; &nbsp; BTFSC&nbsp; &nbsp;GPIO,<span style="color: #ff0000;">4</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;check on gp4</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; SAVEBIT_A21&nbsp; &nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">;goto gp4=1 3rd bit</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; SAVEBIT_A20&nbsp; &nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">;goto gp4=0 </span><br />SHAFT_3<br />&nbsp; &nbsp; &nbsp; &nbsp; BTFSC&nbsp; &nbsp;GPIO,<span style="color: #ff0000;">5</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;check on gp5</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; SAVEBIT_B21&nbsp; &nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">;goto gp5=1 4th bit</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; SAVEBIT_B20&nbsp; &nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">;goto gp5=0</span><br />SAVEBIT_A11<br />&nbsp; &nbsp; &nbsp; &nbsp; MOVLW&nbsp; &nbsp;<span style="color: #46aa03; font-weight:bold;">b</span><span style="color: #7f007f;">'00000001'</span>&nbsp; &nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">;gp4=1 1st bit =1</span><br />&nbsp; &nbsp; &nbsp; &nbsp; MOVWF&nbsp; &nbsp;A11&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;move to register A11</span><br />&nbsp; &nbsp; &nbsp; &nbsp; RLF&nbsp; &nbsp; &nbsp;A11,<span style="color: #ff0000;">1</span>&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;rotate left to make 4bit table check up!</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; SHAFT_1&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;back to 2nd bit check</span><br />SAVEBIT_A10<br />&nbsp; &nbsp; &nbsp; &nbsp; MOVLW&nbsp; &nbsp;<span style="color: #46aa03; font-weight:bold;">b</span><span style="color: #7f007f;">'00000000'</span>&nbsp; &nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">;gp4=0 1st bit =0</span><br />&nbsp; &nbsp; &nbsp; &nbsp; MOVWF&nbsp; &nbsp;A11&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;move to register A11</span><br />&nbsp; &nbsp; &nbsp; &nbsp; RLF&nbsp; &nbsp; &nbsp;A11,<span style="color: #ff0000;">1</span>&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;rotate left to make 4bit table check up</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; SHAFT_1&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;back to 2nd bit check</span><br />SAVEBIT_B11<br />&nbsp; &nbsp; &nbsp; &nbsp; MOVLW&nbsp; &nbsp;<span style="color: #46aa03; font-weight:bold;">b</span><span style="color: #7f007f;">'00000001'</span>&nbsp; &nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">;gp5=1 2nd bit =1</span><br />&nbsp; &nbsp; &nbsp; &nbsp; IORWF&nbsp; &nbsp;A11,<span style="color: #ff0000;">1</span>&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;inclusive or on A11 1st bit , result &lt;00000011&gt;/&lt;00000001&gt;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; RLF&nbsp; &nbsp; &nbsp;A11,<span style="color: #ff0000;">1</span>&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;rotate left to make 4 bit table check up</span><br />&nbsp; &nbsp; &nbsp; &nbsp; RLF A11,<span style="color: #ff0000;">1</span>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;rotate again to become 4bit</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; SHAFT_2&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;back to 3rd bit check</span><br />SAVEBIT_B10<br />&nbsp; &nbsp; &nbsp; &nbsp; MOVLW&nbsp; &nbsp;<span style="color: #46aa03; font-weight:bold;">b</span><span style="color: #7f007f;">'00000000'</span>&nbsp; &nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">;gp5=0 2rd bit =0</span><br />&nbsp; &nbsp; &nbsp; &nbsp; IORWF&nbsp; &nbsp;A11,<span style="color: #ff0000;">1</span>&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;inclusive or on A11 1stbit &nbsp;result &lt;00000000&gt;/&lt;00000010&gt;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; RLF&nbsp; &nbsp; &nbsp;A11,<span style="color: #ff0000;">1</span>&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;rotate left to make 4 bit table check</span><br />&nbsp; &nbsp; &nbsp; &nbsp; RLF A11,<span style="color: #ff0000;">1</span>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;rotate again to become 4bit</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; SHAFT_2&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;back to 3rd bit check</span><br />SAVEBIT_A21<br />&nbsp; &nbsp; &nbsp; &nbsp; MOVLW&nbsp; &nbsp;<span style="color: #46aa03; font-weight:bold;">b</span><span style="color: #7f007f;">'00000001'</span>&nbsp; &nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">;gp4=1 3rd bit =1</span><br />&nbsp; &nbsp; &nbsp; &nbsp; MOVWF&nbsp; &nbsp;A21&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;move to register A21</span><br />&nbsp; &nbsp; &nbsp; &nbsp; RLF&nbsp; &nbsp; &nbsp;A21,<span style="color: #ff0000;">1</span>&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;rotate left to make 4bit table check up</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; SHAFT_3&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;back to 4th bit check</span><br />SAVEBIT_A20<br />&nbsp; &nbsp; &nbsp; &nbsp; MOVLW&nbsp; &nbsp;<span style="color: #46aa03; font-weight:bold;">b</span><span style="color: #7f007f;">'00000000'</span>&nbsp; &nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">;gp4=0 3rd bit =0</span><br />&nbsp; &nbsp; &nbsp; &nbsp; MOVWF&nbsp; &nbsp;A21&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;move to register A21</span><br />&nbsp; &nbsp; &nbsp; &nbsp; RLF&nbsp; &nbsp; &nbsp;A21,<span style="color: #ff0000;">1</span>&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;rotate left again</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; SHAFT_3&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;back to 4th bit check</span><br />SAVEBIT_B21<br />&nbsp; &nbsp; &nbsp; &nbsp; MOVLW&nbsp; &nbsp;<span style="color: #46aa03; font-weight:bold;">b</span><span style="color: #7f007f;">'00000001'</span>&nbsp; &nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">;gp5=1 4th bit = 1</span><br />&nbsp; &nbsp; &nbsp; &nbsp; IORWF&nbsp; &nbsp;A21,<span style="color: #ff0000;">0</span>&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;inclusive or A21 3rd bit</span><br />&nbsp; &nbsp; &nbsp; &nbsp; IORWF&nbsp; &nbsp;A11,<span style="color: #ff0000;">0</span>&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;inclusive or with A11 to make up 4th bit</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; DIRECTION&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">; check on direction</span><br />SAVEBIT_B20<br />&nbsp; &nbsp; &nbsp; &nbsp; MOVLW&nbsp; &nbsp;<span style="color: #46aa03; font-weight:bold;">b</span><span style="color: #7f007f;">'00000000'</span>&nbsp; &nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">; gp5=1 4th bit =1</span><br />&nbsp; &nbsp; &nbsp; &nbsp; IORWF&nbsp; &nbsp;A21,<span style="color: #ff0000;">0</span>&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;inclusive or A21 3rd bit</span><br />&nbsp; &nbsp; &nbsp; &nbsp; IORWF&nbsp; &nbsp;A11,<span style="color: #ff0000;">0</span>&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;IOR with A11 to make up 4th bit</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; DIRECTION&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">;check for direction</span><br />DIRECTION<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">CALL</span>&nbsp; &nbsp; TABLE_1&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;direction look up table </span><br />ANTI_CLOCKWISE<br />&nbsp; &nbsp; &nbsp; &nbsp; DECF&nbsp; &nbsp; ORIGINAL_PWM,f&nbsp; <span style="color: #adadad; font-style: italic;">; anti-clockwise means decrease on pwm cycle</span><br />&nbsp; &nbsp; &nbsp; &nbsp; MOVLW&nbsp; &nbsp;d<span style="color: #7f007f;">'255'</span><span style="color: #adadad; font-style: italic;">; to prevent decrease more than 0 cycle condition, turn to 255 cycle</span><br />&nbsp; &nbsp; &nbsp; &nbsp; SUBWF&nbsp; &nbsp;ORIGINAL_PWM,<span style="color: #ff0000;">0</span><span style="color: #adadad; font-style: italic;">; sub original_pwm</span><br />&nbsp; &nbsp; &nbsp; &nbsp; BTFSC&nbsp; &nbsp;STATUS,<span style="color: #0000ff;">C</span><span style="color: #adadad; font-style: italic;">; check on carry flag if cycle &gt;0 , carry appears</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; RELOADZERO<span style="color: #adadad; font-style: italic;">; if it is 0, reload zero to original_pwm register</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; NORMAL<span style="color: #adadad; font-style: italic;">;if not, continue to save</span><br />RELOADZERO<br />&nbsp; &nbsp; &nbsp; &nbsp; MOVLW&nbsp; &nbsp;d<span style="color: #7f007f;">'0'</span><span style="color: #adadad; font-style: italic;">; load 0 to pwm due to over decrease happened</span><br />&nbsp; &nbsp; &nbsp; &nbsp; MOVWF&nbsp; &nbsp;ORIGINAL_PWM<span style="color: #adadad; font-style: italic;">; move to register</span><br />&nbsp; &nbsp; &nbsp; &nbsp; BCF&nbsp; &nbsp; &nbsp;STATUS,<span style="color: #0000ff;">C</span><span style="color: #adadad; font-style: italic;">;clear carry flag</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; NORMAL<span style="color: #adadad; font-style: italic;">;continue to save pwm</span><br />NORMAL<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">CALL</span>&nbsp; &nbsp; SAVE_PWM&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">; call save pwm routine to save pwm data for recall on start up</span><br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; RESTART_PWM&nbsp; &nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">;return from save and continue to generate pwm signal</span><br />CLOCKWISE<br />&nbsp; &nbsp; &nbsp; &nbsp; MOVLW&nbsp; &nbsp;d<span style="color: #7f007f;">'1'</span><span style="color: #adadad; font-style: italic;">; clockwise means increase on pwm cycle</span><br />&nbsp; &nbsp; &nbsp; &nbsp; ADDWF&nbsp; &nbsp;ORIGINAL_PWM,<span style="color: #ff0000;">0</span><span style="color: #adadad; font-style: italic;">; add to the register to prevent over increment happned(more than 255)</span><br />&nbsp; &nbsp; &nbsp; &nbsp; BTFSC&nbsp; &nbsp;STATUS,<span style="color: #0000ff;">C</span><span style="color: #adadad; font-style: italic;">;it will turn to 0 cycle if over increment</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; RELOAD255<span style="color: #adadad; font-style: italic;">; reload 255 cycle </span><br />&nbsp; &nbsp; &nbsp; &nbsp; INCF&nbsp; &nbsp; ORIGINAL_PWM,f&nbsp; <span style="color: #adadad; font-style: italic;">;increase pwm if no over increment condition happened</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; NORMAL<span style="color: #adadad; font-style: italic;">;continue to save pwm</span><br />RELOAD255<br />&nbsp; &nbsp; &nbsp; &nbsp; MOVLW&nbsp; &nbsp;d<span style="color: #7f007f;">'255'</span><span style="color: #adadad; font-style: italic;">; load 255 to resigter due to over increment to 0 in w register</span><br />&nbsp; &nbsp; &nbsp; &nbsp; MOVWF&nbsp; &nbsp;ORIGINAL_PWM<span style="color: #adadad; font-style: italic;">; move to resigter</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; NORMAL<span style="color: #adadad; font-style: italic;">;continue to save pwm</span><br />&nbsp; &nbsp; &nbsp; &nbsp; RETURN<br /><span style="color: #adadad; font-style: italic;">;************************************************</span><br /><span style="color: #adadad; font-style: italic;">;**** DIRECTION TABLE****************************</span><br /><span style="color: #adadad; font-style: italic;">;************************************************</span><br /><br />TABLE_1:<br />&nbsp; &nbsp; &nbsp; &nbsp; ADDWF&nbsp; &nbsp;PCL,<span style="color: #ff0000;">1</span>&nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">; add the result to pc, result is from 4th bit generated</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; RESTART_PWM&nbsp; &nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">; no increment nor decrement</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; ANTI_CLOCKWISE&nbsp; <span style="color: #adadad; font-style: italic;">; decrease on pwm</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; CLOCKWISE&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">;increase on pwm</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; RESTART_PWM&nbsp; &nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; CLOCKWISE&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; RESTART_PWM&nbsp; &nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; RESTART_PWM&nbsp; &nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; ANTI_CLOCKWISE&nbsp; <span style="color: #adadad; font-style: italic;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; ANTI_CLOCKWISE&nbsp; <span style="color: #adadad; font-style: italic;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; RESTART_PWM&nbsp; &nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; RESTART_PWM&nbsp; &nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; CLOCKWISE&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; RESTART_PWM&nbsp; &nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; CLOCKWISE&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; ANTI_CLOCKWISE&nbsp; <span style="color: #adadad; font-style: italic;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">GOTO</span>&nbsp; &nbsp; RESTART_PWM&nbsp; &nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; RETURN<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">END</span><br />&nbsp;</div></div>]]></description>
<author>nicholastyc&lt;thamyc_2000@nospam.com&gt;</author>
<pubDate>Wed, 11 Jun 2008 23:27:38 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t9898.html</guid>
</item>
						<item>
						<title>Re: Help on ICDWarn0044:  Target has an invalid calibration memory value (0x3FFF)</title>
<link>http://www.8051projects.net/forum-t9898.html</link>
<description><![CDATA[hi Ajay, i am really scratching my head, i already programmed my code above to my pic...i tested my code on MPLAB SIM, it worked totally fine with what i expected.<br />But it dont work after i programmed the code into pic...<br /><br />wat;s the problem with setting??????thanks!]]></description>
<author>nicholastyc&lt;thamyc_2000@nospam.com&gt;</author>
<pubDate>Wed, 11 Jun 2008 23:29:29 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t9898.html</guid>
</item>
						<item>
						<title>Re: Help on ICDWarn0044:  Target has an invalid calibration memory value (0x3FFF)</title>
<link>http://www.8051projects.net/forum-t9898.html</link>
<description><![CDATA[are you working with a development board? or a self constructed board?]]></description>
<author>Ajay&lt;contact@nospam.com&gt;</author>
<pubDate>Fri, 13 Jun 2008 00:06:28 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t9898.html</guid>
</item>
				</channel>
				</rss>