Sunteți pe pagina 1din 31

CHAPTER 1

INTRODUCTION
Intelligent control is a control theory tehnique that uses artificial intelligence in
process of controlling dynamical systems. Some types of intelligent control are
neural networks, fuzzy logic, machine learning, ant colony and genetic algorithm. In
this research, it will be discuss about use of genetic algorithm for tuning cascade PID
controller.
Since PID controllers perform in real-time, external disturbances are always present.
Cascade connection of PID controllers will be used to avoid those disturbances and
to keep controlling process optimal.
Genetic algorithm is a simulation of a process of genetic inheritance in nature. It is
effective way for transferring the best properties from generation to the next one. The
best fitting genes from both parents are selected and incorporated into new
generation.
Control theory is an interdisciplinary branch of engineering. and its essential part.
There is a controlling process as a part of every dynamical system. Effective control
makes the difference between feasible system and unfeasible one. PID control has
been used in many applications and its tuning process can be a major challenge. The
best fitting PID coefficients are needed for a system to have an optimal performance.
This analogy can be used for development of genetic algorithm, which as a result,
will have coefficients of PID controller. For these purposes, MATLAB tools will be
used.

After PID coefficient calculation, results will be analyzed and statistically processed,
pattern in result changes according to system requirement changes will be found, so
process of control will be kept optimal in situation of different input values.
At the end, practical implementation of cascade PID controlling process will be
performed using FPGA integrated circuit. FPGA will be programmed using Verilog
Hardware Description Language. System will be ready for practical application in
industrial control processes (motor drive cascade PID controller).

CHAPTER 2
CASCADE PID CONTROL
2.1 PID Controller
PID controller is feedback loop controller used in industrial control systems. It was
first introduced in 1939 and has remained the most widely used controller in process
control until today. An investigation performed in 1989 in Japan indicated that more
than 90 % of the controllers used in industries are PID controllers and its advanced
versions (Araki, 2005).
A PID controller calculates an error value as the difference between a measured
process variable and a set point. The controller minimizes the error by adjusting the
process variable.

Figure 2.1 Block Diagram of a PID Controlled Process


PID controller consists of three constant parameters: P - proportional to error
function, represents present error; I - integral of error function, represents past errors;
D derivative of error function, represents future errors. Manipulation of these
parameters shapes the response of the controller to an error; the degree controller
overshoots the set point, and the degree of system oscillation.
P=Kpe(t)
t

I =Ki e ( t ) dt
0

D=

Kdde (t)
dt

Two basic requirements are regulation (reaching given set point, disturbance
rejection) and command tracking (implementing set point changes). Specific criteria
for command tracking include settling time and rise time. An overshoot of the
process variable beyond the set point must not be allowed if it would be unsafe.
Otherwise, it must have an optimal value. Other processes must reduce the energy
consumption in reaching a new set point.
PID controller tuning is the adjustment of its parameters, P, I and D, to the optimum
values for the desired control response. Stability is a basic requirement, but various
4

systems have different behavior, so different requirements need to be met and


requirements may conflict with one another. If PID parameters are chosen
incorrectly, the controlled process output can be unstable. Stabilization of response is
required and the process must not oscillate for any combination of process set points
and conditions.
PID tuning is a major engineering challenge, even though there are up to three
parameters, because it must fulfill complex criteria of PID control. Various methods
exist and more sophisticated techniques are the subject of patents. PID controller
designing and tuning can be hard in practice, if conflicting targets such as high
stability and short transient are to be achieved. PID controller performance can be
improved by careful tuning. Initial designs need to be adjusted repeatedly until the
system performs as required
Some applications require only one or two actions to provide the appropriate system
control. This is achieved by setting unnecessary parameters to zero. PI controllers are
common, since derivative gain is sensitive to disturbances and noise and absence of
an integral gain may prevent the system from reaching its target value.
2.2 Cascade Control
Major advantage of PID controllers is usage of two PID controllers together to
improve better dynamic performance. This is called cascade PID control. In cascade
control there is a connection of two controllers with one controlling the set point of
another. First acts as outer loop controller, which controls the primary physical
parameters. Second acts as inner loop controller, which reads the output of outer loop
controller as set point, usually controlling a more rapid changing parameter. Cascade
control is used to achieve fast rejection of disturbances. The main purpose of using
cascade control as a strategy is to allow the secondary loop to control disturbances
before they can affect the primary loop.

