As discussed previously, we will fill up our SRAM and
then transfer the values to EEPROM, giving us three
separate sets of data. Since each of these sets is structured
the same, we can benefit from defining a single data
structure. We will first fill the SRAM instance of this
structure and then when it is full, we will copy the raw
bytes from it into the first 512 bytes of EEPROM.
We will then clear the SRAM memory for the
structure and begin our second set of sampling data.
When the SRAM fills up again, we will copy the data to
the second 512 bytes of EEPROM, and again clear the
SRAM and start sampling over. We will use three instances
of the following data structure:
Remember that the 126 bytes will store twice that —
252 nibbles.
Let's Use a Data Structure
ELECTRONICS
ALL
ELECTRONICS
ALL
www.allelectronics.com
struct fac_log {
datetime origin_datetime
uint8_t origin_intemp
uint8_t origin_outtemp
uint8_t origin_inhum
uint8_t origin_outhum
uint8_t inTemp[NIBBLE_ARRAY_SIZE]
uint8_t outTemp[NIBBLE_ARRAY_SIZE]
uint8_t inHum[NIBBLE_ARRAY_SIZE]
uint8_t outHum[NIBBLE_ARRAY_SIZE]
}
CAT# HS-4900
Order Toll Free 1-800-826-5432
15 AMP GROUNDED OUTLET
Black 3-conductor grounded
outlet. Snap-mounts into
12VDC SPDT 40A
AUTOMOTIVE RELAY
0.9" square chassis hole.
0.187" QC/ solder terminals.
Rated 15A/125Vac. UL, CSA.
12 Vdc, 88 ohm coil. Contacts
rated 40A. Plastic flange for
bulkhead mounting. Mounts in
standard automotive relay socket.
CAT# ACS-58
$100 each 10 for 90¢ each 100 for 80¢ each
CAT# RLY-351
10 for $2.25 each
$255 each
SOLDERLESS BREADBOARD,
400 CONTACTS
DPDT ON-ON MINI
TOGGLE SWITCH
RATED: 6 amp 120 Vac.
If the SRAM fills up a third time
before we download the data to the
PC ... we didn’t plan well, did we? We
could figure out a way to trash the
oldest data and keep only the most
recent stuff until somebody downloads
it, but we are already getting too
complex. So, let’s just stop sampling
data and leave it up to the user to
figure this part out.
Accommodates all sizes of
dips and discrete components. Interconnect with
solid hook-up wire. Wires
and components can be
re-used many times without
damage to board or
components.
Then a Storm Hits ...
Solder lugs. 0.43" long handle.
CAT# MTS- 8
$175 each 10 for $1.60 each 100 for $1.35 each
CAT# PB-400 $4 00 each
DOOR LOCK ACTUATOR
48 VDC 0.38A POWER
12 Vdc motor-drive
actuator for automotive door locks.
SUPPLY
Phihong
Nylon plunger
moves 0.75". Push or
pull, depending on polarity.
#PSC18U-480.
Overall dimensions (retracted):
5' cord w/ molded
2.5mm coax
power plug. Center
positive. cULus,
5. 50" x 2. 45" x 1.25". Rubber boot protects
against moisture and dust.
CAT# DLA-1
$550 each
CE. RoHS.
CAT# PS-480
10 for $7.00 each $750 each
$1195 each
COLOR HEAT SHRINK TUBING ASSORTMENT, 154 PCS
4 inch lengths of 6
different diameters:
So, now we’ve got a handle on
the data during normal times, but what
about that exceptional case of a storm
passing through and making a change
outside of our – 8 to + 7 range? Again,
we’ll have to make an arbitrary
assumption and just declare that if any
value falls outside our range, we will
declare an exception by setting all four
nibbles at that sample time to – 8.
Let’s assume that we will never
see all our sensor values drop exactly
eight points from one interval to the
next under normal conditions, and
we’ll use this ‘fact’ to create an
exception state that the software can
see in the stored data and then
compensate for it.
SNAP-ON FERRITE BEAD
1/16" - 56 pcs
7mm (0.27") I.D. snap-bead.
3/32" - 35 pcs
32. 5 x 19.0 x 19.5mm case.
1/8" - 28 pcs
CAT# FB-103 $150 each 10 for $1.35 each
3/16" - 18 pcs
1/4" - 9 pcs
3/8" - 8 pcs
100 for $1.15 each
Even if the rare case happens that
all four values do — in fact — drop
exactly eight points, we only lose a
little data space since the solution to
the exception involves storing four
new initial bytes. So, really, all we’ve
58 November 2013