Professional Documents
Culture Documents
SIGNATURE
STUDENT ID
Table of Contents:
1.
ABSTRACT ............................................................................................................................................... 3
2.
INTRODUCTION ...................................................................................................................................... 3
3.
4.
TESTING ................................................................................................................................................. 27
4.1 TEST PLAN............................................................................................................................................ 27
4.1.1
InfiniiVision 4000 X-Series Multiple Signal Oscilloscope ......................................................... 27
4.1.2
Digital Multimeter ...................................................................................................................... 27
4.1.3
LCD Display............................................................................................................................... 28
4.1.4
PuTTY Terminal display............................................................................................................. 28
4.2 TEST SPECIFICATION ............................................................................................................................ 28
4.2.1
Part 1: Simple Voltage Measurements ....................................................................................... 28
4.2.2
Part 2: Counter .......................................................................................................................... 28
4.2.3
Part 3:PIC Processor To LCD and SRAM ................................................................................. 28
4.3 TEST CASE ............................................................................................................................................ 30
4.3.1
Part 1: Simple voltage Measurements ........................................................................................ 30
4.3.2
Part 2: Flow rate counter digital input measurement ................................................................ 30
4.3.3
Part 3:PIC Processor to LCD and SRAM, PuTTY Terminal ..................................................... 30
5.
6.
7.
1. Abstract
The goal of lab two was to create a measurement and collection system to record and display
4 types of measurements: salinity, carbon, flow rate and temperature. The system also would
implement a remote control unit that would communicate with multiple measurement units and
send, record and display measurement commands across a PC and store and read previous values.
In this report you will see how each part of this system was implemented starting from the design
specifications to the hardware and software designs. We tested varying input voltages simulating
carbon, salinity, and temperature voltage from a thermocouple as analog inputs and a digital flow
rate input simulated by square wave from a signal generator. Testing these using commands input
by a control pc for each reading and seeing correct values displayed on our pc and system LCD
display in the specified mapping and range of the design specifications. Finally, we analyzed the
results of these test for correctness and error and discussed our findings.
2. Introduction
In this project, we created a measurement and control unit using a pic microcontroller and c
programming to read measurement inputs for the 4 measurement types. We used op amps to
amplify simulated carbon and salinity input voltages and to amplify thermocouple temperature
voltage. We also used a 12-bit counter and and-gates to capture input flow rate from a signal
generator square wave. After inputs we programmed the pic to translate and map these values to
specified ranges and display them on an LCD. Next we implemented a controller unit also using a
PIC to select and transmit data between multiple measurement units. Using I2C protocol to
transmit and receive data between master control PIC and slave measurement PIC. We also
implemented RS-232 protocol on the controller pic to communicate with a PC for a user to input
desired measurement commands from a remote PC connected to the controller. Finally stored and
read measurement data to/from an SRAM. The tools we used to program the PIC was MPLAB
IDE and c language. Then used power supply, signal generators to power and input into the system
and mustimeters, oscilloscope and LCD display to test results. In the following discussion we
provide the details of the system for hardware and software.
The measurement results shall be presented on a LCD display. User choices are made via
PC remotely. Until remote system is active 2 Button select between 4 readings, 1 button select
for temperature conversion C to F.
3.1.2.1.4 System Functional Specification
The system is intended to make 4 different kinds of measurements taken from Voltage
readings and frequency readings. These measurements comprise of flow rate, temperature,
carbon, and salinity. The user should be able to change which sensor will be read. The user can
convert temperature readings from C to F. The system will be intended to be done remotely. The
system shall take in analog readings for temperature, flowrate, carbon and salinity. The system
will measure these readings and map them to an accurate and specified range. The system will be
selectable between different sensor reading options and display the selected reading on the LCD
display.
3.1.2.1.5 Operating Specifications
The system will be initiated with a reset signal to all reseting components
The system shall operate in the following reading areas.
Temperature: Between 0 to 20 C
Salinity: 5 to 50 ppt
Carbon: 10 to 350 ppm
Flow Rate: Between 100 to 1000 liters per second
Switches will control sensor reading to be displayed
3.1.2.2 Phase 2 Local Controlling Unit
3.1.2.2.1 System Description
The second phase deliverables will include a local controller, an I C based local area
network between the local controller and the measurement collection system, and an RS-232
protocol build between the local controller and a PC will be incorporated to complete the full
system. The local controller will be able to send commands from the PC to through the local area
network and then be able to receive and store data from the measurement processor.
2
3.1.3
UML Diagram
3.1.4
3.1.4.1 Phase 1
Read Temperature
o The user can see a current sample of temperature reading
o Exceptions - out of range below -30 Celsius or above +100 Celsius
Select Celsius or Fahrenheit
o Select between Celsius or Fahrenheit conversion
o Exceptions not in temp read mode
Read Salinity
o The user can see a current sample of Salinity content
o Exceptions - out of range below 5.0 PPT or above 50.0 PPT
8
3.1.4.2 Phase 2
Select Measurement Unit 1-7
o The user will be able to remotely select between 7 measurement units
Read previous 16 readings
o The user will be able to remotely select between the previous 16
measurements
o Exceptions if less than 16 measurements have been measured, only
recorded values
values. More importantly we used InfiniiVision 4000 X-Series MSO to analyze multiple digital
logic waveforms and analog oscilloscope waveforms which were vital in testing and accuracy of
our desired signals.
Table 1. Table of Tools Used for this Lab
Tool
InfiniiVision 4000 X-Series MSO
DC Power Supply
Function Generator
Digital Multimeter
Notepad++
MPlab IDE
PICKIT3
PuTTY
Purpose
Analyze real world digital logic waveforms.
Used Fixed +5V Rail to power circuit
Used to generate a clock pulse.
Used to troubleshoot by measuring analog voltages.
Text editor.
Program Pic Microprocessor
Hardware programmer/debugger for PIC processor
Terminal communication software for RS232 commands
3.2.2
value along with descriptive text to display on the LCD display. For the 2nd phase of this system
we design I2C protocol commands to transmit desired measurement to be received by the
measurement unit and output data transmitted of the reading value to be sent by the measurement
unit. All this would be implemented by coded functions that would be programmed onto the PIC
microprocessor.
3.2.4
11
Hardware Modules
We have two systems in place the measurement and collection unit and then the local
controller and LAN unit.
First amplification module made of Op-amps for amplifications of input signals for 3
voltage reading for carbon, salinity, temperature. Temperature voltage being fed into the op-amp
by a j-type thermocouple. The next module is for the flow rate sensor which is an 12-bit counter
clocked by an anded and controlled unknown flow rate(signal generator square-wave) and
controlled high pulse from the PIC microprocessor. These are the inputs to our system for
modeling measured readings. Our processing module which is done solely by the PIC
microprocessor and handles on the logic of the system. The last module on the measurement and
collection system is the display module which utilizes a shift register for consolidation and
serialization of some data out ports to the lcd, and the LCD unit itself which is the display for all
measurements.
On the local controller there are 2 hardware modules, the processing and data storage. For
processing communication and selection for and across LAN we again use the PIC microprocessor
for all logic. The second module for memory is made up again of a shift register for port
consolidation and and SRAM for storage of all necessary data.
12
For both local controller and measurement and collection device there was a 20MHz clock
implemented as input for both PIC processors on the system.
3.3.2
Software Modules
Our software modules on the measurement and collection are 4 separate mapping modules,
one for each sensor which map the input values from ADC or digital bus to designated range value
for each type of reading. The next module is an output to LCD module which takes in reading
value from the previous modules and translate that to characters and designated descriptive text
display for reading type and then outputs to the LCD. To conclude the measurement and collection
device software module is the I2C module which interprets selection of measurement device as a
slave acknowledges, and accepts commands for reading type and in turn sends out measurement
data across same interface.
On the local controller there are four software modules, first the RS-232 module which
interprets characters across the RS232 protocol from a master pc and determines measurement and
collection device selection and measurement type selection. Also in this module measurement and
status of request will be displayed back to the terminal using character values as displayed text
across this RS232 protocol. The second module is for I2C protocol to first send request to a slave
measurement and collection device receive acknowledgment and then send commands for what
type of measurement is desired. Also on this module is receiving and translating data sent back
from the slave as measurement data again all while conforming to the I2C protocol. The final two
modules are to store and read data to and from the SRAM this will take the data from transmitted
from the measurement and collection units and store upto the last 16 measurements and when
reading will take from the designated measurement type and device requested from RS232
commands and display on across the terminal the selected reading.
3.3.3
Public Interface
Our public interface will be master pc terminal which has a welcome screen and
predetermined greeting and instructions for set text input commands for selecting a measurement
device, selecting a measurement reading type, and reading from previous 16 measurements of
selected type and device. This same terminal will display textual readings from the selected
measurement and device. Also it will indicate connection and status of taking measurement and
read and store mode. On the individual measurement and collection device there is a LCD which
will also textually display current reading of selected measurement.
3.3.4
Inputs
Input Signal
Temperature
Size
ADC
Carbon
ADC
Salinity
ADC
Description
Input voltage represented by 10-bit ADC conversion after
amplification of an op amp, describes the voltage range of
temperature from a thermocouple temperature reading.
Input voltage represented by 10-bit ADC conversion after
amplification of an op amp, describes carbon voltage level input from
a modeled sensor reading
Input voltage represented by 10-bit ADC conversion after
amplification of an op amp, describes salinity voltage level input from
a modeled sensor reading
13
Flow Rate
10 bit
Textual
commands
Chars
3.3.5 Outputs
Output
Description
Signal
LCD TEXT Textual data representation for user to read measurement reading on a terminal
window, with descriptive information about readings
Terminal
Textual data representation for user to read measurement reading on a terminal
TEXT
window, with descriptive information about readings and commands
14
15
#define _c0
#define _c1
#define _c2
#define _c3
#define _c4
#define _c5
#define _c6
#define _c7
PORTBbits.RB0
PORTBbits.RB1
PORTBbits.RB2
PORTBbits.RB3
PORTBbits.RB4
PORTBbits.RB5
PORTBbits.RB6
PORTBbits.RB7
16
17
18
/* START TRANSMISSION */
if(_CLOCKI2C == 0) {
while(1) {
if(j == 8) {
break;
}
if(_CLOCKI2C == 1) {
command += (_IN_DATA << 7 - j);
j++;
while(_CLOCKI2C == 1) {
}
}
}
break;
}
Figure 9. Sending data to slave.
For the write function, the slave will send data to the local controller based on the clock. After
receiving the neg. edge, it would then shift the data to the command and increment. Data sent
through will be sent one bit a time, where the local controller will interpret and read the results to
SRAM.
3.4.2.2 Local Controller
The first part of implementing the Local Controller would be to receive commands through
the RS232 and interpret the data. As shown in Figure 10, we first receive the data after waiting
4750 bps and then receiving the data at a rate of 9600 bps. This ensures that we wont receive data
immediately on the clock edge.
19
void getRX() {
/* HALF DELAY */
delay_9k6();
delayTX9k6();
rx0 = _RX;
delayTX9k6();
rx1 = _RX;
delayTX9k6();
rx2 = _RX;
delayTX9k6();
rx3 = _RX;
delayTX9k6();
rx4 = _RX;
delayTX9k6();
rx5 = _RX;
delayTX9k6();
rx6 = _RX;
delayTX9k6();
rx7 = _RX;
}
Figure 10. RX data received.
After receiving the data from the RS-232, we can then interpret the data. When interpreting
the data, we could map the character received to w to be able to write the measurement data and
then press f,c,t, or t to select the data for the slave. Then by pressing r , the user can then
receive data from the slave. By pressing r, the local controller will then receive 16 data values
which can then bet written to the SRAM. Shown in Figure 11, is the code to interpret the received
data from the console.
20
getRX();
storedChar = getRXChar();
writeTXc(storedChar);
if(storedChar == 'w') {
/* writing */
writeI2C_slave_address(2, 0);
} else if (storedChar == 'f') {
writeI2C_data(0);
readingVar =0;
} else if (storedChar == 'c') {
writeI2C_data(1);
readingVar = 1;
} else if (storedChar == 's') {
writeI2C_data(2);
readingVar = 2;
} else if (storedChar == 't') {
writeI2C_data(3);
readingVar = 3;
} else if(storedChar == 'r') {
writeI2C_slave_address(2, 1);
writeTXnl();
strcpypgm2ram(buf, "RECIEVING DATA FROM SLAVE...");
writeTXsln(buf);
delayMS(100);
for(j = 0; j < 32; j++) {
readI2C(j);
}
writeToSRAM();
Figure 11. Interpreting Console Data and Writing to the SRAM.
To write directly through to the I2C line, we have to first set a pulse signal (the clock) and
then output the data to the data line. Shown in Figure 12is how we set the clock and the output.
21
delayMS(100);
_OUT_DATA = 0;
delayMS(50);
_CLOCKI2C = 0;
/* CLOCK */
delayMS(50);
_OUT_DATA = (c >> 7) & 0x01;
delayMS(50);
_CLOCKI2C = 1;
delayMS(25);
_CLOCKI2C = 0;
delayMS(50);
_OUT_DATA = (c >> 6) & 0x01;
delayMS(50);
_CLOCKI2C = 1;
delayMS(25);
_CLOCKI2C = 0;
Figure 12. Writing to I2C Network.
Do note that in Figure X10s data it is being sent 8 times and as such only 2 clock pulses are
shown in Figure 13.
To read through the I2C network, it is sent in a similar manner, data bits are being sent 8 times
with a generate clock cycle. Shown in Figure X11, is how we read through the I2C network.
toggleReadI2C();
byte[i] = 0x00;
/* init values */
delayMS(100);
_CLOCKI2C = 0;
delayMS(100);
_CLOCKI2C = 1;
delayMS(100);
byte[i] +=_IN_DATA;
_CLOCKI2C = 0;
delayMS(100);
Figure 13. Reading through the I2C Network.
Then to write to the SRAM we have to get the address by the following formula:
Address = (slave Number * 128) + (read Number *32) + (measurement Number*2);
After setting the address location, we can then just set the data byte directly to the SRAM as
shown in Figure 14.
22
Block Diagrams
23
Part No.
Description/Purpose
20 Mhz oscillator
OSC-20
12-bit Counter
CD4040B
And Gate
CD4081
Non-inverting Opamp
UA741CN
PIC Microprocessor
18F25K22
Shift register
C595N
LCD Display
HD44780
SRAM
CY7C128A
SRAM
RS-232 adapter
MAX232
24
3.5.2
Thermocouple
A J-type thermocouple wire was used to provide a voltage for temperature measurement.
This measurement temperature difference would be in the microvolt range so would need
amplification for measureable values input into our measurement system.
3.5.3 Amplifying
We used to 3 Op-Amps UA741CN chips to amplify the voltage signals of the 3 inputs for
modeled measurements of carbon, salinity and actual thermocouple temperature voltage. We
designed the op-amp circuit to have different gains using the below picture as reference and
specified resistor values to reach gains of 20, 15, and 1000 respectively. We also flipped the input
voltage references to cancel out the inversion of the inverting op-amp design.
20000
1000
15
15000
1000
1000 1000000
1000
25
wave for the set amount of 100 ms which we input into a CD4040b 12-bit counter clock input.
This 12-bit counter was also connected to +5v power and 0v ground and 10 bits of output were
connected on a digital input bus to the pic microprocessor. Also a reset input signal to the counter
was set after collecting any sample by and from the PIC microprocessor. This flow rate system
allowed for a count which could processed and calculated in software to measure frequency or
simulated flow rate.
3.5.5
Shift Registers
The C595N shift register was used importantly on our data busses to consolidate pins and
allowed for us to economise pin usage. We simply used 4 pins 2 clocks for generated from the
PIC processor and 1 serialized data pin and an output enable control pin also generated by our
PIC processor.
3.5.7
LCD
The LCD we chose was a standard HD44780 2x16 display. It allowed us to write ascii
characters to display our measurement readings. We connected control pins and data pins from the
Measurement unit processor along with +5v power and 0V ground and used software in the
processor to encode the characters we wanted to display. We were able with the 16 characters on
one line to display description of the reading along with value of no more than 5 digits and units.
3.5.8
26
3.5.9 SRAM
One CY7C128A 2048x8 SRAM chip was used as memory for writing to and reading
from measured data.. This chip was provided in the EE 475 lab kit. This chip has 11-bits inputs
for the address lines connected by the register from the counter. It also has 8 data input/output bits,
which is input by the tri state buffer when being written and as output when being read. It has 3
control inputs CE (chip enable) active low used when using multiple SRAMs which we connected
to ground for the purposes of this lab as it is the only memory chip we will be accessing. WE
(writeEnable) and OE (outputEnable) which were inputs from our state machine and were active
low. These signals were offset to WE active OE not active when writing to the SRAM and WE not
active and OE active when reading from the SRAM otherwise they were both set to not active by
the state machine. Finally, VCC and GND were connected to 5V power and 0V ground
respectively to power the chip.
4. Testing
The testing of the design was broken up into three segments, all of which contributed to the
testing process: (1) Test Plan, (2) Test Specifications, and (3) Test Cases. The test cases are
developed based on the specifications of the test for the general test plan for each testing tool. The
results of the test are shown in Section 5.
Digital Multimeter
The following steps were used for testing with digital multimeter in order to run test on
single channel voltages:
1. Determine the desired pin to measure.
2. Set voltage reading
27
3.
4.
5.
6.
4.1.3
LCD Display
Testing for final output of the measurement and collection unit we use its display
capabilities to determine correct output. You select measurement unit and measurement type and
then read textual output
4.1.4
Part 2: Counter
Verify the activity indicators for all 12 Digital Channels
Change the view to that of a Bus and back.
Display in HEX then back to binary.
Working with the users guide, configure the Pattern Trigger to trigger on the state binary
3 of the counter.
2. Modify the Pattern Trigger to trigger on the rising of bit 2 of the counter.
3. Change the view to that of a HEX Bus and configure the Pattern Trigger to trigger on the
state HEX A8 of the counter.
4. Configure the OR Trigger to trigger on the rising edge of counter bits 2, 4, or 6.
4.2.3
28
29
Carbon
5mV-250mV
20mV-5.0V
Salinity
100mV-300mV
2.5V-4.5V
Temperature
.400mV-2.700mV
400mV-6.0V
30
The measured results for input sensor voltages test were measured to be in specified ranges
for both carbon and salinity sensors as we used a DC supply to model and input voltage at desired
ranges, after amplification of gain of 20-15 respectively we saw correct amplification readings and
results. For temperature although we saw specified microvolt ranges the amplification was not a
consistent gain of 1000 as the it seems the low voltage input would not give an accurate and
measurable input voltage to the op amp circuit. Therefor the op-amp amplification would
sometime vary from being a consistent 1000 gain amp. We adjust for the small range of of
measureable temperature differences and settled the amplification, then mapped this to a range of
values consistent with the actual temperature as measured by a temperature gun.
31
Default State
Analysis of Default state was that we were getting correct values for clock and data input
when not in use as both signals would be set high. The trigger for any start of communication
would be a low trigger as described in next section.
Write Function would trigger by a low data value on that data line driven by the master PIC
processor and then a pulsing clock signal from the master and corresponding bits would we set up
by a master PIC processor the values sent across so following bits would be verified for correct
implementation and an acknowledgement final data bit would test for communication on I2C.
32
33
34
35
36
38
Clock
Flow Rate
Carbon
Salinity
Temperature
I2C Data
I2C Clock
SA0 Result
When the input is stuck on 0, the entire system will not operate. This is
because the input signal is an active low signal. If the power is also off while
the reset is off, then the entire system will be powered off yielding an output
of 0 on all lines. If the power is on, then the output of the system will yield
unstable and undeterminable results.
If Clock is stuck at 0, the entire system will fail, the system will never be able
to execute an operation. The system is dependent on a pulsing clock to be able
to move on an execute the program that is programmed on the PIC system.
If the flow rate temperature is stuck a logical 0, then the counter will NEVER
start counting and as a result the count on the flow rate will ALWAYS yield 0.
This result is too low to be mapped and as a result the LCD display will display
an ERROR describing it as too low to be considered as a result. Additionally,
the system will not log that as information and will indefinitely wait until 16
actual measurements are created that are in the bounds of our system
description.
If the carbon is stuck a logical 0, then based on the mapping from described in
our design procedure, it will yield a result that is too low to be mapped and as
a result the LCD display will display an ERROR describing it as too low to be
considered as a result. Additionally, the system will not log that as information
and will indefinitely wait until 16 actual measurements are created that are in
the bounds of our system description.
If the salinity is stuck a logical 0, then based on the mapping from described in
our design procedure, it will yield a result that is t0o low to be mapped and as
a result the LCD display will display an ERROR describing it as too low to be
considered as a result. Additionally, the system will not log that as information
and will indefinitely wait until 16 actual measurements are created that are in
the bounds of our system description.
If temperature is stuck a logical 0, then based on the mapping from described
in our design procedure, it will yield a result that is t0o low to be mapped and
as a result the LCD display will display an ERROR describing it as too low to
be considered as a result. Additionally, the system will not log that as
information and will indefinitely wait until 16 actual measurements are created
that are in the bounds of our system description.
If the I2C data line is stuck at logical 0, then at the moment that it became 0,
the unit will start checking and waiting for the I2C clock to start rising and use
it to catch data and check the addressing for the communication to the master.
That being said the unit will indefinitely wait for a clock edge and the system
is now stuck in an eternal wait.
If the I2C clock line is stuck at logical 0, then nothing will happen. The clock
line does not trigger anything by itself. However, if the I2C data line is also 0
then the clock line will be responsible for advancing the system forward out of
its eternal wait.
39
Carbon
Salinity
Temperature
I2C Data
I2C Clock
SA1 Result
When the input is stuck on 1, the entire system will be operational. This is
because the input signal is an active low signal. The system will begin
behaving as programmed and described in the system description.
If Clock is stuck at 1, the entire system will fail, the system will never be able
to execute an operation. The system is dependent on a pulsing clock to be able
to move on an execute the program that is programmed on the PIC system.
If the flow rate temperature is stuck a logical 1, then the counter will NEVER
start counting and as a result the count on the flow rate will ALWAYS yield 0.
This result is too low to be mapped and as a result the LCD display will display
an ERROR describing it as too low to be considered as a result. Additionally,
the system will not log that as information and will indefinitely wait until 16
actual measurements are created that are in the bounds of our system
description.
If the carbon is stuck a logical 1, then based on the mapping from described in
our design procedure, it will yield a result that is too low to be mapped and as
a result the LCD display will display an ERROR describing it as too high to be
considered as a result. Additionally, the system will not log that as information
and will indefinitely wait until 16 actual measurements are created that are in
the bounds of our system description.
If the salinity is stuck a logical 1, then based on the mapping from described in
our design procedure, it will yield a result that is t0o low to be mapped and as
a result the LCD display will display an ERROR describing it as too high to be
considered as a result. Additionally, the system will not log that as information
and will indefinitely wait until 16 actual measurements are created that are in
the bounds of our system description.
If temperature is stuck a logical 1, then based on the mapping from described
in our design procedure, it will yield a result that is t0o low to be mapped and
as a result the LCD display will display an ERROR describing it as too high to
be considered as a result. Additionally, the system will not log that as
information and will indefinitely wait until 16 actual measurements are created
that are in the bounds of our system description.
If the I2C data line is stuck at logical 1, then the system will not do anything,
because by default the data line is stuck at a logical 1. This means if any
communication needs to be done and the data line is stuck at 1, the
communication will never begin and as a result the system will not
acknowledge a transmission ever occurring and will indefinitely wait for a low
pulse to start the communication.
If the I2C clock line is stuck at logical 1, then nothing will happen. The clock
line does not trigger anything by itself. However, if the I2C data line is also 0
then the clock line will be responsible for advancing the system forward out of
its eternal wait.
40
Clock
RS232 RX
I2C Data
SA0 Result
When the input is stuck on 0, the entire system will not operate. This is
because the input signal is an active low signal. If the power is also off while
the reset is off, then the entire system will be powered off yielding an output
of 0 on all lines. If the power is on, then the output of the system will yield
unstable and undeterminable results.
If Clock is stuck at 0, the entire system will fail, the system will never be able
to execute an operation. The system is dependent on a pulsing clock to be able
to move on an execute the program that is programmed on the PIC system.
If the RS232 RX line is stuck at logical 0, then the entire system will
indefinitely and eternally always read character 0x00 as an input character. The
system will echo at character 0x00 indefinitely at rate of 960 Hz. Other than
echo back the character 0x00, the system will print out an ERROR message
stating that the user needs to input a valid command character for a command.
As a result, while the signal is stuck at logical 0, then the entire system will
print out an error message indefinitely eternally.
While the system is retrieving data from the slave because of a read operation,
if the I2C data is stuck at logical 0, then the master will be reading the data bit
0 indefinitely. However, this is controlled by the I2C Clock line, when the edge
is pulsing.
41
I2C Data
SA0 Result
When the input is stuck on 1, the entire system will be operational. This is
because the input signal is an active low signal. The system will begin
behaving as programmed and described in the system description.
If Clock is stuck at 1, the entire system will fail, the system will never be able
to execute an operation. The system is dependent on a pulsing clock to be able
to move on an execute the program that is programmed on the PIC system.
If the RS232 RX line is stuck at logical 1, then the system will never read any
character from the RS232 communication system, as a result if a transmission
were to occur and the PIC is supposed to receive characters, then the PIC would
not receive any characters because the start bit can never start which is the
catalyst for the transmission line (the logical 0 start bit).
While the system is retrieving data from the slave because of a read operation,
if the I2C data is stuck at logical 1, then the master will be reading the data bit
1 indefinitely. However, this is controlled by the I2C Clock line, when the edge
is pulsing.
5.5.2 Hardware
Throughout the entire project hardware wiring was an issue that became apparent. Most of the
time the wiring for the project was perfect and there wasnt that many times needed to actually
rewire things. However carefully, selecting the location for a chip to be placed was important for
the wiring of our system. The system consisted of custom wire that was stripped down to have a
perfect length that was as minimal as possible to prevent a signal integrity issue from occurring
due to the length of wire and the parasitic capacitance and inductance properties of wire.
However, when stripping down these wires it was difficult to place all of the strands of the
wires into a dip slot in the solderless bread board. As a result, when dealing with the RX and TX
wires for RS232 chip it was important to have the connection as clean as possible. This was to
ensure that the signal from the computer was perfect because at a frequency of 9600 and the delay
42
function made in the software implementation (roughly 9570 Hz) any amount of noise could mess
up the transmission and cause the RX and TX transmission to fail completely.
The integrity of the wiring was not as tight for the I2C communication since we were using a
smaller frequency but it was still slightly important to have good contact to have clean signal
transmission for the communication between slave and master.
When designing the op amp circuit there were many problems with the temperature op amp
which had a gain of 1000. Because the input voltage was so small any slight change in input could
easily swing the output of the amplifier. This was because the op amp used was not meant for such
delicate input voltages that were in the 100s of micro volt range. This was accommodated by using
capacitors at the output stage to hold the voltage for a while to reduce the amount of noise cause
from electrical properties due to electrical magnetic interference from the airwaves and other
natural occurrences. Signal integrity was also important and as a result we made the wires as short
as possible to prevent that from causing any issue.
Another issue we faced related to hardware was accurately connecting the wire to the
corresponding pins. A couple times in the lab, we were placing wires one slot away from the actual
slot that was required to make the connection. This was most likely due to the fact that we were
getting tired these errors were really hard to identified, but by the end we realized that this was a
common problem and we consistently checked each other on wiring.
Other than the issues mentioned earlier, there were no big hardware issues. We spent a lot of
time making the circuit as tight and clean as possible to prevent any signal integrity problems and
just make the circuit look neat and clean. We are quite proud of the presentation of our project.
The possible errors that we couldve faced include many things. If we didnt spend the time
making the wiring as tight and clean as possible, we couldve had issues with signal integrity. We
also couldve had errors when transitioning the project from one place to another, because the wire
would be loosely connecting making it prone to being disconnected accidently. Additionally, not
grounding certain ports could cause an error as well. On top of not grounding certain ports, not
carefully connecting all the ports in an IC chip could cause an error. Furthermore, reading the
specification of the ports in the data sheet was also an important factor because if the ranges arent
within specification this could cause an error. Therefore, the biggest take away in hardware was
making sure the wiring is tight and reading the datasheet for all IC chips used to ensure that the
system is behaving correctly because the chips are properly hooked up and used properly in its
specified range.
43
and protocol and from PC to local controller and from master local controller to slave measurement
unit over I2C protocol. We implemented these function using our software design PIC
microprocessor for the local controller in conjunction with the previous pic microprocessor from
the measurement unit. Correct transfer of data would be evident by display on the master pc
terminal which we implemented for RS-232 communication and user interface. Finally, with added
the feature to store and read previous readings by writing and reading to an SRAM and using
master pc commands to display these recorded values. We went through the design cycle of
implementing high level design with block diagrams and to real circuit implementation and
software coding and programming onto PIC processors. Then we would test expected and recorded
results at each module level in order to verify correct functionality of each subsystem. Once all
systems were would have correct functionality we could combine the system for general use and
debugging. Finally, and importantly we continued to document design, implementation, and
testing for record of our design cycle system development. We presented a final project demo and
supporting documentation for desired outcomes and shortfalls and analysis of measurement and
collection system. This was culmination of our real product development and design cycle lab.
In conclusion, the difficulty of this lab was figuring out how to model and use the PIC
microprocessors.
CONTRIBUTIONS
Jeffrey Nguyen
Jesus Sandoval
Minhhue H. Khuu
44