<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>FM24C256</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/21308/fm24c256</link><description> 
Hello there, 

 
Please help me, i am looking for a code using CodeVision on How to
store and read data from FRAM(FM24C256)...im waiting for your reply..
Thanks in advance........... 

 
Bryan 
 </description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: FM24C256</title><link>https://community.arm.com/thread/112630?ContentTypeID=1</link><pubDate>Wed, 07 Feb 2007 03:14:59 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:4e3cde30-cdfa-45ec-9739-b9f5936a928a</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
You said initially that you&amp;#39;re using CodeVision - which is
&lt;b&gt;&lt;i&gt;not&lt;/i&gt; a Keil product&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;
Your code looks like it&amp;#39;s for an AVR:&lt;/p&gt;

&lt;pre&gt;
#include &amp;lt;mega16.h&amp;gt;
&lt;/pre&gt;

&lt;p&gt;
&lt;/p&gt;

&lt;pre&gt;
  PORTB = 0b00000000;
  DDRB  = 0b00000000;

  /*-HW UART-*/
  UCSRA = 0x00;
  UCSRB = 0x18;
  UCSRC = 0x86;
  UBRRH = 0x00;
  UBRRL = 0x17;
&lt;/pre&gt;

&lt;p&gt;
Keil tools do &lt;b&gt;&lt;i&gt;not&lt;/i&gt;&lt;/b&gt; support the AVR.&lt;/p&gt;

&lt;p&gt;
So why are you posting this in the &lt;b&gt;Keil&lt;/b&gt; forum?&lt;br /&gt;
&lt;a href="http://www.keil.com/forum/"&gt;http://www.keil.com/forum/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;
The forum you need for the AVR is: &lt;a href="http://www.avrfreaks.net/"&gt;http://www.avrfreaks.net/&lt;/a&gt;&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FM24C256</title><link>https://community.arm.com/thread/98886?ContentTypeID=1</link><pubDate>Wed, 07 Feb 2007 03:09:16 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:0bf776c3-6ae9-4533-91a8-a900dbbef101</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;&amp;quot;there is a problem in writing and reading. it doesn&amp;#39;t display
to the hyperterminal&amp;quot;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
How have you confirmed that the problem is due to writing and
reading, and not due to your serial coms?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FM24C256</title><link>https://community.arm.com/thread/98895?ContentTypeID=1</link><pubDate>Wed, 07 Feb 2007 02:40:12 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:6f6b6682-d4b2-4725-a8ae-6ddd2788192d</guid><dc:creator>Bryan Clark Flores</dc:creator><description>&lt;p&gt;&lt;p&gt;
Edited Code:&lt;/p&gt;

&lt;pre&gt;
/* the I2C bus is connected to PORTB */
/* the SDA signal is bit 3 */
/* the SCL signal is bit 4 */

#asm
    .equ __i2c_port=0x18
    .equ __sda_bit=3
    .equ __scl_bit=4
#endasm

/* now you can include the I2C Functions */
#include &amp;lt;i2c.h&amp;gt;

#include &amp;lt;mega16.h&amp;gt;
#include &amp;lt;stdio.h&amp;gt;

#define FRAM_BUS_ADDRESS 0xa0

/* read a byte from the FRAM */
unsigned char fram_read(unsigned char address)
{
  unsigned char data;

  i2c_start();
  i2c_write(FRAM_BUS_ADDRESS);
  //i2c_write((FRAM_BUS_ADDRESS|(int)&amp;amp;0xFE));
  //i2c_write(address+1);
  i2c_write(address);
  i2c_start();
  i2c_write(FRAM_BUS_ADDRESS|1);
  data=i2c_read(0);
  i2c_stop();
  return data;

}

/* write a byte to the FRAM */
void fram_write(unsigned char address, unsigned char data)
{
  i2c_start();
  i2c_write(FRAM_BUS_ADDRESS);
  //i2c_write((FRAM_BUS_ADDRESS|(int)0xFE));
  //i2c_write(address+1);
  i2c_write(address);
  i2c_write(data);
  i2c_stop();
}

