You are on page 1of 25

Date Performed: March 10, 2017

Date Submitted: March 17, 2017

Laboratory 3 :
T-Bird Tail-Light Control Using a CPLD

L12E FRIDAY 8:35 AM

Nathan Fohkens (100946190)


Ugur Pekunsal (100997808)
Jonathan Arava (101007533)
Lab 3 -
Switching Circuits ThunderBird Tail-Light Control Using a CPLD March 17, 2017

TABLE OF CONTENTS
1.0 INTRODUCTION....3
2.0 SPECIFICATIONS.........4
3.0 DESIGN......5-11
3.1The Counter.........7-9
3.2 Left and Right control Box.......9-11
3.3 Complete Circuit....11
4.0 IMPLEMENTATION AND TESTING.....12-16
5.0 CONCLUSION....17
6.0 REFERENCES...18
7.0 APPENDIX....19-24

Page 2
Lab 3 -
Switching Circuits ThunderBird Tail-Light Control Using a CPLD March 17, 2017

1.0 Introduction
The purpose of the T-Bird lab is to successfully control the LED lights using the switches
on the complex programmable logic device (CPLD) as found on the light system on the Ford
Thunderbird ( T- Bird). In total there are 6 bulbs, 3 on each side. Signalling is done by individual
bulbs, sequentially lighting up after a delay in the desired direction then repeating the sequence.
The benefit of this design is that there is no need to get an additional bulb for the direction of the
signal as the delay in the individual bulbs take care of that by lighting the bulbs towards a
direction. This design is still being used for tail lights, currently in the Ford Mustang.
The circuit was implemented in the Xilinx ISE program and tested with both ModelSim
and iMPACT, programs that load the design files into the logic board. This report will go further
in depth regarding specifications, design, implementation and testing and conclusion.

Page 3
Lab 3 -
Switching Circuits ThunderBird Tail-Light Control Using a CPLD March 17, 2017

2.0 Specifications
In the overall design of the circuit there were 3 binary inputs as well as 2 outputs of 3 bits
each resulting in a total of 6 binary output-bits as shown in the table of Figure 1 below.

Figure 1: Inputs and Outputs of the T-Bird Tail Light control boxes.
Name # of bits Type Purpose Alias

Left - input 1 Binary Left turn signal if 1 L

Right - input 1 Binary Right turn signal if R


1

Brake - input 1 Binary Brake B


signal if 1

Left Bulbs 1,2,3 3 Binary Signal determining BULB_L1


- output the state of the three BULB_L2
left light bulbs BULB_L3

Right Bulbs 1,2,3 3 Binary Signal determining BULB_R1


- output the state of the three BULB_R2
right light bulbs BULB_R3

Intermediate inputs/outputs:
Figure 2: Intermediate Inputs and Outputs of the circuits used within the complete circuit

As in previous labs the overall design was simulated using the XLINX software available
at the Carleton University Labs. All of the inputs and outputs were modeled within ModelSim
and generated a complete representation of all possible input combinations along with their
individual corresponding outputs using the test bench available within the software as shown in
section 4.0 Implementation and Testing.
The circuit was limited to only the features available within the XLINX software used;
however there were no limitations noted with the lab. The only time limit was the time allotted
during the lab period however students were able to work on the lab on their own outside of the
given 3 hour lab period so long as the lab was not in use.

Page 4
Lab 3 -
Switching Circuits ThunderBird Tail-Light Control Using a CPLD March 17, 2017

3.0 Design
The design process first began with research to understand the operation of the original
turn sequence of the Thunderbird Tail-Lights. As seen in figure 3 below along with the resulting
waveform as shown in figure 4, the turn sequence could be understood as a bar filling up such
that each light is sequentially turned on and would remain on until all lights are activated at
which point the cycle has reached its final state and would then repeat starting with the initial
state of all lights off.

Figure 3: Right turn tail-light sequence of operation repeating at 2 second intervals