Figure 2.2 Cascade PID Control Block Diagram


As shown in figure 2.2, controller C1 in the outer loop is the primary controller that
regulates the primary controlled variable y1 by setting the set-point of the inner loop.
Controller C2 in the inner loop is the secondary controller that rejects disturbance d2
locally before it propagates to P1. (Mathworks, 2014)

2.3 Motor as an Object of Control


Induction motors are the most important parts of every industry branch and they are
produced in large number. About half of the electrical energy generated in a
developed country is ultimately consumed by electric motors, of which over 90 %
are induction motors (Tze_Fun Chan, 2011). Induction motors have mainly been
deployed in constant-speed motor drives. The development of power electronics
devices and converter technologies has made possible efficient speed control by
varying the supply frequency, giving rise to various forms of adjustable-speed
induction motor drives (Tze_Fun Chan, 2011). There are advances in artificial
intelligence techniques and control methods, including genetic algorithm, neural
networks and fuzzy logics. Performance of induction motor can be improved with
these techniques. Since the 1990s, AI-based induction motor drives have received
greater attention and numerous technical papers have been published (Tze_Fun
Chan, 2011). Speed-sensorless induction motors have become as an important branch
of induction motor research. Some electric drive producers began to incorporate AIcontrol in commercial products.

CHAPTER 3
GENETIC ALGORITHM
Genetic algorithm is part of the class of evolutionary algorithms used in field of
artificial intelligence. Evolutionary algorithms are search and optimization methods,
based on the principle of natural selection in genetics. In general, any iterative,
population based approach that uses selection and random variation to generate new
solutions can be regarded as an EA. Genetic algorithms became known through the
work of John Holland in the early 1970s and was popularized by Goldberg in 1989
and, as a result, the majority of control applications in the literature adopt this
approach (Muhammet nal, 2013). Their applications include several types of
problems such as designing the communication networks, optimizing the database
query and controlling the physical systems. Thus, GA has become a robust
optimization tool for solving the problems related to different field of the technical
and social sciences (Muhammet nal, 2013).
3.1 Theoretical Foundations
GA scans the most suitable of the chromosomes that built the population in the
potential solutions space. It tries to balance two opposite objectives: searching the
best solutions and expanding the search space. During execution of GA, evolution of

a population of solutions (phenotype) leads toward set of better solutions of an


optimization problem. Each solution candidate has properties (genotype) which can
be mutated and altered. Solutions are usually represented as strings of bits in binary
code, but other encodings are possible. Coding method has a decisive effect on the
performance of the GA. (Whitley, 1994).
The selection usually starts from a population of randomly generated individuals
which represents first generation, and is an iterative process, with the population in
each iteration representing a new generation. In each generation, fitness of every
individual has been evaluated. The fitness is usually the value of the objective
function in the optimization problem being solved. Fit individuals are stochastically
selected from the current population and each individual's genome is modified,
recombined and possibly randomly mutated to form a new generation. The new
generation of candidate solutions is then used in the next iteration of the algorithm.
Usually, the algorithm terminates when either a maximum number of generations has
been produced, or a satisfactory fitness level has been reached for the population
(Michalewicz, 1996).
A typical genetic algorithm requires a genetic representation of a solution domain
and fitness function to evaluate the solution domain. When genetic representation
and fitness function are defined, GA proceeds to initialize a population of solutions
and then to improve it through repetitive application of the mutation, crossover,
inversion and selection operators.
Initially, many individual solutions are randomly generated to form a population. The
population size depends on the nature of the problem, containing several hundreds or
thousands of possible solutions. The population is generated randomly, allowing the
entire range of possible solutions. During each successive generation, a proportion of
the existing population is selected to breed a new generation. Individual solutions are
selected through a fitness-based process, where fitter solutions, according to a fitness
function, are typically more likely to be selected. The fitness function is defined over
the genetic representation and measures the quality of the represented solution and it
is problem dependent.

Next step is to generate a second generation population of solutions from those