void main(void)
{
  unsigned char i;

  PORTB = 0b00000000;
  DDRB  = 0b00000000;

  /*-HW UART-*/
  UCSRA = 0x00;
  UCSRB = 0x18;
  UCSRC = 0x86;
  UBRRH = 0x00;
  UBRRL = 0x17;

  /* initialize the I2C bus */
  i2c_init();

  /* write the byte 55h at address AAh */
  fram_write(0xaa,0x55);

  /* read the byte from address AAh */
  i=fram_read(0xaa);

  /*--------------------------------------------*/
  if (i==&amp;#39;\0&amp;#39;){
       printf(&amp;quot;\rFRAM is Empty...\r&amp;quot;);
     }
  else{
       printf(&amp;quot;\rData stored in FRAM : %c \r&amp;quot;,i);
     }
  /*--------------------------------------------*/

  while (1); /* loop forever */
}
&lt;/pre&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FM24C256</title><link>https://community.arm.com/thread/74797?ContentTypeID=1</link><pubDate>Wed, 07 Feb 2007 02:25:28 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:c5da2042-9cf4-46da-9b23-33c58d48c7d2</guid><dc:creator>Bryan Clark Flores</dc:creator><description>&lt;p&gt;&lt;p&gt;
I posted the code,there is a problem in writing and reading. it
doesn&amp;#39;t display to the hyperterminal the data on FM24C256..please
check it if something problem with my code...thanks&lt;/p&gt;

&lt;p&gt;
The Code:&lt;/p&gt;

&lt;p&gt;
/* the I2C bus is connected to PORTB */&lt;br /&gt;
/* the SDA signal is bit 3 */&lt;br /&gt;
/* the SCL signal is bit 4 */&lt;/p&gt;

&lt;p&gt;
#asm .equ __i2c_port=0x18 .equ __sda_bit=3 .equ __scl_bit=4&lt;br /&gt;
#endasm&lt;/p&gt;

&lt;p&gt;
/* now you can include the I2C Functions */&lt;br /&gt;
#include &amp;lt;i2c.h&amp;gt;&lt;/p&gt;

&lt;p&gt;
#include &amp;lt;mega16.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;/p&gt;

&lt;p&gt;
#define FRAM_BUS_ADDRESS 0xa0&lt;/p&gt;

&lt;p&gt;
/* read a byte from the FRAM */&lt;br /&gt;
unsigned char fram_read(unsigned char address)&lt;br /&gt;
{ unsigned char data;&lt;/p&gt;

&lt;p&gt;
i2c_start(); i2c_write(FRAM_BUS_ADDRESS);
//i2c_write((FRAM_BUS_ADDRESS|(int)&amp;amp;0xFE));
//i2c_write(address+1); i2c_write(address); i2c_start();
i2c_write(FRAM_BUS_ADDRESS|1); data=i2c_read(0); i2c_stop(); return
data;&lt;/p&gt;

&lt;p&gt;
}&lt;/p&gt;

&lt;p&gt;
/* write a byte to the FRAM */&lt;br /&gt;
void fram_write(unsigned char address, unsigned char data)&lt;br /&gt;
{ i2c_start(); i2c_write(FRAM_BUS_ADDRESS);
//i2c_write((FRAM_BUS_ADDRESS|(int)0xFE)); //i2c_write(address+1);
i2c_write(address); i2c_write(data); i2c_stop();&lt;br /&gt;
}&lt;/p&gt;

