Jump to content

Component: EEPROM (EEPROM): Difference between revisions

From Flowcode Help
No edit summary
No edit summary
Line 93: Line 93:
Example showing how to store and retrieve strings to and from the EEPROM memory.
Example showing how to store and retrieve strings to and from the EEPROM memory.
{{Fcfile|StringEE.fcfx|EEStrings}}
{{Fcfile|StringEE.fcfx|EEStrings}}




Line 98: Line 100:
==Macro reference==
==Macro reference==


===WriteFloat===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
Line 126: Line 129:




===ReadInt===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
Line 149: Line 153:




===ReadFloat===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
Line 172: Line 177:




===WriteByte===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
Line 195: Line 201:




===WriteInt===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
Line 223: Line 230:




===ReadString===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
Line 246: Line 254:




===Read===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
Line 264: Line 273:




===ReadLong===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
Line 287: Line 297:




===WriteString===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
Line 315: Line 326:




===Write===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
Line 338: Line 350:




===ReadByte===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
Line 361: Line 374:




===WriteLong===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-

Revision as of 11:49, 3 February 2023

Author Matrix Ltd
Version 1.2
Category EEPROM


EEPROM component

A means of reading data from and writing data to the EEPROM memory onboard the microcontroller. Fully functional with simulation but the target microcontroller must have EEPROM memory available to allow compilation to work.

Component Source Code

Please click here to download the component source project: FC_Comp_Source_EEPROM.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_EEPROM.fcfx

Detailed description

No detailed description exists yet for this component

Examples

The Console window can be used to show the contents of EE memory during simulation.

Image


Read and Write Bytes

Reads a value from location 0 in the EEPROM and writes back the value incremented by one, the values are displayed on to a LCD.

Starting and stopping the simulation or resetting the microcontroller will allow the program to resume counting from where it left off as opposed to a standard RAM based variable which would reset to an undetermined value. EEPROM

Read and Write Ints

Reads a value from locations 0,1 in the EEPROM and writes back the value incremented by one, the values are displayed on to a LCD.

Starting and stopping the simulation or resetting the microcontroller will allow the program to resume counting from where it left off as opposed to a standard RAM based variable which would reset to an undetermined value. EEPROM_INT

String variables in EE Memory

Example showing how to store and retrieve strings to and from the EEPROM memory. EEStrings



Macro reference

WriteFloat

WriteFloat
Writes a 32-bit float value starting at the specified address. A 32-bit float will consume 4 bytes which will be 4 locations on an 8-bit device or 2 locations on a 16-bit device. 
- UINT StartAddress
Initial EE location to start reading 
- FLOAT Value
Floating point value to write 
- BOOL MSBFirst
0=LSB First, 1=MSB First 
- VOID Return


ReadInt

ReadInt
Reads a 16-bit int value starting from the specified address. A 16-bit int will consume 2 bytes which will be 2 locations on an 8-bit device or 1 location on a 16-bit device. 
- UINT StartAddress
Initial EE location to start reading 
- BOOL MSBFirst
0=LSB First, 1=MSB First 
- UINT Return


ReadFloat

ReadFloat
Reads a 32-bit float value starting from the specified address. A 32-bit float will consume 4 bytes which will be 4 locations on an 8-bit device or 2 locations on a 16-bit device. 
- UINT StartAddress
Initial EE location to start reading 
- BOOL MSBFirst
0=LSB First, 1=MSB First 
- FLOAT Return


WriteByte

WriteByte
Writes a 8-bit byte value to the specified address. A 8-bit byte will consume 1 bytes which will be 1 locations on an 8-bit device or half a location on a 16-bit device. 
- UINT ByteAddress
Byte address, EEADDR on 8-bit device or EEADDR/2 on a 16-bit device 
- BYTE Value
Floating point value to write 
- VOID Return


WriteInt

WriteInt
Writes a 16-bit int value starting at the specified address. A 16-bit int will consume 2 bytes which will be 2 locations on an 8-bit device or 1 location on a 16-bit device. 
- UINT StartAddress
Initial EE location to start reading 
- UINT Value
Floating point value to write 
- BOOL MSBFirst
0=LSB First, 1=MSB First 
- VOID Return


ReadString

ReadString
Reads a string of data from the EE memory starting at the specified address. 8-bit EE memory stores a character into each memory location. 16-bit EE memory stores two characters into each memory location. 
- UINT StartAddress
EE Address of the first character in the string 
- BYTE MaxChars
The maximum number of characters to try and read plus null termination 
- STRING Return


Read

Read
Reads a packet of bits from the EEPROM The number of bits read is 8 or 16, depending on the platform  
- UINT Address
The address, in elements, to read the data from 
- UINT Return


ReadLong

ReadLong
Reads a 32-bit long value starting from the specified address. A 32-bit long will consume 4 bytes which will be 4 locations on an 8-bit device or 2 locations on a 16-bit device. 
- UINT StartAddress
Initial EE location to start reading 
- BOOL MSBFirst
0=LSB First, 1=MSB First 
- ULONG Return


WriteString

WriteString
Writes a string of data to the EE memory starting at the specified address. 8-bit EE memory stores a character into each memory location. 16-bit EE memory stores two characters into each memory location. 
- UINT StartAddress
EE Address of the first character in the string 
- BYTE MaxChars
The maximum number of characters to try and read plus null termination 
- STRING DataString
 
- VOID Return


Write

Write
Writes a packet of bits from the EEPROM The number of bits written is 8 or 16, depending on the platform  
- UINT Address
The address, in elements, to write the data to 
- UINT Value
The 8 or 16 bit value to store in EEPROM 
- VOID Return


ReadByte

ReadByte
Reads a 8-bit byte value starting from the specified address. A 8-bit byte will consume 1 byte which will be 1 locations on an 8-bit device or half a location on a 16-bit device. 
- UINT ByteAddress
Byte address, EEADDR on 8-bit device or EEADDR/2 on a 16-bit device 
- BOOL MSBFirst
0=LSB First, 1=MSB First 
- BYTE Return


WriteLong

WriteLong
Writes a 32-bit long value starting at the specified address. A 32-bit long will consume 4 bytes which will be 4 locations on an 8-bit device or 2 locations on a 16-bit device. 
- UINT StartAddress
Initial EE location to start reading 
- ULONG Value
Floating point value to write 
- BOOL MSBFirst
0=LSB First, 1=MSB First 
- VOID Return



Property reference

Properties
EE Size
Number of memory locations available in EEPROM onboard the target microcontroller. 
EE Bit Depth
Number of bits in each EEPROM memory location onboard the target microcontroller. 
Initial Values
Comma seperated list of values to assign to the EEPROM memory while programming the device. The simulation will automatically load these values into the simulated EE locations on simulation start. Leave blank to remove initialisation code from the compiled C code Supported Formats Decimal 0 - 255 Hexadecimal 0x00 - 0xFF ASCII character 'x' Strings "text" 
Reset To Defaults
Decides what to do on a simulation start event. Siim data will reset to initial values after reloading project or changing initial values property. Yes: Resets the contents of the EEPROM data to the initial values. No: EEPROM contents will be retained between simulations.