selected through a combination of genetic operators, crossover and mutation. The
crossover operator can be described as exchanging two chromosomes chosen as the
parents. Crossover point number is one. The other important crossover method is
uniform crossover. In this method, each parents genes crossed over with different
probabilities (Syswerda, 1989). Mutation operator changes one or more genes in the
chromosome. Traditionally, mutation operator is used rarely. Usually, the crossover
probability (Pc) is chosen between 0.25 and 1, and mutation probability (Pm) is
chosen between 0.01 and 0.001 (Bck, 1993).
GA process is repeated until a termination condition has been reached. Terminating
conditions are:
- solution is found that satisfies minimum criteria
- fixed number of generations reached
- computation time reached
- the highest ranking solution's fitness is reached or has reached a point that
successive iterations no longer produce better results
- manual inspection
3.2 MATLAB Implementation
Genetic algorithm can be simulated and implemented with MATLAB tool. In the
toolbox, the ga function may be used as GAs fitness function to optimize a
MATLAB function (Mathworks, 2014). The basic steps of genetic algorithm are as
follows.
-

generate a random population of n chromosomes which have a proper form

for the problem


run fitness function; evaluate the fitness function using each chromosome in

the population.
evaluate results, if conditions are satisfied, then GA stops and outputs the best

chromosome of current population.


select two or more parent chromosomes from a population according to their
fitness (the better the fitness of a chromosome, the greater is its chance of
being selected).

with a crossover probability cross over the parents to form a new offspring, if

no crossover was performed, the offspring is an exact copy of the parents.


with a mutation probability mutate new offspring at each locus (position in

chromosome).
place new offspring in the old population to create a new population and use a
new generated population for a further run of the algorithm (Tze_Fun Chan,
2011).

10

CHAPTER 4
FPGA
4.1 General Notions
A field-programmable gate array is an integrated circuit designed to be fieldprogrammable by a designer. The FPGA configuration is generally specified using a
hardware description language. FPGA has large resources of logic gates and RAM
blocks to implement complex digital computations. FPGA contains programmable
logic components called logic blocks and a hierarchy of reconfigurable
interconnections that allow the blocks to be wired together. Logic blocks can be
configured to perform complex combinational, or simple logic functions like AND
and XOR.
Some FPGAs have analog features in addition to digital functions. A few FPGA have
integrated peripheral analog-to-digital converter and digital-to-analog converter.
Application of FPGA includes digital signal processing, software-defined radio,
medical imaging, computer vision, speech recognition, cryptography, bioinformatics,
computer hardware emulation, radio astronomy, metal detection and other areas.
4.2 DE2-115 Development and Education Board
11

The Altera DE2-115 Development and Education board was designed by


professors. It is an ideal vehicle for learning about digital logic, computer
organization, and FPGA. Featuring an Altera Cyclone IV 4CE115 FPGA, the DE2115 board is designed for university laboratory use. It is suitable for a wide range of
exercises in courses on digital logic and computer organization, from simple tasks
that illustrate fundamental concepts to advanced designs (Altera, 2014).

Figure 4.1 Altera Cyclone IV 4CE115 FPGA, the DE2-115

4.3 Verilog Hardware Description Language


Verilog is a hardware description language used to model electronic systems. It is
most commonly used in the design and verification of digital, analog and mixedsignal circuits.
Hardware description languages are different from software programming languages
because they include ways

of describing signal propagation time


12

and

sensitivity.Verilog's concept of wire consists of both signal values and strengths. This
system allows abstract modeling of shared signal lines, where multiple sources drive
a common net. When a wire has multiple drivers, the wire's value is resolved by a
function of the source drivers and their strengths.
A subset of statements in the Verilog language is synthesizable. Verilog modules that
conform to a synthesizable coding style can be physically realized by synthesis
software. Synthesis software algorithmically transforms the abstract Verilog source
into a net list, a logically equivalent description consisting only of elementary logic
primitives (AND, OR, NOT, flip-flops, etc.) that are available in a specific FPGA or
technology. Further manipulations to the net list ultimately lead to a circuit
fabrication blueprint (such as a bit stream file for an FPGA).

13

CHAPTER 5
EXPERIMENTAL RESULTS (GA FOR CASCADE PID)
5.1 The Model
Next demonstration shows a PID controller optimized by MATLAB GA function ga
when the control system is a Simulink model. To call Simulink model from
MATLAB, the model must be built, and then a MATLAB programming function is
used to call the Simulink model.
A Simulink model of a cascade PID control system is built, as shown in Figure 5.1.
Cascade PID control system will be optimized by GA. It has been simulated by a
Transfer function blocks. A Step block has been used to create a control reference.
An Out1 block has been used to export calculation results of the Simulink model.
The model has been saved with the filename PID_controller.mdl.
Parameters of cascade PID controller consist of three variables, P1, I1, D1=0 for
inner PID and P2, I2; D2=0 for outer PID. Parameters D1 and D2 are set to 0 to
avoid noise disturbances.