&lt;p&gt;
void main(void)&lt;br /&gt;
{ unsigned char i;&lt;/p&gt;

&lt;p&gt;
PORTB = 0b00000000; DDRB = 0b00000000;&lt;/p&gt;

&lt;p&gt;
/*-HW UART-*/ UCSRA = 0x00; UCSRB = 0x18; UCSRC = 0x86; UBRRH =
0x00; UBRRL = 0x17;&lt;/p&gt;

&lt;p&gt;
/* initialize the I2C bus */ i2c_init();&lt;/p&gt;

&lt;p&gt;
/* write the byte 55h at address AAh */ fram_write(0xaa,0x55);&lt;/p&gt;

&lt;p&gt;
/* read the byte from address AAh */ i=fram_read(0xaa);&lt;/p&gt;

&lt;p&gt;
/*--------------------------------------------*/ if (i==&amp;#39;\0&amp;#39;){
printf(&amp;quot;\rFRAM is Empty...\r&amp;quot;); } else{ printf(&amp;quot;\rData stored in FRAM
: %c \r&amp;quot;,i); } /*--------------------------------------------*/&lt;/p&gt;

&lt;p&gt;
while (1); /* loop forever */&lt;br /&gt;
}&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FM24C256</title><link>https://community.arm.com/thread/98877?ContentTypeID=1</link><pubDate>Tue, 06 Feb 2007 16:28:29 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:e269be0e-8b5f-47da-9aa3-9c3fc5ebb2eb</guid><dc:creator>barry gordon</dc:creator><description>&lt;p&gt;&lt;p&gt;
Sequence of outputing bytes is what I referred to as protocol.
Transfering bytes to the device is the hardware layer, spi, i2c,
etc.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FM24C256</title><link>https://community.arm.com/thread/88167?ContentTypeID=1</link><pubDate>Tue, 06 Feb 2007 07:27:26 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:e15a0a50-7356-4461-b817-6bc2a3176fe8</guid><dc:creator>erik  malund</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;an I2C device. ... the SPI parts for years. Same protocol,
difference interface.&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
NO WAY, the protocol is totally, absolutely, completely
different.&lt;/p&gt;

&lt;p&gt;
One added point: there are &amp;#39;51 derivatives galore ($1 up) that
have harware IIC and/or SPI interfaces and the code for those (except
for the SILabs f3x, f4x, f5x Deviates) is either ready when done with
CodeArchitect, free from &lt;a href="http://www.esacademy.com"&gt;http://www.esacademy.com&lt;/a&gt; or can be
modified to fit in 15 minutes or less.&lt;/p&gt;

&lt;p&gt;
Bit-banging, while it does handle the protocol (code &amp;#39;examples&amp;#39;
all over), is very likely to cause other problems because it hangs
the processor during the transfer.&lt;/p&gt;

&lt;p&gt;
Erik&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FM24C256</title><link>https://community.arm.com/thread/47743?ContentTypeID=1</link><pubDate>Tue, 06 Feb 2007 01:09:10 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:98dcf10c-d9bf-439f-9ff3-c1ac6bbdf135</guid><dc:creator>barry gordon</dc:creator><description>&lt;p&gt;&lt;p&gt;
This connects up as an I2C device. Look at the data sheet for the
device, it explains what is required to communicate with the
device.&lt;/p&gt;

&lt;p&gt;
I have been using the SPI parts for years. Same protocol,
difference interface.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FM24C256</title><link>https://community.arm.com/thread/47745?ContentTypeID=1</link><pubDate>Mon, 05 Feb 2007 01:58:53 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:cf810a04-a6c7-4a39-bd16-39a2635a1d51</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
How would CodeVision affect the way that an FM24C256 works?&lt;/p&gt;

&lt;p&gt;
Have you read the FM24C256 &lt;b&gt;Datasheet&lt;/b&gt;?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FM24C256</title><link>https://community.arm.com/thread/47744?ContentTypeID=1</link><pubDate>Sun, 04 Feb 2007 22:25:24 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:df0c3f0e-350c-4dee-8791-2fa12d3cf294</guid><dc:creator>Dan Henry</dc:creator><description>&lt;p&gt;&lt;p&gt;
CodeVision? Here?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>