Figure 4: Waveform of the Thunderbird tail-light sequence

By following the base turn sequence, along with the following special conditions, one can
begin the process of designing a circuit that operates similarly to the original Ford Thunderbird.

Page 5
Lab 3 -
Switching Circuits ThunderBird Tail-Light Control Using a CPLD March 17, 2017

The design of the whole circuit was divided into four distinct parts as to allow the design
to be less complex and to also allow different portions of the circuit to be simultaneously
designed by multiple people.

1. COUNTER
1 Input: CLK
4 Outputs: LITE_1, LITE_2, LITE_3, Emerg
Using the circuit given that provided a clock cycle with a frequency of 1 Hz, the
counter circuit would output the four control signals to be used to time the
sequenced turn signals

2. LEFT and RIGHT CONTROL BOXs


7 Inputs: L, R, B, LITE_1, LITE_2, LITE_3, Emerg
3 Outputs: BULB_L1, BULB_L2, BULB_L3
Would output one of four states as determined by the inputs L, R, B:
i. All lights steady o ff
ii. Lights flash in sequence a s determined by COUNTER
iii. Lights all flash together as determined by COUNTER
iv. All lights steady o n

3. COMPLETE CIRCUIT
3 Inputs: L, R, B
6 Outputs: BULB_L1, BULB_L2, BULB_L3, BULB_R1, BULB_R2, BULB_R3
Would output such that it meet the following special conditions:
Turning on just one of L or R the tail lights on the appropriate side should flash for a turn
as determined by COUNTER
Turning on both L and R turns on the emergency flashers. Then all six lights flash on for
half-a-second and off for half-a-second. When L and R are both off, pushing B lights all
six lights
If L or R (not both) is on with B, the tail lights on the appropriate side should flash as for
a turn. The lights on the other side should be steadily lit to show braking
The steady brake light overrides the Emergency flashers

Page 6
Lab 3 -
Switching Circuits ThunderBird Tail-Light Control Using a CPLD March 17, 2017

3.1 COUNTER
The waveform pattern as shown previously in figure 4 has some similarities to the CLK
signal output by the clock divider provided such that:
- Emerg has the exact same waveform as the CLK
- Lite_3 is on every other time that the CLK is on, and only when Lite_2 is also on
- Lite_2 appears to hold the clock signal for one cycle on the falling edge of the CLK
cycle at half the frequency of the CLK
- Lite_1 has parts of its cycle that matches CLK and also Lite_2
The key part to notice is Lite_2 and what it means that its h olding a signal for a full clock cycle
and that its at specifically half t he frequency of the input CLK. The fact that a signal is being
held one should immediately be thinking that a Flip-Flop is involved somewhere and with it
running at half the frequency of its CLK input a divide by two circuit involving a flip flop is
required. By adding a divide by two circuit with the output of Q0 that is falling edge triggered the
waveform pattern as seen in figure 5 can generated which matches the outputs needed for the
T-Bird Tail-Lights.

Figure 5: Waveforms of COUNTERs 4 outputs


along with input CLK and an added D flip-flop signal Q0

From figure 5 the truth table shown in figure 6 can be constructed and from which
equations for the four outputs of CONTROL can be made using just CLK and Q0 as their inputs.

Page 7
Lab 3 -
Switching Circuits ThunderBird Tail-Light Control Using a CPLD March 17, 2017

Figure 6: Truth table for Lite_1, Lite_2, Lite_3, and Emerg with inputs Q0 and CLK

State Outputs

Q0 CLK
Lite_1 Lite_2 Lite_3 Emerg

0 0 0 0 0 0

1 1 1 0 0 1

1 0 1 1 0 0

0 1 1 1 1 1

(1)

(2)
(3)
(4)

Figure 7: COUNTER schematic implementing equations 1 -- 4 and the D flip-flop

