External memory

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
armagon29
Posts: 56
Joined: Thu May 07, 2009 4:40 pm
Been thanked: 2 times
Contact:

External memory

Post by armagon29 »

Dear All:

I need to write info (ADC value) into an external memory 24LC254 (i2c protocol) but I not sure if it is possible, FC v3 has a especial macro (Beta) for I2c devices?, but how can I use this memory, If this kind of device is not property, which one and how does it work?

Thanks

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: External memory

Post by Benj »

Hello,

This is taken from the help file for the I2C component.

A typical IΒ²C device (24 series EEPROM)
Here is how to send and receive data to and from a typical IΒ²C device.

Sending Data
Output a start condition //Starts the device listening to the IΒ²C bus.
Transmit the External Device address with the LSB cleared. //Enables the device and sets to write mode.
Transmit the Internal address. //Sets the address to start writing data to.
Transmit a byte of data. //Device will acknowledge and increment internal address until page limit is reached
....
Transmit a byte of data. //Device will acknowledge and increment internal address until page limit is reached
Output a stop condition //Stops the device listening to the IΒ²C bus.

Note. When writing to a page of memory make sure to only write within that page as if you carry on writing bytes the internal address will wrap around and begin overwriting the first bytes.

Receiving Data
Output a start condition //Starts the device listening to the IΒ²C bus.
Transmit the External Device address with the LSB cleared. //Enables the device and sets to write mode.
Transmit the Internal address. //Sets the address to start reading data from.
Output a restart condition //Restarts the device listening to the IΒ²C bus.
Transmit the External Device address with the LSB set. //Enables the device and sets to read mode.
Receive a byte of data with last byte 0. //Device will send data and increment internal address until page limit is reached
....
Receive a byte of data with last byte 1. //Device will send data.

Output a stop condition //Stops the device listening to the IΒ²C bus.

Flowcode v4 has built in functions to do this for you.

Post Reply