<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>pic18 Archives - Tom Barbette</title>
	<atom:link href="https://perso.uclouvain.be/tom.barbette/tag/pic18/feed/" rel="self" type="application/rss+xml" />
	<link>https://perso.uclouvain.be/tom.barbette/tag/pic18/</link>
	<description></description>
	<lastBuildDate>Fri, 07 Feb 2014 13:32:01 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://perso.uclouvain.be/tom.barbette/wp-content/uploads/2022/04/cropped-logo-uclouvain-2021-barbette-32x32.png</url>
	<title>pic18 Archives - Tom Barbette</title>
	<link>https://perso.uclouvain.be/tom.barbette/tag/pic18/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Read and write PIC EEPROM</title>
		<link>https://perso.uclouvain.be/tom.barbette/read-and-write-pic-eeprom/</link>
		
		<dc:creator><![CDATA[Tom Barbette]]></dc:creator>
		<pubDate>Sun, 19 Jan 2014 11:08:10 +0000</pubDate>
				<category><![CDATA[Electronic]]></category>
		<category><![CDATA[eeprom]]></category>
		<category><![CDATA[hightechc]]></category>
		<category><![CDATA[microchip]]></category>
		<category><![CDATA[mplab]]></category>
		<category><![CDATA[pic]]></category>
		<category><![CDATA[pic16]]></category>
		<category><![CDATA[pic18]]></category>
		<category><![CDATA[xc8]]></category>
		<guid isPermaLink="false">http://queen.run.montefiore.ulg.ac.be/~barbette/?p=100</guid>

					<description><![CDATA[<p>More a little post-it than a post, I wanted to put somewhere the commands : Using the eeprom is as simple as these two commands : [code lang=&#8221;c&#8221;]EEPROM_READ(addr) EEPROM_WRITE(addr,value) [/code] A little example (reading from the USART a value and putting it in the EEPROM address 0x00) [code] while (!DataRdyUSART()); char data = ReadUSART(); EEPROM_WRITE(0x00,data); &#8230; </p>
<p class="link-more"><a href="https://perso.uclouvain.be/tom.barbette/read-and-write-pic-eeprom/" class="more-link">Continue reading<span class="screen-reader-text"> "Read and write PIC EEPROM"</span></a></p>
<p>The post <a href="https://perso.uclouvain.be/tom.barbette/read-and-write-pic-eeprom/">Read and write PIC EEPROM</a> appeared first on <a href="https://perso.uclouvain.be/tom.barbette">Tom Barbette</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>More a little post-it than a post, I wanted to put somewhere the commands :</p>
<p>Using the eeprom is as simple as these two commands :</p>
<p>[code lang=&#8221;c&#8221;]EEPROM_READ(addr)<br />
EEPROM_WRITE(addr,value)<br />
[/code]</p>
<p>A little example (reading from the USART a value and putting it in the EEPROM address 0x00)</p>
<p>[code]<br />
while (!DataRdyUSART());<br />
char data = ReadUSART();<br />
EEPROM_WRITE(0x00,data);<br />
[/code]</p>
<p>Note that theses header are defined in the standard xc8 header <xc8.h> which will include <pic18.h> (or <pic16.h>, &#8230;) or High Tech C headers if you come from the past :</p>
<p>[code lang=&#8221;c&#8221;]<br />
// MACROS for EEPROM Access<br />
/* macro versions of EEPROM read and write */</p>
<p>/* NOTE WELL:<br />
EEPROM_READ() is NOT safe to use immediately after any<br />
write to EEPROM, as it does NOT wait for WR to clear. This is by<br />
design, to allow minimal code size if a sequence of reads is<br />
desired. To guarantee uncorrupted writes insert<br />
while(WR)continue;<br />
before calling EEPROM_READ().<br />
*/</p>
<p>#if _EEPROMSIZE &gt; 0 &amp;&amp; defined(_PLIB)<br />
#define EEPROM_READ(addr) Read_b_eep(addr)<br />
#define eeprom_read(addr) Read_b_eep(addr)<br />
#else<br />
#define EEPROM_READ(addr) 0 // Added only for code portability<br />
#define eeprom_read(addr) 0<br />
#endif</p>
<p>#if _EEPROMSIZE &gt; 0 &amp;&amp; defined(_PLIB)<br />
#define EEPROM_WRITE(addr, value) (Busy_eep(), Write_b_eep(addr,value))<br />
#define eeprom_write(addr, value) (Busy_eep(), Write_b_eep(addr,value))<br />
#else<br />
#define EEPROM_WRITE(addr, value) // Added only for code portability<br />
#define eeprom_write(addr, value)<br />
#endif<br />
[/code]</p>
<p>The post <a href="https://perso.uclouvain.be/tom.barbette/read-and-write-pic-eeprom/">Read and write PIC EEPROM</a> appeared first on <a href="https://perso.uclouvain.be/tom.barbette">Tom Barbette</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