Using equations 1--4 and a D Flip-Flop the schematic for the counter circuit can be
constructed as shown in figure 7. An additional input of RST is used so the flip-flop can be set to
a zero 0 state when testing.
Note: the software does not allow an input to be directly connected to an output so to
work around this any of the following gates could be used as seen in figure 8.:
- Two inverters connected in series
- One AND gate with either both inputs connected to CLK, or one input to CLK and one
input to constant power

Page 8
Lab 3 -
Switching Circuits ThunderBird Tail-Light Control Using a CPLD March 17, 2017

- One OR gate could be used connected similarly with either both inputs connected to
CLK, or one input to CLK and the other to constant ground.

Figure 8: Other possible gate configurations to not connect CLK directly to Emerg

3.2 LEFT and RIGHT CONTROL BOX


While there are many similarities between the left and right control boxes they dont work
exactly the same as one another so do need to be evaluated and designed separately. To
further break the circuit down into smaller individual circuits for each individual bulb.
The truth table as shown by figure 9 can be found by analysing the 8 possible input
combinations for the tail lights following the special conditions of the tail light operation using the
four unique states each bulb could be in as shown below:
1. OFF - All lights off - occurs when both L and B are off, changing R does not affect
state
2. LITE_1, LITE_2, LITE_3
- Lights flash in sequence a s determined by COUNTER - occurs when L is active
and R is off, or vice-versa; changing B does not affect state
3. EMERG
- Lights all flash t ogether - only occurs when L and R are both on and B is off
4. ON - All lights on - occurs when only B is on and when B L R are all on such that the
brakes override the emergency lights

Figure 9: Truth table of all tail-light bulb outputs


B L R BULB_L1 BULB_L2 BULB_L3 BULB_R1 BULB_R2 BULB_R3

OFF OF OFF OFF OFF OFF OFF OFF OFF


F

OFF OF ON OFF OFF OFF LITE_1 LITE_2 LITE_3

Page 9
Lab 3 -
Switching Circuits ThunderBird Tail-Light Control Using a CPLD March 17, 2017

OFF ON ON EMERG EMERG EMERG EMERG EMERG EMERG

OFF ON OFF LITE_1 LITE_2 LITE_3 OFF OFF OFF

ON OF OFF ON ON ON ON ON ON
F

ON OF ON ON ON ON LITE_1 LITE_2 LITE_3


F

ON ON ON ON ON ON ON ON ON

ON ON OFF LITE_1 LITE_2 LITE_3 ON ON ON

The equations found from the truth table were as follows:

Figure 10: Left Control Box - Only difference from Right Control Box highlighted

Figure 11: Right Control Box - Only difference from Left Control Box highlighted

Page 10
Lab 3 -
Switching Circuits ThunderBird Tail-Light Control Using a CPLD March 17, 2017

After simplification for these three bulbs, we derive that all three bulbs receive the same
controls from the B, L, and R switches. The actual timing of the lights are controlled by the
Counter, while the Control box just determines which bulbs will be lit for the sequences and
uses the Counters signals to light the bulbs. With the simplification of the equations, a
schematic was created that would serve as the design for the light sequences. This schematic is
shown in figure 11.

3.3 COMPLETE CIRCUIT


The final completed circuit that was provided.
Figure 12: Complete Circuit

Page 11
Lab 3 -
Switching Circuits ThunderBird Tail-Light Control Using a CPLD March 17, 2017

4.0 Implementation and Testing

The tail light circuit was first tested virtually on ModelSim. The circuit had a very limited
number of cases and it was relatively easy to test by manually checking every instance.
After an initial quick comparison of the values obtained from the simulation program, the
circuit was then written on the chipset and tested manually by using buttons as input and
observing a set of led lights which represented the tail lights.

The following test cases were simulated during the lab and the results can all be seen in
Appendix A (so things are kept clean!)

// Test 1: All off


