beautypg.com

Remote Processing CX-10 User Manual

Page 16

background image

SAVING DATA TO REGISTERS

SECTION 3

Page 3-1

INTRODUCTION

SAVING DATA TO REGISTERS

SECTION 3

There are 2 numerical formats data can be saved as:
Integer and Floating Point. Additionally, there are two
types of media this data can be saved to: EEPROM and
SRAM. Data is stored to 4 groups of registers, described
below.

All registers described in this section are accessible over
modbus.

Number Types

The CX-10 works with both types of number formats.
Each type has features and limitations.

Integers are in what is known as a 16 bit format and
allows numbers between 0 and 65,535. This format is
handy for bit manipulation (such as opto input or relay
status). It takes less memory than floating point and is
faster to work with. Its primary limitation is the limited
number range it can store. It cannot store negative
numbers.

When using Basic (another hidden format), integers and
floating point numbers are automatically converted into
native format. In Basic, both integers and floats are the
same.

Floating point numbers are stored in a format known as
IEEE-754, 32 bit. This is a standard format used by
many computers. These numbers take longer to work
with and require more memory. This 32 bit data length
is a single precision format. It can store floating point
numbers in the range of +/- E

127

. As a matter of practical

use, it can store up to 7 digits of data plus an exponent.
Any extra numbers are not to be relied upon.

This format has the unfortunate characteristic of
returning numbers that are close, but not quite the same
as the original. Some examples:

Original

IEE-754 format

80.3

80.30001

80.6

80.59999

For all intents and purposes the differences are not
significant, less than 0.0001245%.

We used terminology such as “faster”, “longer”, more
and less memory. These are relative terms. For the most
part you can use floating point numbers. Use integers if
you run out of floats, keeping in mind the range of values

it can store (0-65535).

STORAGE MEDIA

Integer and floating point numbers are stored in SRAM
and EEPROM. SRAM is temporary, volatile memory in
the CPU. When the CPU cycles power or resets, number
contents are reset to 0. Registers may be written to
SRAM an unlimited number of times.

EEPROM’s retain data after power cycling. EEPROM
data is stored in U2 on the CX-10 board. Registers may
be written to 1,000,000 times before it wears out.

Both SRAM and EEPROM may be read an unlimited
number of times.

When should SRAM storage be used? When its contents
is expected to change frequently. Frequently, in this
case, means once/minute or so. Looked at from a
different way, writing to EEPROM once/minute means
the part will “wear out” in about 1.5 years.

SRAM is useful for holding data used in modbus
communications. EEPROM is useful for storing
constants, such as time delays, offsets and multipliers.

DATA REGISTERS

There are 4 groups of data, or numeric, storage registers
shown in the table below. Numeric ranges are inclusive,
meaning you can use all the numbers shown.

Register range

Media type

Numeric type

4001-4256

EEPROM

Integers

4501-4628

SRAM

Integers

7033-7096

SRAM

Floating point

7101-7356

EEPROM

Floating point

You have 256 integer and floating point numbers that
can be stored in EEPROM. You have 128 integers and
64 floating point numbers in volatile SRAM.