14

Figure 5.1 Cascade PID Simulink Model (modified) (Tze_Fun Chan, 2011)
5.2. Methodology
In order to call the Simulink model from MATLAB platform, a MATLAB function
Call_PID.m has been programmed (Appendix 1.).
In MATLAB/Simulink, there are two workspaces, one is named caller which stores
variable values of MATLAB function and other workspace is named as base which
stores variable values of Simulink model input and output. Because the ga function is
a MATLAB function, an assignin function is employed to transfer data between two
workspaces. In this way, the variable values may be exchanged between function
Call_PID.m and model PID_controller.mdl.
Overshoot variable is changeable, in range from 1 to 1.5 of an output signal
amplitude with 0.05 difference.
For loop calculates mean square error of the plant output and command reference R,
then error function has been evaluated.

15

The GA simulation has been performed in PID.m file (Appendix 2.). After GA
options and PID parameters boundaries have been set, value of fitness function has
been calculated and the plot has been drawn, as shown in Figure 5.2.

4.5

x 10

15

Best: 0.0516174 Mean: 1.23849e+15


Best fitness
Mean fitness

4
3.5

Fitness value

3
2.5
2
1.5
1
0.5
0

20

40

60

Generation

80

100

120

140

Figure 5.2 Genetic Algorithm Simulation Plot

5.3. Results for Various Overshoot Values


GA has been simulated for different overshoot values of PID controller output. It is
performed for each value (1.0 to 1.5 of a PID output signal amplitude, with 0.05
difference) ten times and the best fitting five fitness function values and
corresponding PID parameters have been used, as shown in Table 5.1. For every
overshoot value, one group of data has been chosen for statistical processing. For
these purposes, MATLAB function cftool has been used.

16

Table 5.1 Cascade PID GA simulation results

17

5.4. Curve Fitting Tool and Conclusions


After GA simulation has been performed, curve fitting function has been used to find
the pattern of cascade PID coefficients dependence on different overshoot values and
its mathematical formulation. MATLAB cftool function executes this task. Graphical
and mathematical form will help in better projection of system cascade PID control
process.

0.65

P1 vs. ovsh
untitled fit 1

0.6

P1

0.55

0.5

0.45

1.05

1.1

1.15

1.2

1.25
ovsh

1.3

1.35

Figure 5.3 P1 curve fitting

1
xb 2
(
( xb
)
c1 )
+a 2e c 2

P1=a 1e

Coefficients:
a1 =0.6402

b1 =1.204

c1 =0.3399

a2 =0.128

b2 =1.474

c2 =0.08749

18

1.4

1.45

1.5

3.5

I1 vs. ovsh
untitled fit 1

3.45
3.4
3.35

I1

3.3
3.25
3.2
3.15
3.1
3.05
3
1

1.05

1.1

1.15

1.2

1.25
ovsh

1.3

1.35

1.4

1.45

1.5

Figure 5.4 I1 curve fitting


2

( xbc 1 1 )

I 1=a1e

((xb 2)/ c 2)

+ a2e

Coefficients:
a1 =3.494

b1 =1.204

c1 =0.5045

a2 =0.5261

b2 =1.497

c2 =0.1026

4.6

P2 vs. ovsh
untitled fit 1

4.4
4.2
4

P2

3.8
3.6
3.4
3.2
3
2.8
2.6
1

1.05

1.1

1.15

1.2

1.25
ovsh

1.3

1.35

1.4

1.45

1.5

Figure 5.5 P2 curve fitting


P2=a 1sin ( b 1 x+ c 1 ) + a2sin ( b 2 x +c 2 ) +a 3sin ( b 3 x +c 3 )

19

Coefficients:
a1 =3.514

b1 =2.531

c1 =4.549

a2 =0.5879

b2 =23.36

c2 =-11.1

a3 =0.3774

b3 =36.43

c3 =3.348

0.18

I2 vs. ovsh
untitled fit 1

0.16

I2

0.14
0.12
0.1
0.08

1.05

1.1

1.15

1.2

1.25
ovsh

1.3

1.35

1.4

1.45

1.5

