my data logger body
TRANSCRIPT
-
8/10/2019 My Data Logger Body
1/45
1
CHAPTER ONE
INTRODUCTION
1.1 Background
A data logger(also called data recorder) is an electronic device that records data over time or
in relation to location either with a built-in instrumentsensor or via external instruments and
sensors. Data loggers are based on a digital data processing using computers. They generally are
small, battery powered, portable devices equipped with a microprocessor, internal memory for
data storage, and sensors. Some data loggers interface with a personal computer and utilize
software to activate the data logger, to view and analyze collected data, while others have local
interface devices (keypad, liquid crystal display (LCD), etc) and can be used as stand-alone
devices.
Data loggers vary between general purpose types for a range of measurement applications to
very specific devices for measurement in one environment or application type only. It is common
for general purpose types to beprogrammable;however, many remain as static machines with
only a limited number or no changeable parameters. Electronic dataloggers have replacedchart
recorders in most applications.
One of the primary benefits of using data loggers is the ability to automatically collate data on a
24-hour basis. Upon activation, data loggers are typically deployed and left unattended to
measure and record information for the duration of the monitoring period. This allows for
comprehensive, accurate picture of the environmental conditions being monitored, such as air
temperature and relative humidity.
The cost of data loggers has been declining over the years as technology improves and costs are
reduced. Data loggers are nowadays based on the microcontroller technology. Most of them are
usually portable battery-operated devices with internal storage and some incorporate sensors to
http://en.wikipedia.org/wiki/Sensorhttp://en.wikipedia.org/wiki/Computer_programhttp://en.wikipedia.org/wiki/Chart_recorderhttp://en.wikipedia.org/wiki/Chart_recorderhttp://en.wikipedia.org/wiki/Chart_recorderhttp://en.wikipedia.org/wiki/Chart_recorderhttp://en.wikipedia.org/wiki/Computer_programhttp://en.wikipedia.org/wiki/Sensor -
8/10/2019 My Data Logger Body
2/45
2
measure physical quantities such as temperature, pressure, voltage, current, power in watt,
humidity, liquid flow, displacement, frequency, and so on.
Data loggers can be divided into two basic groups: standalone data loggers and computer
interface data loggers.
1.2 Standalone Data Loggers
This type of data loggers can be used on their own, without requiring other devices for data
collection and storage. Standalonedata loggers have large internal non-volatile memory. They
mayalso have real time clock chips. Thecollected data can be saved in the memorywith time
stamping.The data collected in a standalone datalogger is usually analysed offline. Astandalone
data logger is usuallyconfigured and then left at the requiredsite to collect data. At the end of
the data collection period the device is connected to a PC and the collected data is read and
analysed with the PC. Somestandalone data loggers are dedicated forspecific measurements, for
exampletemperature, pressure, etc. data loggers.
The Thermo Recorder TR-5 Series [spencer (2010)] is a typical standalone temperature data
logger. This data logger has LCD output, and it can take up to 16,000 readings with time
intervals from onesecond to one hour and the battery life isquoted as four years.
One of the disadvantages of standalone data loggers is that the devices should be checked at
regular intervals to make sure that the memory is not full, or the battery is not flat. This may
sometimes causeproblems since the device may be locatedat a remote location or at a place not
easilyreachable.
-
8/10/2019 My Data Logger Body
3/45
3
1.3 Computer Interfaced Data Loggers
Computer Interfaced data loggers are used only to capture the data. These devices do not have
large internal memories and are normally connected to a PC. The captured data are then stored in
a PC for storage or for analysis. The data can either be analysed offline or online. One of the
disadvantages of interfaced data loggers is that the devices cannot be used on their own as
another device (e.g. a PC) is required to store the captured data. The Pico Technology is a typical
interface data logger that is connected to a PC to transfer the captured data. The device has built
in sensors for light, sound and temperature measurements. Some interface data loggers have
wireless capabilities. Usually a transmitter- receiver pair is used: the transmitter captures the data
and sends it to the receiving device using wireless communication. The receiving device usually
has large internal memory and stores the received data.
1.4 Research problem
Preventive measure rather total repair of equipment breakdown is a key feature in present day
engineering. There is therefore need for performance monitoring via data logging so as to know
when systems/equipment are efficient or failing.
1.5 GeneralObjectives
The aim of this project is to eliminate problems associated with sudden break down of power
generating plant via routine and real-time data logging of the systems performance. It does this
by taking samples of three electrical parameters; Voltage, Current, and Frequency, and storing
the data for analysis and evaluation.
1.6 Scope
This project takes and log samples of Voltage, Current, and Frequency on a PC. Its core is based
on a microcontroller. It can also be used as a standalone data logger depending on the settings.
-
8/10/2019 My Data Logger Body
4/45
4
1.7 Justifications
As power engineering trends changes issues become more important, engineers need to have data
to argue their case. Whether you believe in operational changes or not, its only by systematic
collecting hard data that we will enable one to figure out how the operational process is
changing. The key to this is a versatile data logger. Having a platform like this will facilitate the
step towards understanding some great operational performances. Thus the need for a more
robust way for fault finding and performance monitor.
1.8 Limitations
This project focuses on sampling voltage, current, and frequency at specific voltage, current,
noise level, and stress. It does not provide extensive guidance on different sampling designs for
making inferences about larger magnitude of voltages and current that exceeds 500 Volt 30Amp.
Another factor that is worthy of consideration is the documentation and archiving of data in a
format that is readily accessible. The project tends to monitor electrical characteristics alone and
not mechanical stress related issue thus making the data logging system not complete because
mechanical faults may also breakdown the power generating plant so a need to incorporate this
in further research.
1.9 Organization of Chapters
Chapter 1 describes the background of the temperature data logger and temperature measurement
significance. Aim and objectives that provides direction for this project were stated.
Chapter 2 covers the literature review. The data loggers evolution, types of temperature loggers
review as well.
Chapter 3 presents the methodology of the project. The hardware used and implementation were
also included.
-
8/10/2019 My Data Logger Body
5/45
5
Chapter 4 covers the testing result of the three input data logger module developed and result.
In Chapter 5 conclusion, recommendation and contribution to knowledge are presented.
-
8/10/2019 My Data Logger Body
6/45
6
CHAPTER TWO
LITERATURE REVIEW
Saha et al (1986) design a LowCost Multi Channel Data Logger. Development of a low-cost
multi-channel (eight totwenty two channels) data logger can easily be made and easily be used
to convert the analog signal of physical parameters of various tests. Interfacing these signals
using ADC with the parallel port of a computer satisfies the very goal of data communication.
The user friendless and reliability in using PC and channel selectormultiplexers further add to
the versatility of the Data logger. Design and implementation of such equipment cost only at
US$300, makes it very inexpensivecomparative to other commercially available data loggers.
Dedrick et al (1990) Microprocessor-Based Data Logging System. Which The PIC 16C73A,8-
bit, microcontroller (Microchip Technology, Inc) is well suited for an inexpensivedata logger.
Segregating host communications functions into the reader: (1) reduces the number of
components and complexity of the logger thus reducing the cost ofeach logger, (2) allows the
data logger to operate at the lower power.
In 1990, M.Moghavvemi represented a paper on Simple Low Cost Data AcquisitionSystem for
Remote Sensing of Relative Humidity and Temperature. It combineslogic circuits together with
programming technique to control the hardware for remotesensing of temperature and relative
humidity. The sensor circuit converts the relative humidity and temperature into an analog
signal, which will be applied to amicrocontroller based data logger for storage purpose. This is
transferred to thecomputer through RS232 standard serial port. The system can be real time and
offline.
Kanukurthy et al (1994) covered a data acquisition unit for an Implantable Multi-Channel
Optical Glucose Sensor. This new technology relies on the unique optical characteristics of
glucose ina near infrared spectrum. The sensor element will be implanted in the subcutaneous
-
8/10/2019 My Data Logger Body
7/45
7
tissues of the human body. The data acquisition unit acquires optical data from the sensor and
converts it into spectral data for processing.
Moon et al (2009) Microcontroller based DataLogger System The data logger will be based
around ATMEGA 128 microcontroller. This has a built-in analog-to-digital (ADC) with a
conversionaccuracy of 12-bits as well as memory. The interface program was implemented as
software adoptable for graphical user interface environment using Visual C++.
Greenburg (2011) in his book principles of data capturing describedthe concept of logging and
how logging is done is in detail. Logging is a process to record events with the use of data
loggers during a test or field use of a system or a product. Logging is one of the usability
methods that can and should be used to gather more supplementary information as an integral
part of the iterative design of the usability engineering cycle. Logging has the major advantage
compared with other usability methods of not interfering with the users in their performing their
tasks. Users can basically ignore the log and use the system in exactly the way they would
anyway.
Mazidi et al (2013) in their book the overview of 8051 stated that microcontrollers and
microprocessors are widely used in embedded system products. An embedded product uses a
microcontroller to do one task and one task only. In addition to the description of criteria for
choosing a microcontroller, the interfacing with the real world devices such as LCDs, ADCs,
sensors and keyboard is described in detail. Finally; they discussed the issue of interfacing
external memories, both RAM and ROM.
Scientific data collection has been a complicated task and time consuming for years and the data
collected somehow may not 100 % accurate. With the invention of electronic instruments, the
data collection task can be done automatically and thus releasing engineers and scientist, or their
-
8/10/2019 My Data Logger Body
8/45
8
assistants for other tasks. Data logging is commonly used in scientific experiments and in
monitoring systems where there is the need to collect information faster than a human can
possibly collect the information and in cases where accuracy is essential. [Kale et al
(2007)].
Many loggers archive information such as temperature using sensors and then convert the
information into electrical signals. The data is archived and once retrieved can be filtered and
properly understood. Earlier data loggers used magnetic tape, punched paper tape, or directly
viewable records such as strip chart recorders, [Crystal, (2011)].
[Wheeler et al, (2010)]Chart recorder is an electromechanical device that records electrical or
mechanical input trend onto a piece of paper and they are appeared in three different types, the
strip, circular, and roll types. Strip chart recorders, as shown in Figure 2.1 have a long strip of
paper ejected out the side of the recorder. Circular chart recorders have a rotating disc of paper
are more compact and amenable but the chart paper must be replaced frequently, as shown in
Figure 2.2. Roll chart recorders meanwhile are similar to strip chart recorders except that the unit
is fully enclosed and the recorded data is stored on a round roll.
-
8/10/2019 My Data Logger Body
9/45
9
Figure 2.1: Strip Chart Recorders. [Wheeler et al (2010)].
Figure 2.2: Circular Chart Recorders, [Moyer Instruments, (2011)].
-
8/10/2019 My Data Logger Body
10/45
10
[Ladyada.net, (2011)] Analogue temperature sensor uses a solid-state technique to determine the
temperature. It does not use mercury, which can be found in old thermometers or bimetallic
strips which used in some home thermometers or stoves. Instead, it uses the fact as temperature
increases, the voltage across a diode increases at a known rate or the voltage drop between the
base and emitter, VBE of a transistor. By precisely amplifying the voltage change, it is easy to
generate an analogue signal that is directly proportional to temperature. As these sensors have no
moving parts, they are precise, never wear out, don't need calibration, work under various
environmental conditions, and are consistent between sensors and readings. Moreover they are
very inexpensive and easy to use.
[Varalakshmi, (2011)] Thermocouple is a junction between two different metals that produces a
voltage related to a temperature difference and is a widely used type of temperature sensor for
measurement and control and can also be used to convert heat into electric power. They are
interchangeable and inexpensive, are supplied fitted with standard connectors, and can measure a
wide range of temperatures. However, the main limitation is accuracy where system errors of
less than one degree Celsius (C) can be difficult to achieve. Thermocouple is available in
different combinations of metals or calibrations and the most common calibrations are J, K, T
and E. There are high temperature calibrations R, S, C and GB. Each calibration has a different
temperature range and environment, although the maximum temperature varies with the diameter
of the wire used in the thermocouple. Although the thermocouple calibration dictates the
temperature range, the maximum range is also limited by the diameter of the thermocouple wire.
-
8/10/2019 My Data Logger Body
11/45
11
CHAPTER THREE
METHODOLOGY
Evaluation of Figure 3.1 highlights that the memory device is used by both modules. In order to
increase the functionality of the system the memory device was designed as an independent unit
which could be transferred between modules when required. To create the required system three
separate units were designed and constructed, namely:
Measurement Unit, Memory Unit and PC interface Unit. The Measurement Unit in conjunction
with Memory Unit forms the Measurement Module. The PC Interface Unit connected to the
Memory Unit in conjunction with a PC forms the PC Interface Module. The units and their
associated modules are illustrated in the following diagram.
For reasons of simplicity the functional unit performing the task of measurement and data
storage will be known as the measurement module while the functional unit performing the
tasks of data download and data processing will be known as the PC Interface module.
-
8/10/2019 My Data Logger Body
12/45
12
Figure 3.1: Block Diagram of System Modules
The implementation of these two functions could be achieved in a single physical device. Such
an implementation would be cost effective as manufacturing, housing and materials costs would
be reduced. However, since both functions can be done independently, physically separating the
functions provides advantages that are undoubtedly superior. These benefits are now discussed
with reference to the following diagrams.
-
8/10/2019 My Data Logger Body
13/45
13
Figure 3.2: Block Diagram of the Data Logger
3.2 BLOCK DIAGRAM DESCRIPTION
3.2.1 Microcontroller Unit (MCU)
The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller with 8K bytes of
in-system programmable Flash memory. The device is manufactured using Atmels high-density
nonvolatile memory technology and is compatible with the industry- standard 80C51 instruction
set and pin out. The on-chip Flash allows the program memory to be reprogrammed in-system or
by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with in-
system programmable Flash on a monolithic chip, the Atmel AT89S52 is a powerful
-
8/10/2019 My Data Logger Body
14/45
14
microcontroller which provides a highly-flexible and cost-effective solution to many embedded
control applications. The AT89S52 provides the following standard features: 8K bytes of Flash,
256 bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, three 16-bit timer/counters,
a six-vector two-level interrupt architecture, a full duplex serial port, on-chip oscillator, and
clock circuitry.
In this design the microcontroller forms the core of the system, meaning that all mathematical
and logical operation of the system is executed from within it.
Figure 3.2: Pin Configuration of Atmel 89S52 Microcontroller
As shown on the previous picture, the 8051 microcontroller has nothing impressive at first sight:
4 Kb program memory is not much at all. 128Kb RAM (including SFRs as well) satisfies basic needs, but it is not imposing
amount.
-
8/10/2019 My Data Logger Body
15/45
15
4 ports having in total of 32 input/output lines are mostly enough to make connection toperipheral environment and are not luxury at all.
3.2.2 Microcontroller's Ports
Port 0
It is specific to this port to have a double purpose. If external memory is used then the loweraddress byte (addresses A0-A7) is applied on it. Otherwise, all bits on this port are configured asinputs or outputs.
Another characteristic is expressed when it is configured as output. Namely, unlike other portsconsisting of pins with embedded pull-up resistor ( connected by its end to 5 V power supply ),this resistor is left out here. This, apparently little change has its consequences:
If any pin on this port is configured as input then it performs as if it floats. Such input hasunlimited input resistance and has no voltage coming from inside.
When the pin is configured as output, it performs as open drain, meaning that by writing 0 to
some ports bit, the appropriate pin will be connected to ground (0V). By writing 1, the externaloutput will keep on floating. In order to apply 1 (5V) on this output, an external pull-upresistor must be embedded.
-
8/10/2019 My Data Logger Body
16/45
16
Port 1
This is a true I/O port, because there are no role assigning as it is the case with P0. Since it hasembedded pull-up resistors it is completely compatible with TTL circuits.
Port 2
Similar to P0, when using external memory, lines on this port occupy addresses intended forexternal memory chip. This time it is the higher address byte with addresses A8-A15. Whenthere is no additional memory, this port can be used as universal input-output port similar by itsfeatures to the port 1.
Port 3
Even though all pins on this port can be used as universal I/O port, they also have an alternative
function. Since each of these functions use inputs, then the appropriate pins have to beconfigured like that. In other words, prior to using some of reserve port functions, a logical one(1) must be written to the appropriate bit in the P3 register. From hardwares perspective , this
port is also similar to P0, with the difference that its outputs have a pull-up resistor embedded.
3.2.3 Power Supply Unit
The main supply to the uni t is gotten f rom the USB port of the PC and also an auxi ll ary power
supply for backup that run dir ectly from a 9VDC and stabil ised down to 5VDC for proper
operati on of the microcontroller incase the uni t is to be operated as a stand alone meteri ng
device.
Obviously, all this is about very simple circuits, but it does not have to be always like that. If
device is used for handling expensive machines or for maintaining vital functions, everything
becomes more and more complicated! This kind of solution is quite enough for the time being.
3.2.4 Visual Display Unit
The visual display unit is used to show the current value of calculated instantaneous
parameters of the data coll ection unit. I t is bui lt around the microcontr oller which serves
-
8/10/2019 My Data Logger Body
17/45
17
as the core for the system by outputting the desir ed values of in formation unto the display and
a multiplexed seven segment display.
Liquid Crystal Displays (LCD)
These components are specialized for being used with the microcontrollers, which means thatthey cannot be activated by standard IC circuits. They are used for writing different messages ona miniature LCD.
A model described here is for its low price and great possibilities most frequently used inpractice. It is based on the HD44780 microcontroller (Hitachi) and can display messages in twolines with 16 characters each. It displays all letters of alphabet, Greek letters, punctuation marks,mathematical symbols etc. In addition, it is possible to display symbols that user makes up on itsown. Automatic shifting message on display (shift left and right), appearance of the pointer,
backlight etc. are considered as useful characteristics.
Pins Functions
There are pins along one side of the small printed board used for connection to themicrocontroller. There are total of 14 pins marked with numbers (16 in case the background lightis built in). Their function is described in the table below:
Function Pin NumberName Logic State Description
Ground 1 Vss - 0V
Power supply 2 Vdd - +5V
Contrast 3 Vee - 0 - Vdd
Control ofoperating
4 RS01
D0 D7 are interpreted ascommands
-
8/10/2019 My Data Logger Body
18/45
18
D0D7 are interpreted as data
5 R/W01
Write data (from controller to LCD)Read data (from LCD to controller)
6 E
0
1From 1 to 0
Access to LCD disabledNormal operating
Data/commands are transferred toLCD
Data / commands
7 D0 0/1 Bit 0 LSB
8 D1 0/1 Bit 1
9 D2 0/1 Bit 2
10 D3 0/1 Bit 3
11 D4 0/1 Bit 4
12 D5 0/1 Bit 5
13 D6 0/1 Bit 6
14 D7 0/1 Bit 7 MSB
LCD Screen
LCD screen consists of two lines with 16 characters each. Each character consists of 5x8 or 5x11dot matrix. This book covers 5x8 character display because it is commonly used.
Contrast on display depends on the power supply voltage and whether messages are displayed inone or two lines. For that reason, variable voltage 0-Vdd is applied on pin marked as Vee.Trimmer potentiometer is usually used for that purpose. Some versions of displays have built inbacklight (blue or green diodes). When used during operating, a resistor for current limitationshould be used (like with any LE diode).
-
8/10/2019 My Data Logger Body
19/45
19
Figure 3.3: Pin Configuration of an LCD
3.2.5 Data Collection Unit
This unit is made up of an analog-to-digital converter(abbreviated ADC, A/Dor A to D) is a
device which converts continuous signals to discrete digital numbers. The reverse operation is
performed by adigital-to-analog converter (DAC) and an analogue multiplex.
Typically, an ADC is anelectronic device that converts an input analogvoltage (orcurrent)to a
digital number proportional to the magnitude of the voltage or current. However, some non-
electronic or only partially electronic devices, such as rotary encoders, can also be considered
ADCs. The digital output may use different coding schemes, such as binary,Gray code ortwo's
complementbinary.
http://wapedia.mobi/en/Signal_%28information_theory%29http://wapedia.mobi/en/Discrete_signalhttp://wapedia.mobi/en/Digitalhttp://wapedia.mobi/en/Digital-to-analog_converterhttp://wapedia.mobi/en/Electronicshttp://wapedia.mobi/en/Voltagehttp://wapedia.mobi/en/Electric_currenthttp://wapedia.mobi/en/Digitalhttp://wapedia.mobi/en/Rotary_encoderhttp://wapedia.mobi/en/Binary_numeral_systemhttp://wapedia.mobi/en/Gray_codehttp://wapedia.mobi/en/Two%27s_complementhttp://wapedia.mobi/en/Two%27s_complementhttp://wapedia.mobi/en/Two%27s_complementhttp://wapedia.mobi/en/Two%27s_complementhttp://wapedia.mobi/en/Gray_codehttp://wapedia.mobi/en/Binary_numeral_systemhttp://wapedia.mobi/en/Rotary_encoderhttp://wapedia.mobi/en/Digitalhttp://wapedia.mobi/en/Electric_currenthttp://wapedia.mobi/en/Voltagehttp://wapedia.mobi/en/Electronicshttp://wapedia.mobi/en/Digital-to-analog_converterhttp://wapedia.mobi/en/Digitalhttp://wapedia.mobi/en/Discrete_signalhttp://wapedia.mobi/en/Signal_%28information_theory%29 -
8/10/2019 My Data Logger Body
20/45
20
I ts prime function in th is cir cui t is to digiti ze the analog quanti ty that is gotten f rom the
transducer (sensor) or the instantaneous voltage that is to be logged to the system unit to a
form that wi ll be easil y processed by the microcontr oll er . The accuracy of the converter
depends on these factors resolution, Accuracy, Quantization error, Aperture error, and Non-
linearity.
3.2.6 Resolution
The resolution of the converter indicates the number of discrete values it can produce over the
range of analog values. Here we have decided to use an 8-Bit Analog-Digital converter for its
low cost and simplicity hence at expense of lower performance when it comes to step size or
resolution. The values are usually stored electronically in binary form, so the resolution is
usually expressed inbits.In consequence, the number of discrete values available, or "levels", is
usually a power of two. For example, an ADC with a resolution of 8 bits can encode an analog
input to one in 256 different levels. The values can represent the ranges from 0 to 255 (i.e.
unsigned integer) or from -128 to 127 (i.e. signed integer), depending on the application.
Resolution can also be defined electrically, and expressed in volts.The voltage resolution of an
ADC is equal to its overall voltage measurement range divided by the number of discrete
intervals as in the formula:
. . . . . . . Eqn (1)
Where:
Q is resolution in volts per step (volts per output codes less one),
EFSRis the full scale voltage range =,
M is the ADC's resolution in bits.
http://wapedia.mobi/en/Binary_numeral_systemhttp://wapedia.mobi/en/Bithttp://wapedia.mobi/en/Volthttp://wapedia.mobi/en/Volthttp://wapedia.mobi/en/Bithttp://wapedia.mobi/en/Binary_numeral_system -
8/10/2019 My Data Logger Body
21/45
21
N is the number of intervals, (one less than the number of available levels, or output
codes), which is:
Example 1
o Full scale measurement range = 0 to 10 volts
o ADC resolution is 12 bits: 212= 4096 quantization levels (codes)
o ADC voltage resolution is: (10V - 0V) / 4095 steps = 10V / 4095 steps
0.00244 V/step 2.44 mV/step
Example 2
o Full scale measurement range = 0 to 7 volts
o ADC resolution is 3 bits: 23= 8 quantization levels (codes)
o ADC voltage resolution is: (7 V 0 V)/7 steps = 7 V/7 steps = 1 V/ step = 1000
mV/step
In practice, the smallest output code ("0" in an unsigned system) represents a voltage range
which is 0.5Q, that is, half the ADC voltage resolution (Q), as does the largest output code. The
other N 2 codes are all equal in width and represent the ADC voltage resolution (Q) calculated
above. Doing this centers the code on an input voltage that represents the M thdivision of the
input voltage range. For example, in Example 3, with the 3-bit ADC spanning a 7 V range, each
of the N divisions would represent 1 V, except the 1st ("0" code) and the last ("7" code) which
are 0.5 V wide. Doing this the "1" code spans a voltage range from 0.5 to 1.5 V, the "2" code
spans a voltage range from 1.5 to 2.5 V, etc. Thus, if the input signal is at 3/8ths of the full-scale
voltage, then the ADC outputs the "3" code, and will do so as long as the voltage stays within the
range of 2.5/8ths and 3.5/8ths. This practice is called "mid-tread" operation.
http://wapedia.mobi/en/Full_scalehttp://wapedia.mobi/en/Full_scalehttp://wapedia.mobi/en/Full_scalehttp://wapedia.mobi/en/Full_scale -
8/10/2019 My Data Logger Body
22/45
22
In practice, the useful resolution of a converter is limited by the bestsignal-to-noise ratio that can
be achieved for a digitized signal. An ADC can resolve a signal to only a certain number of bits
of resolution, called the effective number of bits (ENOB). One effective bit of resolution changes
thesignal-to-noise ratio of the digitized signal by 6 dB, if the resolution is limited by the ADC. If
apreamplifier has been used prior to A/D conversion, the noise introduced by the amplifier can
be an important contributing factor towards the overall SNR.
3.2.7 Accuracy
An ADC has several sources of errors.Quantization error and (assuming the ADC is intended to
be linear) non-linearity is intrinsic to any analog-to-digital conversion. There is also a so-called
aperture error which is due to a clockjitter and is revealed when digitizing a time-variant signal
(not a constant value).
These errors are measured in a unit called the LSB, which is an abbreviation forleast significant
bit.In the above example of an eight-bit ADC, an error of one LSB is 1/256 of the full signal
range, or about 0.4%.
3.2.8 Quantization error
Quantization error is due to the finite resolution of the ADC, and is an unavoidable imperfection
in all types of ADC. Themagnitude of the quantization error at the sampling instant is between
zero and half of one LSB.
In the general case, the original signal is much larger than one LSB. When this happens, the
quantization error is not correlated with the signal, and has auniform distribution.ItsRMS value
is the standard deviation of this distribution, given by. In the eight-bit ADC example, this
represents 0.113% of the full signal range.
http://wapedia.mobi/en/Signal-to-noise_ratiohttp://wapedia.mobi/en/Signal-to-noise_ratiohttp://wapedia.mobi/en/Preamplifierhttp://wapedia.mobi/en/Quantizationhttp://wapedia.mobi/en/Linearityhttp://wapedia.mobi/en/Jitterhttp://wapedia.mobi/en/Least_significant_bithttp://wapedia.mobi/en/Least_significant_bithttp://wapedia.mobi/en/Magnitude_%28mathematics%29http://wapedia.mobi/en/Quantization_errorhttp://wapedia.mobi/en/Uniform_distribution_%28continuous%29http://wapedia.mobi/en/Root_mean_squarehttp://wapedia.mobi/en/Standard_deviationhttp://wapedia.mobi/en/Standard_deviationhttp://wapedia.mobi/en/Root_mean_squarehttp://wapedia.mobi/en/Uniform_distribution_%28continuous%29http://wapedia.mobi/en/Quantization_errorhttp://wapedia.mobi/en/Magnitude_%28mathematics%29http://wapedia.mobi/en/Least_significant_bithttp://wapedia.mobi/en/Least_significant_bithttp://wapedia.mobi/en/Jitterhttp://wapedia.mobi/en/Linearityhttp://wapedia.mobi/en/Quantizationhttp://wapedia.mobi/en/Preamplifierhttp://wapedia.mobi/en/Signal-to-noise_ratiohttp://wapedia.mobi/en/Signal-to-noise_ratio -
8/10/2019 My Data Logger Body
23/45
23
At lower levels the quantizing error becomes dependent of the input signal, resulting in distortion
with amplitude of 1 quantization step added to the signal. This slightly reduces signal to noise
ratio, but completely eliminates the distortion. It is known asdither.
3.2.9 Non-linearity
All ADCs suffer from non-linearity errors caused by their physical imperfections, resulting in
their output to deviate from a linear function (or some other function, in the case of a deliberately
non-linear ADC) of their input. These errors can sometimes be mitigated by calibration, or
prevented by testing.
Important parameters for linearity areintegral non-linearity (INL) anddifferential non-linearity
(DNL). These non-linearities reduce the dynamic range of the signals that can be digitized by the
ADC, also reducing the effective resolution of the ADC. The multiplexer is used to select
dif ferent analogue quanti ty that is to be measured and i t i s concatenated to the ADC since it
has only one input.
3.3 IMPLEMENTATION
3.3.1 Block Diagram Design
A rough sketch on how the project would look like was first drawn, detailing all the components
blocks that would make-up the complete system. Once drawn and checked for consistency,
the second phase was proceeded to immediately.
http://wapedia.mobi/en/Ditherhttp://wapedia.mobi/en/Calibrationhttp://wapedia.mobi/en/Integral_nonlinearityhttp://wapedia.mobi/en/Differential_nonlinearityhttp://wapedia.mobi/en/Differential_nonlinearityhttp://wapedia.mobi/en/Integral_nonlinearityhttp://wapedia.mobi/en/Calibrationhttp://wapedia.mobi/en/Dither -
8/10/2019 My Data Logger Body
24/45
24
3.3.2 Schematic Design
Schematic design poses one of the most difficult constraints in the design of this project because
here for sure, we are dealing with discrete components that have one common goal speak the
language of electronics effectively this simply means that all sections of the system should work
in harmony with little deviation from the target.
3.3.3 Soldering
Soldering is the process of a making a sound electrical and mechanical joint between certain
metals by joining them with a soft solder. This is a low temperature melting point alloy of lead
and tin. The joint is heated to the correct temperature by soldering iron. For most electronic work
miniature mains powered soldering irons are used. These consist of a handle onto which is
mounted the heating element. On the end of the heating element is what is known as the "bit", so
called because it is the bit that heats the joint up. Solder melts at around 190 degrees Centigrade,
and the bit reaches a temperature of over 250 degrees Centigrade. This temperature is plenty hot
enough to inflict a nasty burn, consequently care should be taken.
Good soldering is a skill that is learnt by practice. The most important point in soldering is that
both parts of the joint to be made must be at the same temperature. The solder will flow evenly
and make a good electrical and mechanical joint only if both parts of the joint are at an equal
high temperature. Even though it appears that there is a metal to metal contact in a joint to be
made, very often there exists a film of oxide on the surface that insulates the two parts. For this
reason it is no good applying the soldering iron tip to one half of the joint only and expecting this
to heat the other half of the joint as well
-
8/10/2019 My Data Logger Body
25/45
25
3.3.4 Testing the Circuit
After the construction, the circuit was properly analyzed and short circuit and open circuits were
all corrected. The circuit is then powered with a voltage supply of 5V and some parameters such
as clock pulses were measured.
-
8/10/2019 My Data Logger Body
26/45
26
CHAPTER FOUR
Result and Analysis
In any given design there must be a set rules and regulation guiding it, in view of this project
industrial data logger with computer is not a left out. This design was triggered off by first;
trying to figure out how the project can be actualized, getting the desired clue, surfing online to
gather more Intel, and thus the Ideal was achieved.
Figure 4.1: Circuit Diagram of the Sensor Unit For The Three Input Data Logger
-
8/10/2019 My Data Logger Body
27/45
27
Figure 4.2: Circuit Diagram of the MCU for Three Input Data Logger
-
8/10/2019 My Data Logger Body
28/45
28
Figure 4.3: System User Application Console
Figure 4.4: System Logged Data
-
8/10/2019 My Data Logger Body
29/45
29
4.1 How it Works
All microcontroller embedded system runs on an internal firmware burnt into the chip or outside
the chip in a ROM. This design uses the ever familiar MCU microcontroller unit from Atmel
semiconductors owing to the fact that its brand of MCU has a wider data I/O lines for the job.
The firmware program was written in assembly language and compiled using the ASEMW
brand of macro cross-assembler to finally get the machine executable file. Once the exec file is
gotten, it was downloaded it into the MCU internal flash memory from where it is to be executed
using a gadget called a Programmer.
4.1.1 Programmers are device used to get the executable file that resides in the computer down
to the microcontroller for final execution of the program.
Below are the modes of operation of the system outlined in a sequential manner in order to aid
quick understanding of how the project works.
Three buttons are used to control operation of the data logger: START, PAUSE, and RESET.
4.1.2 Step-By-Step Analysis
1. At power ON, the microcontroller immediately initializes the state of the visual display
unit to a known state, and also resets its self to a defined status that conforms to the pre-
loaded program.
2. A routine is called upon by the controller to clear the visual display unit and also to clear
the content of the register that is used to store the converted data that resides in the
controller.
-
8/10/2019 My Data Logger Body
30/45
30
3. An instruction is called upon, to check the serial control line and also to power down the
USB controller so that the issue of unwanted logging would be combated. During this
sequence of system initialization the visual display is defaulted to the value of zero.
4.
At this point the system is fully initialized. Here it waits for the appropriate command for
logging to commence else it will serve as a standalone metering instrument.
5. The data collection unit proceeds to these modes of operation labeled i thru vi.
i) The MCU counts the number of pulses at the counter input pin if any, stores the data
in a special register that is used for its temporary store, and then calls upon a routine
that outputs this data onto the corresponding display then jumps to the next step.
ii)
At this point, the ADC unit is activated. Here since there are four analogue
parameters that s to be measured, the multiplexer unit is automatically enabled as well
since the four inputs are concatenated to the multiplexer. Thus taking us to the next
step.
iii)The MCU issues a command to the multiplexer that enables the temperature channel,
the analogue value is quickly made available to the input of the ADC, and the MCU
further gives a command to the ADC to start conversion. Once the conversion is done
the data is the gated to the MCU for digital processing. Here the data is analysed,
stored in its temporary register, then displayed onto the corresponding indicator.
From here the MCU jumps to the next step.
iv)The MCU issues a command to the multiplexer that enables the current channel, the
value of the current which has been converted to voltage by the current transformer
quickly made available to the input of the ADC, and the MCU further gives a
command to the ADC to start conversion. Once the conversion is done the data is the
gated to the MCU for digital processing. Here the data is analysed, stored in its
temporary register, then displayed onto the corresponding indicator. From here the
MCU jumps to the next step.
v) Here the MCU repeats the steps above but this time around the AC voltage is
measured. The MCU enables the channel that corresponds to the AC voltage input;
-
8/10/2019 My Data Logger Body
31/45
31
the ADC does its conversion and then gates its output to the MCU which then
finishes up the digital processing by storing the data in its corresponding register and
also displaying the data on the status display. A jump is made to ascertain the power
of the connected load if their exist any thus taking the MCU to the final step in data
collection.
vi)The MCU issues a command to the multiplexer that enables the power channel, the
power value is quickly made available to the input of the ADC, and the MCU further
gives a command to the ADC to start conversion. Once the conversion is done the
data is the gated to the MCU for digital processing. Here the data is analysed, stored
in its temporary register, then displayed onto the corresponding indicator. From here
the MCU jumps to the next step.
This process is repeated continuously so long as the unit is powered thus this function also makes
it a standalone metering instrument.
6. From this point, if the start command button is clicked on the system GUI, the stored
content in the temporary register is automatically sent to the system via the USB port as
the means of communication.
It should be pointed out that the speed of data logging to the system is the sole control of the
system and not the data collection unit or the MCU. This is achieved by the system issuing a
query to the controller to send its stored content that resides in the register at a specified time
selectable by the user via the log time on the menu bar located at the top left of the system
based application. This gives the user the flexibility to adjust the intervals between logs.
Also, the user can pause the logging in other to get a clearer view of the data base, resets the
buffer, save the content of the data base for future reference or print the saved document.
-
8/10/2019 My Data Logger Body
32/45
32
Since every program is a well-defined loop, hence this program is by no means an exception.
This means that the whole action is cyclical hence once in the standalone state or data logging
state the whole action repeats itself.
4.1.3 NOTE: the standalone as used means that the instrument can be used as a conventional
metering device and not a standalone data logger.
4.1.4 Mechanical Construction
After finalizing the construction of the circuit, what remains now is the mechanical outlook of
the enclosed system. In this design consideration of price and usage in real time
application was done, since the aim of this project is for prototyping, a white plastic finishing
was chosen to give it slick and wonderful look, and as well as given it the desired ruggedness.
4.1.5 Problems Encountered
Basically, the problems I encountered during the making of this project were the unavailability
of the core controller that is to be used in the project. This particular problem introduced the
highest bottle neck in the prototyping face of my project because it forms the frame work.
Some of the semiconductors were out of specification and this made the mathematical and
electrical parameters deviate by about 15% at the initial stage of the bread boarding. Thus
making the time expended on a particular circuit block high. But through careful adjustment of
pre-calculated the error rate was reduced to about 2%.
-
8/10/2019 My Data Logger Body
33/45
33
Also, establishing a clearly defined protocol for data transfer to and from the PC and the
hardware was not that rosy as the PC has 2 be in synch with the hardware hence data may be lost
thus leading to error in the data logging process.
Sending data unto the USB is one of the most technical aspects of the project because it makes
use of win32 API calls. This problem was solved by the use of prolific USB win32 driver which
has all the enumeration process that a typical USB controller needs.
Developing a computer based application using the Microsoft Visual Studio that will meet
technical standard like; real time logging, setting up a data base, plotting graphs etc. demands
greater precision on the part of program coding and this was not easy to come by because while
keeping up with the data received, the program should be able to multitask hence process
variation may be introduced.
Time , this plays a major factor in any given line of project, the time frame allocated to develop a
project of this standard is so small looking at the technicality so involved and this made the
sequences involved in the project a little bit unbearable for me.
-
8/10/2019 My Data Logger Body
34/45
34
CHAPTER FIVE
5.0 Conclusion
The fundamental objective of the design was to create a system that could take temperature,
frequency, power, voltage, and current measurements and store all this data till such time that it
is needed. This objective was successfully achieved within the low power consumption
condition. The desired accuracy were also achieved and validated by comparing the measured
temperature results to a calibrated digital thermometer.
The main change in operation of the Measurement Unit was with regard to the Time Stamping
Method employed. It was decided that rather than taking only an initial base time stamp and
incrementing this based on the number of a sample, a time stamp would be taken at a user
defined interval.
The data logger which is responsible for the downloading and processing of stored data was
successfully designed, constructed and tested. The design was achieved with a degree of user
friendliness and provides hassle free operation.
The design was achieved using a modular design approach which optimized the efficiency of the
system, increased its versatility as well significantly aided in troubleshooting during the
prototyping stage.
5.1 Recommendation
In this design a centralized AC input source was adopted in other to aid simplicity of the design
this has a limitation in terms of flexibility when the unit is to be deployed in a remote area thus
subsequent design should make provision in other to combat this downside.
-
8/10/2019 My Data Logger Body
35/45
35
Also, provision should be made so that data transfer could be made wireless, with this wireless
connectivity, data can as well be transferred via the internet instead of coming close to the unit.
5.2 Contribution to Knowledge
With the aid of this unit artisan, technicians, engineers, and every other sector of life will know
the importance of data logging. So this project will add value to the way we see things around us
and how to maximize the full potentials of any given design.
-
8/10/2019 My Data Logger Body
36/45
36
REFRENCE
8052.com (2011),Software-Based Real Time Clock (RTC). Retrieved March 25,2011, fromhttp://www.8052.com/tutrtc
Analog Devices (1999),Monolithic Thermocouple Amplifiers with Cold JunctionCompensation. Retrieved February 27, 2011, from http://www.analog.com/static/imported-files/data_sheets/AD594_595.pdf, pp. 13-16.
Data Logger. (2010),Introduction to Data Loggers. Retrieved June 10, 2013, fromhttp://www.omega.com/prodinfo/dataloggers.html
Dedrick et al (1990),Microprocessor-Based Data Logging System.
pp. 92-100.
Electronics Technology, (2006),ISSE '06. 29th International Spring Seminar on,vol., no., pp.309-312.
Ibrahim, D. (2008),Advanced PIC Microcontroller Projects in C: From USB toRTOS with the PIC18F Series. Burlington: Elsevier Ltd, pp. 142-156.
Ibrahim, D.(2010),SD Card Projects Using the PIC Microcontroller. Burlington:Elsevier Ltd, pp. 132-136.
Moghavvemi, M. (1990),Simple Low Cost Data Acquisition System for RemoteSensing of Relative Humidity and Temperature, pp. 1-13.
Moore, G. (1986),Data Loggers, Modern Recorders. Electronics and Power,Pp22-36.
http://www.8052.com/tutrtchttp://www.8052.com/tutrtchttp://www.8052.com/tutrtchttp://www.omega.com/prodinfo/dataloggers.htmlhttp://www.omega.com/prodinfo/dataloggers.htmlhttp://www.omega.com/prodinfo/dataloggers.htmlhttp://www.8052.com/tutrtc -
8/10/2019 My Data Logger Body
37/45
37
APPENDIX
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;VARIABLE DECLARATION;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
T2CON DATA 0C8H
RCAP2L DATA 0CAHsRCAP2H DATA 0CBH;;;;;;;;;;;;;;;;;;;;;;;;;
OUTPUT DATA 080HSCAN DATA 0A0HADC_IN DATA 090HCONTROL DATA 0B0H
WRITE BIT CONTROL.2ADD_L BIT CONTROL.3
ADD_H BIT CONTROL.5
COUNTER DATA 000HSTORE_1 DATA 001HSTORE_2 DATA 002HSTORE_3 DATA 003HTEMPERATURE_STORE DATA 004HFREQUECNY_STORE DATA 005HAC_VOLTAGE_STORE DATA 006HCURRENT_STORE DATA 007HPOWER_STORE DATA 008HDC_VOLTAGE_STORE DATA 009HDELAY_REG DATA 00AHDELAY_REG1 DATA 00BHDELAY_REG2 DATA 00CHRESTORE DATA 00DHSAMPLER DATA 00EHSTATUS_1 DATA 00FHSTATUS_2 DATA 010HSTATUS_3 DATA 011HLOG_COUNTER DATA 012HAUX_TEMP DATA 013HAUX_FREQ DATA 014HAUX_AC_VOL DATA 015HAUX_CURRE DATA 016HAUX_POW DATA 017HSAMPLER_1 DATA 018HLOG_STORE DATA 019H
-
8/10/2019 My Data Logger Body
38/45
38
FLAGS DATA 020HSAMPLE_FLAG BIT FLAGS.0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;END OF VARIABLEDECLARATION;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ORG 000HAJMP BOOTSTRAP
ORG 023HAJMP SETUP_DATA_LOGGING
ORG 02BH
AJMP SAMPLE
ORG 02FH
BOOTSTRAP:
MOV SP,#030HCLR WRITEMOV OUTPUT,#000MOV COUNTER,#001MOV LOG_COUNTER,#001MOV ADC_IN,#255MOV FREQUECNY_STORE,#000MOV TEMPERATURE_STORE,#000MOV AC_VOLTAGE_STORE,#000MOV CURRENT_STORE,#000MOV POWER_STORE,#000MOV SAMPLER,#100MOV SAMPLER_1,#025MOV AUX_TEMP,#000MOV AUX_FREQ,#000MOV AUX_AC_VOL,#000MOV AUX_CURRE,#000MOV AUX_POW,#000MOV SCAN,#000MOV TL0,#000
-
8/10/2019 My Data Logger Body
39/45
39
MOV STATUS_1,#071HMOV STATUS_2,#071HMOV STATUS_3,#03FHCLR ADD_LCLR ADD_H
SETB WRITESETB TR0MOV PCON,#080HMOV TMOD,#025HMOV TH1,#0FFHMOV SCON,#050HCLR TICLR RISETB TR1MOV RCAP2L,#000HMOV RCAP2H,#0DCH
MOV T2CON,#004MOV IE,#10110000BAJMP MAIN
MAIN: MOV A,FREQUECNY_STOREACALL BIN_DEC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MOV A,STORE_1ACALL DISP_MASKMOV SCAN,#000MOV OUTPUT,AACALL DELAY_900_11MOV OUTPUT,#000;;;;;;;;;;;;;;;;;;;;;MOV A,STORE_2ACALL DISP_MASKMOV SCAN,#001MOV OUTPUT,AACALL DELAY_900_11MOV OUTPUT,#000;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MOV A,TEMPERATURE_STOREACALL BIN_DEC;;;;;;;;;;;;;;;;;;;;;;;MOV A,STORE_1ACALL DISP_MASKMOV SCAN,#002MOV OUTPUT,A
-
8/10/2019 My Data Logger Body
40/45
40
ACALL DELAY_900_11MOV OUTPUT,#000;;;;;;;;;;;;;;;;;;;;;MOV A,STORE_2ACALL DISP_MASK
MOV SCAN,#003MOV OUTPUT,AACALL DELAY_900_11MOV OUTPUT,#000;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MOV A,CURRENT_STOREACALL BIN_DEC;;;;;;;;;;;;;;;;;;;;;;;MOV A,STORE_1ACALL DISP_MASKMOV OUTPUT,A
MOV SCAN,#004ACALL DELAY_900_11MOV OUTPUT,#000;;;;;;;;;;;;;;;;;;;;;MOV A,STORE_2ACALL DISP_MASKMOV OUTPUT,AMOV SCAN,#005SETB SCAN.4ACALL DELAY_900_11CLR SCAN.4MOV OUTPUT,#000;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MOV A,FREQUECNY_STORECJNE A,#000,PROCMOV AC_VOLTAGE_STORE,FREQUECNY_STORE
PROC: MOV A,AC_VOLTAGE_STOREACALL BIN_DEC;;;;;;;;;;;;;;;;;;;;;;;MOV A,STORE_1ACALL DISP_MASKMOV OUTPUT,AMOV SCAN,#006ACALL DELAY_900_11MOV OUTPUT,#000;;;;;;;;;;;;;;;;;;;;;MOV A,STORE_2ACALL DISP_MASKMOV OUTPUT,AMOV SCAN,#007
-
8/10/2019 My Data Logger Body
41/45
41
ACALL DELAY_900_11MOV OUTPUT,#000;;;;;;;;;;;;;;;;;;;;;MOV A,STORE_3ACALL DISP_MASK
MOV OUTPUT,AMOV SCAN,#008ACALL DELAY_900_11MOV OUTPUT,#000;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MOV A,POWER_STOREACALL BIN_DEC;;;;;;;;;;;;;;;;;;;;;;;MOV A,STORE_1ACALL DISP_MASKMOV OUTPUT,A
MOV SCAN,#009ACALL DELAY_900_11MOV OUTPUT,#000;;;;;;;;;;;;;;;;;;;;;MOV A,STORE_2ACALL DISP_MASKMOV OUTPUT,AMOV SCAN,#010ACALL DELAY_900_11MOV OUTPUT,#000;;;;;;;;;;;;;;;;;;;;;MOV A,STORE_3ACALL DISP_MASKMOV OUTPUT,AMOV SCAN,#011ACALL DELAY_900_11MOV OUTPUT,#000;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MOV OUTPUT,STATUS_1MOV SCAN,#012ACALL DELAY_900_11MOV OUTPUT,#000;;;;;;;;;;;;;;;;;;;;;MOV OUTPUT,STATUS_2MOV SCAN,#013ACALL DELAY_900_11MOV OUTPUT,#000;;;;;;;;;;;;;;;;;;;;;MOV OUTPUT,STATUS_3
-
8/10/2019 My Data Logger Body
42/45
42
MOV SCAN,#014ACALL DELAY_900_11MOV OUTPUT,#000;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACALL ADC_IN_ROUTINE
ACALL REFRESH_SCREENAJMP MAIN
REFRESH_SCREEN: DJNZ SAMPLER_1,RETURNMOV SAMPLER_1,#025MOV TEMPERATURE_STORE,AUX_TEMPMOV FREQUECNY_STORE,AUX_FREQMOV AC_VOLTAGE_STORE,AUX_AC_VOLMOV CURRENT_STORE,AUX_CURREMOV POWER_STORE,AUX_POW
RETURN: RET
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ADC_IN_ROUTINE: CLR ADD_HCLR ADD_LACALL DELAY_12KHzACALL GET_PARAMETERMOV AUX_CURRE,ADC_IN;;;;;;;;;;;;;;;;;;;;;;;;;;;SETB ADD_LCLR ADD_HACALL DELAY_12KHzACALL GET_PARAMETERMOV AUX_AC_VOL,ADC_IN;;;;;;;;;;;;;;;;;;;;;;;;;;;CLR ADD_LSETB ADD_HACALL DELAY_12KHzACALL GET_PARAMETERMOV AUX_TEMP,ADC_IN;;;;;;;;;;;;;;;;;;;;;;;;;;;SETB ADD_HSETB ADD_LACALL DELAY_12KHzACALL GET_PARAMETERMOV AUX_POW,ADC_IN;;;;;;;;;;;;;;;;;;;;;;;;;;;RET
-
8/10/2019 My Data Logger Body
43/45
43
GET_PARAMETER: CLR WRITENOPNOPNOPNOP
SETB WRITEACALL DELAY_12KHzRET
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;LOG_TO_SYSTEM: CLR SAMPLE_FLAG
CLR TIMOV A,LOG_STORE
FREQUECNY_LOGGER: CJNE A,#016,TEMPERATURE_LOGGERMOV SBUF,FREQUECNY_STOREJNB TI,$
CLR TIAJMP MAIN
TEMPERATURE_LOGGER: CJNE A,#008,AC_VOLTAGE_LOGGERMOV SBUF,TEMPERATURE_STOREJNB TI,$CLR TIAJMP MAIN
AC_VOLTAGE_LOGGER: CJNE A,#128,POWER_LOGGERMOV SBUF,AC_VOLTAGE_STOREJNB TI,$CLR TIAJMP MAIN
POWER_LOGGER: CJNE A,#032,CURRENT_LOGGERMOV SBUF,POWER_STOREJNB TI,$CLR TIAJMP MAIN
CURRENT_LOGGER: CJNE A,#064,SHOW_STATUSMOV SBUF,CURRENT_STOREJNB TI,$CLR TIAJMP MAIN
SHOW_STATUS: CJNE A,#099,SHOW_STATUS_1MOV STATUS_1,#071HMOV STATUS_2,#071H
-
8/10/2019 My Data Logger Body
44/45
44
MOV STATUS_3,#03FHAJMP MAIN
SHOW_STATUS_1: CJNE A,#199,SHOW_STATUS_EXITMOV STATUS_1,#037H
MOV STATUS_2,#03FHMOV STATUS_3,#040HSHOW_STATUS_EXIT: AJMP MAIN
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
SETUP_DATA_LOGGING: JNB RI,OUTMOV LOG_STORE,SBUFSETB SAMPLE_FLAGCLR RI
OUT: RETI
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;DISP_MASKLAY MASK SUBROUTINE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
DISP_MASK: INC AMOVC A,@A+PCRETDB 03FH ; Digit 0 mask 0C0HDB 006H ; Digit 1 mask 0F9HDB 05BH ; Digit 2 mask 0A4HDB 04FH ; Digit 3 mask 0B0HDB 066H ; Digit 4 mask 099HDB 06DH ; Digit 5 mask 092HDB 07DH ; Digit 6 mask 082HDB 007H ; Digit 7 mask 0F8HDB 07FH ; Digit 8 mask 080HDB 06FH ; Digit 9 mask 090H
BIN_DEC: MOV B,#10DIV ABMOV STORE_1,BMOV B,#10DIV ABMOV STORE_2,BMOV STORE_3,A
RET
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;DELAY SUBROUTINE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
8/10/2019 My Data Logger Body
45/45
DELAY_900_11: MOV DELAY_REG1,#02MOV DELAY_REG2,#168
_150_12: DJNZ DELAY_REG2,_150_12DJNZ DELAY_REG1,_150_12RET
DELAY_12KHz: MOV DELAY_REG1,#18Y_12KHz: DJNZ DELAY_REG1,Y_12KHz
RET
END