B = 0; L = 0; R = 0;
// Test 2: Right signal on, Left off; starts at about 20 s (19.8s)
B = 0; L = 0; R = 1; // L and B remain at 0
// Test 3: Left on, Right on
B = 0; L = 1; R = 1;
// Test 4: Left only
B = 0; L = 1; R = 0;
// Test 5: Brake only
B = 1; L = 0; R = 0;
// Test 6: Brake and Right
B = 1; L = 0; R = 1;
// Test 7: (All on) Brake, Left, and Right
B = 1; L = 1; R = 1;
// Test 8: Brake and Left
B = 1; L = 1; R = 0;

Once the testing was completed and the logic used was deemed to be correct the
design was uploaded onto a Complex Programmable Logic Device (CLPD) to be tested
manually as well. The CLPD performed as expected and it was concluded that the design was
valid and meet all expectations.

Page 12
Lab 3 -
Switching Circuits ThunderBird Tail-Light Control Using a CPLD March 17, 2017

5.0 Conclusion
In this lab, a tail light circuit was designed using ISE project navigator. The circuits role
was to control a hypothetical cars brake lights/indicators. All of the objectives set in the
specification were accomplished. The testing was done using ModelSim, a virtual simulation
program, the circuit was later written on a chipset to test using physical buttons and lights.
2 control boxes were used in the design of the circuit, one for each side, left and right.
Also a counter to manage the half second delays between each sequence of indicating.
Instead of the traditional double inverters that were used for the counter signal, only 1
AND gate was used to keep the design simpler and more efficient by using less gates.
One possible improvement to the design would be the counter. Because of the time and
other resources limitations it wasnt possible to design the counter in a way that it would reset
every time indicators were activated. Instead the counter kept running in the background. When
the turn signals were activated the lights would begin at whatever sequence the counter
happened to be at as opposed to always starting at state zero with all lights off.

Page 13
Lab 3 -
Switching Circuits ThunderBird Tail-Light Control Using a CPLD March 17, 2017

References

[1] Robert C. Gauthier, Laboratory 3: T-Bird Tail-Light Control Using a CPLD, Department of
Electronics, Carleton University, March 17, 2017

[2] Robert C. Gauthier, Lecture slides, Department of Electronics, Carleton University, March 17,
2017

Page 14
Lab 3 -
Switching Circuits ThunderBird Tail-Light Control Using a CPLD March 17, 2017

Appendix A:
Figure 13: Test 1 - All Off

Page 15
Lab 3 -
Switching Circuits ThunderBird Tail-Light Control Using a CPLD March 17, 2017

Figure 14: Test 2

Figure 15: Test 3

Page 16
Lab 3 -
Switching Circuits ThunderBird Tail-Light Control Using a CPLD March 17, 2017

Figure 16: Test 4

Figure 17: Test 5

Page 17
Lab 3 -
Switching Circuits ThunderBird Tail-Light Control Using a CPLD March 17, 2017

Figure 18: Test 6

Figure 19: Test 7

Page 18
Lab 3 -
Switching Circuits ThunderBird Tail-Light Control Using a CPLD March 17, 2017

Figure 20: Test 8

Page 19
Lab 3 -
Switching Circuits ThunderBird Tail-Light Control Using a CPLD March 17, 2017

Appendix B:

Prelab

Page 20
Lab 3 -
Switching Circuits ThunderBird Tail-Light Control Using a CPLD March 17, 2017

Page 21
Lab 3 -
Switching Circuits ThunderBird Tail-Light Control Using a CPLD March 17, 2017

Page 22
Lab 3 -
Switching Circuits ThunderBird Tail-Light Control Using a CPLD March 17, 2017

Appendix C: Another pre-lab

Page 23
Lab 3 -
Switching Circuits ThunderBird Tail-Light Control Using a CPLD March 17, 2017

Page 24
Lab 3 -
Switching Circuits ThunderBird Tail-Light Control Using a CPLD March 17, 2017

Page 25