Figure 5.6 I2 curve fitting


I 2=a 1sin(b 1x +c 1)+a 2sin(b 2x + c 2)+ a 3sin (b 3x + c 3)

Coefficients:
a1 =0.1462

b1 =3.622

c1 =3.015

a2 =0.01066

b2 =15.48

c2 =-3.88

a3 =0.02843

b3 =36.9

c3 =1.825

Cascade PID controller coefficients P1 and I1 can be represented with Gaussian


normal distribution function. On the other hand, cascade PID controller coefficient
P2 and I2 can be represented with sinusoidal function. Their variation caused by
overshoot variation can be predicted and system can be controlled. GA results can
successfully be used for cascade PID controller tuning.

20

CHAPTER 6
PRACTICAL IMPLEMENTATION (FPGA & PID)
6.1. The Model
Digital computers are necessary part of a control system. It is essential to convert
real-world analog signals and its numerical representation to digital ones, so they
could be properly processed.
FPGA integrated circuit uses 16-bit digital representation of an analog signal
received after process of cascade PID tuning GA was performed. Digital display
shows 4-digit number, with each digit representing 4-bits. The number symbolizes
amplitude of an analog signal received from system response after PID controlling
process.
After starting value, representing overshoot amplitude of the signal, each switching
will change that value and it will represent oscillation process and decreasing will
represent settling process(Appendix 3).

21

Figure 6.1 FPGA board performing PID control

6.2. The Final System


Final system for cascade PID controlling process is ready. Results of GA simulation
used for cascade PID controller tuning will lead to required response of a system
being controlled. On the other hand, FPGA will perform digital conversion and
computer systems will be applicable in controlling process. The final system is ready
for practical implementation of an induction motor cascade PID control.

22

CONCLUSION
Intelligent control advance in last few decades has improved industrial process and
products in various branches. Many techniques have been used. As shown in this
research, GA can be used in process of cascade PID controller tuning with
satisfactory results in accordance with system requirements After GA simulation has
been performed, cascade PID controller coefficients have been calculate and the
controller have been tuned. Statistical processing of results has showed that pattern
exists and controlling process can be predicted for different input values and
requirements. Since system is feasible, it can be practically implemented using
FPGA controlled by a computer system. Cascade PID controller can be used in
process of induction motor drive control.
The research has shown that GA is advanced intelligent control technique that
improves process of design and development of cascade PID controller and its
tuning. As a consequence, process being controlled will be more accurate and
reliable.

23

REFERENCES
Altera. (2014). http://www.altera.com/.
Araki. (2005). Control System, Robotics and Automation - vol II - PID Control.
Kyoto: Kyoto University.
Bck, T. (1993). Optimal Mutation Rates in Genetic Search, Proceeding of the Fifth
International Conference on Genetic Algorithms. CL, USA.
Control Solutions, I. M. (n.d.). http://www.csimn.com/.
Mathworks, I. (2014). http://www.mathworks.com/.
Michalewicz. ( 1996). Genetic algorithms and data structures. Springer, USA.
Mitchell, M. (1996). An Introduction to Genetic Algorithms. Cambridge, MA: MIT
Press.
Muhammet nal, A. A. (2013). Optimization of PID Controllers Using Ant Colony
and Genetic Algorithms. Springer-Verlag Berlin Heidelberg.
Syswerda, G. (1989). Uniform Crossover in Genetic Algorithms. In: Proceeding of
theThird International Conference on Genetic Algorithms . NJ, USA.

24

Tze_Fun Chan, K. S. (2011). Applied Intelligent Control of Induction Motor Drives.


John Wiley & Sons (Asia) Pte Ltd.
Whitley, D. (1994). A genetic algorithm tutorial, Statistics and Computing 4 (2).

25

APPENDIX 1
Call_PID.m MATLAB CODE
function s= Call_PID(x)
assignin('base','P1',x(1));
assignin('base','P2',x(2));
assignin('base','I1',x(3));
assignin('base','I2',x(4));
[tout,xout,yout]=sim('PID_controller',200);
z=yout;
overshoot=0.1;
%Overshoot is expressed as a percentage of amplitude
s=0;
[m,n]=size(z);
%Evaluating the error function
if max(z)>1+overshoot
s=1/eps;
else
V=0;
R=1;
for i=1:m
V=V+(R-z(i))^2;
end
s=V/m;
end
end

26

APPENDIX 2
PID.m MATLAB CODE
clc;
%clear;
options=gaoptimset(@ga);
%Setting Genetic Algorithm options
options=gaoptimset(options,'PlotFcns',
{@gaplotbestf},'Display','iter');
options=gaoptimset(options,'PopulationSize',40);
options=gaoptimset(options,'EliteCount',10);
options=gaoptimset(options,'CrossoverFraction',0.6);
options=gaoptimset(options,'Generations',140);
options=gaoptimset(options,'MutationFcn',@mutationadaptfe
asible);
%Setting bounds for P and I components
lb=[0 0 0 0];
ub=[60 10 60 10];
%calling the function
[x,fval]=ga(@Call_PID,4,[],[],[],[],lb,ub,[],options);

27

APPENDIX 3
QUARTUS CODE FOR FPGA
module Edvin(SW, HEX0, HEX1, HEX2, HEX3);
input [2:0] SW;
output [6:0] HEX0, HEX1, HEX2, HEX3;
wire [15:0] x, e1, e2, y1, y2, r1, r2;
SI pravimoUlaz(SW[0], x);
//Write PI
PI vanjskiRegulator(r2, e2, SW[1],SW[2]);
defparam vanjskiRegulator.k1=6;
defparam vanjskiRegulator.k2=5;
PI unutrasnjiRegulator(r1, e1, SW[1],SW[2]);
defparam unutrasnjiRegulator.k1=6;
defparam unutrasnjiRegulator.k2=5;
PI prvaPolovina(y1, r1, SW[1],SW[2]);
defparam prvaPolovina.k1=1;
defparam prvaPolovina.k2=0;
PI drugaPolovina(y2, y1, SW[1],SW[2]);
defparam drugaPolovina.k1=1;
defparam drugaPolovina.k2=0;
assign e2=x-y2;
28

assign e1=r2-y1;
Disp7 Ispis(e2, HEX0, HEX1, HEX2, HEX3);
endmodule
module SI(prekidac, kabl);
input prekidac;
output [15:0] kabl;
assign kabl=150*prekidac;
endmodule

module PI
(output reg [15:0] u_out,
input signed [15:0] e_in,
input clk,
input reset);
parameter k1;
parameter k2;
reg signed [15:0] u_prev;
reg signed [15:0] e_prev[1:2];
//assign u_out = u_prev + k1*e_in-k2*e_prev[1];
always @ (posedge clk)
if (reset == 1) begin
u_prev <= 0;
e_prev[1] <= 0;
e_prev[2] <= 0;
end
else begin
//e_prev[2] <= e_prev[1];
//e_prev[1] <= e_in;
//u_prev <= u_out;
u_out = u_prev + k1*e_in-k2*e_prev[1];
u_prev = u_prev + k1*e_in-k2*e_prev[1];
29

e_prev[2] = e_prev[1];
e_prev[1] = e_in;
end
endmodule
module

Disp7(broj,

displej1,

displej2,

displej3,

displej4);
input [15:0] broj;
output [6:0] displej1, displej2, displej3, displej4;
Seg7 prvi(broj[3:0],displej1);
Seg7 drugi(broj[7:4],displej2);
Seg7 treci(broj[11:8],displej3);
Seg7 cetvrti(broj[15:12],displej4);
endmodule
module Seg7(sel,HEX);
input [3:0]sel;
output reg [6:0]HEX;
always@(sel)
begin
if (sel==0)
HEX=7'b1000000;
else if (sel==1)
HEX=7'b1111001;
else if (sel==2)
HEX=7'b0100100;
else if (sel==3)
HEX=7'b0110000;
else if (sel==4)
HEX=7'b0011001;
else if (sel==5)
HEX=7'b0010010;
30

else if (sel==6)
HEX=7'b0000010;
else if (sel==7)
HEX=7'b1111000;
else if (sel==8)
HEX=7'b0000000;
else if (sel==9)
HEX=7'b0010000;
else if (sel==10)
HEX=7'b0001000;
else if (sel==11)
HEX=7'b0000011;
else if (sel==12)
HEX=7'b1000110;
else if (sel==13)
HEX=7'b0100001;
else if (sel==14)
HEX=7'b0000110;
else if (sel==15)
HEX=7'b0001110;
else
HEX=7'b1010101;
end
endmodule

31

S-ar putea să vă placă și