EX4 DIGITAL CIRCUITS AND SYSTEMS

ukrainianlegalElectronics - Devices

Nov 2, 2013 (3 years and 9 months ago)

113 views

EX4
: Setting up application
s with microcontrollers





1





EX4 DIGITAL CIRCUITS AND SYSTEMS


Setting up applications with microcontrollers

1.1

Cooperative group

TEAM NUMBER: ___________

DUE DATE: ________________






1
st

review due date: ______________

Instructor general comments:





STATEMENT:

My signature below indicates that I have (1) made an equitable contribution to EX4 as a member of the group,
(2) read and fully agree with the

contents (i.e., results, conclusions, analyses, simulations) of this document, and
(3) acknowledged by name anyone outside this group who assisted this learning team or any individual member
in the completion of this document.


Today’s date: _____________
_____


Active members













Roles: (reporter, simulator, etc.)

(1)

________________________________________


_______________

(2)

_________________________________________


_______________

(3)

_________________________________________


_______________





Ackno
wledgement of individual(s) who assisted this group in completing this document:

(1)

_______________________

(2)

_______________________



1.2

Abstract

Explain the most significant developments, results or conclusions about the exercise here. Use the remaining
space on this sheet (200 words maximum).


(
This section is mandatory. You must complete it to get a mark.)







EETAC


CSD: Digital Circuits and Systems




2

CONTENT

Setting up applications with microcontrollers
................................
................................
................................
.......

1

1.1

Cooperative group

................................
................................
................................
................................
....................
1

1.2

Abstract

................................
................................
................................
................................
................................
......
1

1.3

Description
................................
................................
................................
................................
................................
.
3

1.4

Topics

................................
................................
................................
................................
................................
.........
3

1.5

Analysis 1
: a combinational circuit

................................
................................
................................
.......................
5

1.5.1

Installation of the Microchip MPLABX and XC8 Compiler

................................
................................
...

5

1.5.2

Some theory on microcontrollers PIC

................................
................................
................................
........

5

1.6

Project 1
: a combinational circuit

................................
................................
................................
........................
10

1.7

Analysis 2
: Coding C language in FSM style and I/O interfaces using interrupts
................................
......
10

1.8

Project

2
: A sequential system

................................
................................
................................
.............................
11

1.9

Microcontroller development boards and In
-
Circuit debuggers
................................
................................
.....
12

1.10

Project 3
: A counter for the PICDEM2 Plus board

................................
................................
..........................
12

1.11

A complex system using LCD and Timer0 peripherals
................................
................................
..................
12

1.11.1

Project 4
: LCD display
................................
................................
................................
................................

12

1.11.2

Project_5
: Timer0 peripher
al

................................
................................
................................
....................

13

1.12

Problem solution
................................
................................
................................
................................
.....................
15

1.12.1

Analysis 1: The basics of microc
ontrollers

................................
................................
..............................

15

1.12.2

Project 1: A combinational circuit. Basic digital I/O

................................
................................
............

15

1.12.3

Analysis 2: Interrupts from buttons and switches. Programming in FSM style.

...............................

16

1.12.4

Project 2: A counter

................................
................................
................................
................................
.....

16

1.12.5

Project 3: Let ’s implement the counter in a PICDEM2 Plus training board

................................
....

17

1.12.6

Project 4: Let ’s use the LCD display

................................
................................
................................
........

17

1.12.7

Project 5: Sound wave generation. Timer0 peripheral
................................
................................
..........

18

1.13

References
................................
................................
................................
................................
................................
19

1.14

Study plan to solve the exercise

................................
................................
................................
...........................
19

1.15

Topics and activities checklist
................................
................................
................................
..............................
20

1.16

Grading grid

................................
................................
................................
................................
............................
21

1.17

Questions in solving EX2
................................
................................
................................
................................
......
22

1.18

Improvements to the exercise based on the review and correct ion
................................
................................
23




EX4
: Setting up application
s with microcontrollers





3


1.3

Description

This exercise will establish the basics for working with microcontrollers for the remaining of the term. Instead of
continuing Chapter III trying, for instance, to design other more complex subsystems or even our own
microprocessor like many books in VHDL
does, we are going to
buy

a commercial one and program it using C.
Programming in assembler, which is a language much more hardware
-
dependent, taking into account the amount
of time left in the course, would be far more difficult than doing it in C. If the

assembler language is of your
interest, you can learn it later on in an autonomous way once achieved the goals of this subject.

Therefore, in this Chapter IV, the idea is to build applications replacing the “hardware programming” of FPGA
and PLD by “soft
ware programming” a microcontroller. The concept of a
microcontroller

consists of a
complete computer architecture into a single chip: microprocessor, data and program memory and input
/output
peripherals.

There are a wide range of commercial microcontrollers to choose from in order to learn the basics and start
applying them to build simple applications. We have decided to pick up the PIC18F family of flash
microcontrollers from Microc
hip, one of the leading vendors. However, everything to be designed can be easily
migrated to the PIC16F technology (the family used in other semesters) or to other vendor’s microcontrollers
(Atmel, Philips, Texas Instruments, Zilog, Hitachi, etc.)

We wil
l proceed in five steps: (1) some theory on the PIC18F452 microcontroller architecture; (2) installing the
integrated programming environment MPLAB from Microchip to compile the code, debug and configure the
chips; (3) the hardware to implement prototypes

and the way to run simulations in Proteus
-
VSM of analogue and
digital circuits which include microcontrollers; (4) a known framework for developing projects based on our
FSM style from the previous Chapters II and III; (5) a kick off exercise that will co
nsist of the design of a simple
FSM or sequential system.


1.4

Topics

The following topics have been listed from the course’s specific and cross
-
curricular learning objectives
1
: #13,
#14. After studying

Chapter 4 and successfully completing all the assignme
nts in this task, you will be able to:


-------------

The theory and the Microchip and Proteus tools

-------------


1.

Draw the typical design flow for a microcontroller
-
based application: concept, hardware, program
flow diagrams, coding in assembler or C,
Proteus VSM simulation, prototype using an evaluation
board, verification, in
-
circuit debugging or microcontroller emulation, PCB design and production.
Install a microcontroller development environment like the MPLAB which include the C compiler.

2.

Identify

and list commercial microcontrollers and their manufacturers. Search books and the
Internet to analyse information about microcontroller chips and their applications (web portals or
electronic magazines on the subject of microcontrollers).

3.

Explain the b
asics of a microcontroller
-
based embedded system. Architecture of a computer (CPU,
memory, peripherals). Harvard architecture of an 8
-
bit microcontroller like the PIC18F4520.
Explain why a microprocessor (CPU) can be considered a programmable dedicated pro
cessor from
Chapter III. Explain the roles of the EEPROM/FLASH program memory and the RAM memory.

4.

Explain the basic concepts of the C compiler. From C language to assembler. Disassembling.
Advantages and drawbacks of C language and assembler.

5.

Analyse simp
le applications in assembler or C and deduce the program flowchart from the written
code: a combinational circuit (Chapter I). Explain the way to program I/O ports. Run Proteus
-
VSM
simulations of microcontroller circuits.


-------------

Applications in our

FSM style and interrupt

-------------

6.

Analyse and simulate counters or other sequential circuits based on microcontrollers (Chapter II).
Explain the way to handle interrupts, in particular, the ones for the PIC18F midrange family of
microcontrollers.
Explain how to handle interrupts from buttons or switches.

7.

Explain the main characteristics of a training board like the PICDEM 2 Plus.





1

http://epsc.upc.edu/projectes/ed/CSD/units/Guia_docent_E1_v2.pdf


EETAC


CSD: Digital Circuits and Systems




4

-------------

Complex application using peripherals
-------------

8.

Explain how to use the board’s LCD peripheral.

9.

Analy
se the “Heads & Tails” or another tutorial circuit on how to program applications in FSM
style with the following
design flow
:

1.

Specifications



What application you like to design? Can you list its features?

2.

Planning



Plan a microcontroller application as if
it were a simple FSM or a dedicated processor
from Chapters II and III respectively. This is:



General schematic or top block diagram.



Internal architecture using components and signals (and control unit +
datapath if it is the case).



State and timing dia
grams for the FSM (and timing diagram if necessary)




Explain the “software adaptation” of the FSM design style and how to handle
interrupts.



Draw a flowchart (which is like an ASM chart) for every function: interrupt service
routine, output logic (CC2),
and state logic (CC1).

3.

Development



Code every function flowchart in C (or in assembler, if it were the case).



Generate the “*.hex” and “*.cof” files compiling the code using MPLAB X and C
compilers from Microchip (MPLAB XC8).

4.

Simulation, debugging and boa
rd prototyping



Simulate and debug the application in Proteus
-
VSM using the virtual PICDEM 2 Plus
board.



Download the configuration code (*.hex) to the training board, using for example the
In
-
Circuit Debugger/programmer ICD2 or ICD3, and measure and char
acterise the
project using laboratory instrumentation.


10.

Follow the above design flow to obtain a
PWM waveform generator
using C, FSM style of
programming, MPLABX, Proteus
-
VSM, the PIC18F4520, the Timer0, the PICDEM 2 Plus board
and the LCD peripheral.


F
ig.
1

Some concepts included in this exercise.(
Visio
)

EX4
: Setting up application
s with microcontrollers





5

1.5

Analysis 1
: a combinational circuit

1.5.1

Installation of the Microchip MPLABX and XC8 Compiler

a)

Once having downloaded and installed the latest MPLABX software version from the Microchip web page
and the XC compiler, run in Proteus
-
VSM a sample project from our web page, for example the binary
comparator from
Unit 4.6

(see
Fig.
2
). Examine the project and deduce and draw its flow diagram.



Fig.
2

An 8
-
bit binary com
parator solved using a microcontroller (read
Unit 4.6
).

1.5.2

Some theory on microcontrollers PIC

Microcontroller design flow

b)

Here you are in
Fig.
3

a typical microcontroller
-
based design flow. Find in books or in the Internet a similar
flowchart to explain the same concepts, and reference it.



Fig.
3

A typical

design flow for developing applications based on microcontrollers

EETAC


CSD: Digital Circuits and Systems




6

Visiting microcontroller sites

Microcontrollers have become perhaps the most widespread electronic components in use. Any electronic device
you may think of probably will contain a microcontroller or many of them in its architecture. There are many
major manufacturers of microcontroller
s and thousands of companies involved in electronic designs which may
be searched through the web.


c)

Visit some Internet sites portals like the ones in
Fig.
4

or others listed at the Magazines
2

section of our web,
and find an
embedded system

based on an 8
-
bit microcontroller. Copy, in two or three pages maximum, the
specifications, the circuit schematic, the microcontroller in which it is based, the program flo
w chart and
the link to the application.












Fig.
4

Typical Internet microcontroller portals for searching information

PIC18F4520 microcontroller architecture

d)

Examine the architecture in
Fig.
5

and list components which you recognise, and if it were the case, you
could be able to design and synthesise into a PLD using VHDL and applying previous chapters’ strategies.
Could
you redraw the architecture as a “programmable” dedicated processor?


e)

Study the
PIC18F4520 datasheet

or other references like the ones found in
Unit 4.4
, to find answers for the
following questions related to the basic building blocks which are represented in
Fig.
5
. Produce a concept
map or a Power Point slide to explain some of the questions. Be aware of simply “
copy & paste,"

which is
forbidden, unless you add comments and analysis from your own understanding.


1.

Explain the differences be
tween Harvard and Von Neumann microprocessor architectures.

2.

Which is the main architectural difference between 8/16/32 bits microprocessors?

3.

Which are the functions of the FLASH (ROM) memory and the RAM registers?

4.

Explain what the stack memory is and how
it is used for.

5.

List the blocks which are peripherals.

6.

If the architecture has to be sketched using only CPU + MEMORY + I/O, list the blocks which may
be included into de CPU (Central Process Unit).

7.

Explain the main characteristics of the Bank0 and Bank1
of the RAM memory.

8.

How many clock cycles are required for executing an instruction in assembler?

9.

How an assembler instruction is executed?




2

http://digsys.upc.es/ed//revistes/magazines.html


EX4
: Setting up application
s with microcontrollers





7


Fig.
5

PIC18F4520 architecture

PIC assembler: RISC instruction set

f)

Analyse and print (Couri
er New, 7p) a section of the disassemble listing of the comparator in
a)
. Explain how
the C compiler has translated the program’s C statements into assembler instru
ctions (see
Fig.
6
). Choose from
the listing a given C statement and explain how it is executed in assembler.

EETAC


CSD: Digital Circuits and Systems




8


EX4
: Setting up application
s with microcontrollers





9



Fig.
6

PIC18FXXX assembler instruction set

Studying at the assembler level a chip like the PIC18F4520 is very time consuming and goes beyond the
objectives of this introductory semester in digital circuits. There are plenty of books on the subject like the
[2]

that you can try to study at your own pace. We think that once our CSD course is passed, you can learn by
yourself a great deal of assembler and microcontroller ar
chitecture.


Handling microcontroller’s I/O ports

Our strategy to implement reliable designs using microcontrollers will consist in studying some specific
examples and code templates and, then, try to make modifications. The approach will also consist in
dealing
from the simplest peripherals (the programmable I/O digital ports) to the more complex ones (for instance the
EETAC


CSD: Digital Circuits and Systems




10

A/D converter or the USART module). Moreover, studying a given peripheral will
always

imply to follow the
pattern in
Fig.
7
b. A large number of Chapter 4 units will be dedicated to the exploration of each peripheral, in a
similar way the PIC datasheet is organised.

a)
b)

Fig.
7

a) Simplified microcontroller architecture (from
this reference
), b) flowchart for studying peripherals.

g)

Explain how the I/O ports are programmed in the example of

the combinational circuit (see
Fig.
2
). Study
the PIC18F4520 datasheet Chapter 9 on I/O ports to solve this question (see
Unit 4.5
). Add a picture to
describe how a pin can be flexibly programmed as input or output.


1.6

Project 1
: a combinational circuit

h)

Design another similar “combinational” circuit to the one in
Fig.
2
, like a BCD to BIN converter, a Gray to
BCD converter, a 4
-
bit BCD adder, a Dual 4
-
channel multiplexer (2MUX4), etc.


NOTE:

Your i nstructor wi l l tel l you i n cl ass the combi nati onal ci rcui t to desi gn and i ts
fol der and project names.

Folder:

/Project_1/
combinational_circuit


Hence, the idea here is quite straightforward, if you have to design even a very simple combinational
circuit for a
given application of your interest, a microcontroller can be used instead of the previous chapters approach based
on the use of PLD or classic CMOS chips. The microcontroller program flowchart implements the combinational
circuit’s truth tabl
e.

1.7

Analysis 2
: Coding C language in FSM style and I/O interfaces using interrupts

i)

Analyse the binary counters in
Unit 4.9

and deduce their flow charts. Explain why we can use our
pr
ogramming style based on a finite state machine as we did in previous chapters. Explain the concept of
the “Delay” block which can be seen in the architecture in
Fig.
8
.


Fig.
8

The FSM concept applied to programming microcontrollers

EX4
: Setting up application
s with microcontrollers





11

Interrupts

j)

Read the information in Chapter 9 of the
microcontroller’s datasheet
. Explain

how the PIC16F4520 handles
interrupts to the main program (see
Fig.
9
). How many interrupt sources have this microcontroller? How
the user can assign them different
priorities? How many interrupt vectors have this microcontroller?
Compare it with the interrupt system of the PIC16F877A.


Fig.
9

Interruption scheme for PIC18F4520 microcontrollers

Interrupts from buttons and switches

k)

Explain how the input port RB0 is programmed in the example of the binary counter (See
Unit 4.9
) to
interrupt the main program. Which are the registers and configuration bits involved

in the operation? In
order to see if the programming style and the tutorial example, let’s implement a simple modification on
the hardware and software of this initial application: Add a UD_L input, so that the counter can reverse the
sequence: UD_L = ‘1



UP counting; UD_L = ‘0’


DOWN counting.

NOTE
: Your i nstructor may propose you an al ternati ve desi gn i n thi s secti on.

Folder and files:

/Analysis_2

/
Analysis_2.pdsprj

/
Analysis_2.c

1.8

Project 2
: A sequential system

l)

Modify the program of the
design example 3

so that it counts up every time the pushbutton is clicked twice.


NOTE
: Your i nstructor may propose you an al ternati ve desi gn i n thi s secti on.


Folder
:

/Project_2/
Counter


EETAC


CSD: Digital Circuits and Systems




12

1.9

Microcontroller development boards and In
-
Circuit debuggers

Generally, before prototyping or designing a PCB for our microcontroller system, we’ll use a training board to
test and verify most sections of the design. In our laborator
y there are a large number of demonstration and
training boards, see this reference
[4]
. We will use the PICDEM2 Plus board (see
Fig.
10
) that can accommodate
many different microcontrollers. Furthermore, instead of the real board, in many designs the virtual board will
be used instead to speed up the debugging process. See t
he features of the
Proteus
-
VSM simulator
, by Labcenter
Electronics Co.




Fig.
10

PICDEM2+ development board and its virtual model in Proteus
-
VSM

1.10

Project 3
: A

counter for the PICDEM2 Plus board

m)

Convert the 1
-
digit BCD counter (
design example 3
) to a 4
-
bit Johnson counter and adapt it to the PICDEM
2 Plus (see
Unit 4.7
) training board. Run the simulation in Proteus_VSM to demonstrate that it works
correctly. Try to watch variables values (“*.cof” configuration file) and the step mode of execution.
Expla
in how the In Circuit Debugger ICD2/ICD3 is used to download and program the “*.hex” file into the
microcontroller chip. Read
Unit 4.8
. What is exactly “real
-
time debugging”? Which i
s the difference
between a virtual simulation in Proteus
-
VSM and a debugging using a demonstration board?

Folder:

/Project_3/
counter_PICDEM2Plus


1.11

A complex system using LCD and Timer0 peripherals

1.11.1

Project 4
: LCD display

In this section, you are going to u
se as “theory” the example of a “Head & Tails” generator available at the web
page at
Unit 4.10

(or any other example your instructors may have supplied). We are going to follow a
fi
nite
state machine coding style
, thus remembering and using again Chapter I, II and III concepts and topics, even if
you are writing software code instead of synthesising hardware.
FSM
-
style programming will be the only one
permitted in the course
, in
order to standardise procedures, facilitate class discussions and assignments’
assessment. You might consider that such limitation to your creativity as a drawback. However, it is indeed, a
great advantage in many other aspects. This idea of coding C progr
ams in FSM style was originally inspired in
the PicKit1 Flash Starter Kit User’s Guide
3

(Appendix C, Lesson 2).


n)

Explain how the LCD is programmed in C language to show ASCII characters. Enhance your previous
design 3 so that it can represent ASCII message
s like “NUMBER 0, NUMBER 1 …” at the LCD screen.
Read documents about the LCD display at
Unit 4.11
.




3

http://ww1.microchip.com/downloads/en/DeviceDoc/40051D.pdf


EX4
: Setting up application
s with microcontrollers





13


Fig.
11

The 2x16 line LCD displayto print ASCII characte
rs.


Folder:

/Project_4/
counter_PICDEM2Plus_LCD


1.11.2

Project_5
: Timer0 peripheral

o)

Draw the program flowcharts (main function, state register, CC1 and CC2) for the “Heads & Tails” game.


NOTE
: Thi s “head &

tai l s” i s onl y an exampl e to anal yse. Your i nstructor may propose you an
al ternati ve desi gn to study how to program appl i cati on usi ng our FSM styl e.


p)

Explain how the Timer0 has been programmed in the “Heads & Tails” application to generate the square
wav
eform of approximately 1 kHz. Modify the program to generate a 35 % duty cycle waveform of about.
Learn about the Timer0 at
Unit 4.10
. Toggle the waveform ON and OFF by means of a pu
shbutton.


Folder:

/Project_5/
PWM_wave_generator


NOTE
: Thi s use of the Ti mer0 i n the “head &

tai l s” appl i cati on i s onl y an exampl e to anal yse
and to l earn from. Your i nstructor may propose you an al ternati ve desi gn to study how to
program the Ti mer0 peri pheral.


EETAC


CSD: Digital Circuits and Systems




14



Fig.
12

Timer0 architecture


Do not modify the text from
page 3 to page 13



EX4
: Setting up application
s with microcontrollers





15

1.12

Problem solution


1.12.1

Analysis 1: The basics of microcontrollers

Project name and folder

Projects under
development

Sections

Execution
phase


(

,

,

)

Student
engineer in
charge

./EX4/Analysis_ 1/

Basics of a microcontroller
architecture

a)
,
b)
,
c)
,
d)
,
e)
,
f)
,
g)




Your first picture is
Fig.
13
.


Fig.
13

Example of caption


This
[2]

is a reference to a book on microcontrollers and C.


1.12.2

Project 1: A combinational circuit. Basic digital I/O

Project name and folder

Projects under
development

Sections

Execution
phase


(

,

,

)

Student
engineer in
charge

./EX4/Project_1/Combinational_circuit

Learning how to
interface basic
digital I/O

h)




1)

Specifications

Your text here …. And the cross reference to the
Fig.
14
.


Fig.
14

Example of your picture caption.

2)

Plan


Your text here …. And the cross reference to the
Fig.
15
.


Fig.
15

Example of your picture caption.


3)

Developing


Your text here …. And the cross reference to the
Fig.
16
. This is a cross reference
[2]

to a book.


Fig.
16

Example of your picture caption.


4)

Test & verify (functional)



Your text here …. And the cross reference to the
Fig.
17
.


Fig.
17

Example of your picture caption.

EETAC


CSD: Digital Circuits and Systems




16


1.12.3

Analysis 2: Interrupts from buttons and switches. Programming in FSM style.

Project name and folder

Projects under developm
ent

Sections

Execution
phase


(

,

,

)

Student
engineer in
charge

./EX4/Analysis_ 2/

Programming in FSM style using
interrupts to handle peripherals.

i )
,
j)
,
k)




Your first picture is
Fig.
18
.


Fig.
18

Example of caption

This
[2]

is a reference to a book on microcontrollers and C.


1.12.4

Project 2: A counter

Project name and folder

Projects under development

Sections

Execution
phase


(

,

,

)

Student
engineer in
charge

./EX4/Project_2/

counter

Programming in FSM style using
interrupts to handle peripherals.

l )




1)

Specifications

Your text here …. And the cross reference to the
Fig.
19
.


Fig.
19

Example of your picture caption.

2)

Plan


Your text here …. And the cross reference to the
Fig.
20
.


Fig.
20

Example of your picture caption.


3)

Developing


Your text here …. And the cross reference to the
Fig.
21
. This
[2]

is a reference to a book on microcontrollers
and C.


Fig.
21

Example of your picture caption.



4)

Test & verify (functional)



Your text here …. And the cross reference to the
Fig.
22
.


Fig.
22

Example of your picture caption.


EX4
: Setting up application
s with microcontrollers





17

1.12.5

Project
3: Let’s implement the counter in a PICDEM2 Plus training board

Project name and folder

Projects under development

Sections

Execution
phase


(

,

,

)

Student
engineer in
charge

./EX4/Project_3/

counter_PICDEM2Plus


Using the PICDEM2 Plus training
board

from Microchip.

m)




5)

Specifications

Your text here …. And the cross reference to the
Fig.
23
.


Fig.
23

Example of your picture caption.

6)

Plan


Your text here …. And the cross reference to the
Fig.
24
.


Fig.
24

Example of your picture caption.


7)

Developing


Your text here …. And the cross reference to the
Fig.
25
. This
[2]

is a reference to a book on microcontrollers
and C.


Fig.
25

Exam
ple of your picture caption.


8)

Test & verify (functional)



Your text here …. And the cross reference to the
Fig.
26
.


Fig.
26

Example of your

picture caption.



1.12.6

Project 4: Let’s use the LCD display

Project name and folder

Projects under
development

Sections

Execution
phase


(

,

,

)

Student
engineer in
charge

./EX4/Project_4/

c
ounter_PICDEM2Plus_LCD

Using the PICDEM2 Plus LCD
display peripheral.

n)




9)

Specifications

Your text here …. And the cross reference to the
Fig.
27
.


Fig.
27

Example of your picture caption.

EETAC


CSD: Digital Circuits and Systems




18

10)

Plan


Your text here …. And the cross reference to the
Fig.
28
.


Fig.
28

Example of your picture caption.


11)

Developing


Your text here …. And the cross reference to the
Fig.
29
. This
[2]

is a reference to a book on microcontrollers
and C.


Fig.
29

Exam
ple of your picture caption.


12)

Test & verify (functional)



Your text here …. And the cross reference to the
Fig.
30
.


Fig.
30

Example of your

picture caption.



1.12.7

Project 5: Sound wave generation. Timer0 peripheral

Project name and folder

Projects under development

Sections

Execution
phase


(

,

,

)

Student
engineer in
charge

./EX4/Project_5/

PWM_wave_generator

Using the Timer0 peripheral.

o)
,
p)




13)

Specifications

Your text here …. And the cross reference to the
Fig.
31
.


Fig.
31

Example of your picture caption.

14)

Plan


Your text here …. And the cross ref
erence to the
Fig.
32
.


Fig.
32

Example of your picture caption.


15)

Developing


Your text here …. And the cross reference to the
Fig
.
33
. This
[2]

is a reference to a book on microcontrollers
and C.


Fig
.
33

Example of your picture caption.

EX4
: Setting up application
s with microcontrollers





19


16)

Test & verify (functional)



Your text here …. And the cross reference to the
Fig.
34
.


Fig.
34

Example of your picture caption.




1.13

References

Modify or add new references to this section. Follow the same format.


[1]

http://digsys.upc.es
. Course’s web page with many examples on microcontr
oller circuits. See Chapter IV.
[retrieved 12/2012].

[2]

Reese, R. B., Microprocessors, from Assembly language to C Using the PIC18Fxx2, Da Vinci Engineering
Press, 2005.

[3]

www.microchip.com
. Comment: manufacturer web sit
e. Here you can browse for everything on PIC’s. For
example, here you are the
MPLAB IDE User’s guide
. [retrieved 11/2010]

[4]

Electronic components
. The page where are listed all our training boards like the
PICDEM2 Plus board
.

[5]



-


Before delivering the exercise


Remember to add your own sources and references




1.14

Study plan to solve the exercise

Establish a study plan, a task distribution scheme and other requirements to succeed in producing a good solution
when working cooperatively: flux diagrams, concept maps, schematics, tables, pictures, etc.




(This section is mandatory. It must be filled
in order to get a mark.)



EETAC


CSD: Digital Circuits and Systems




20

Check list of projects under way: (

: Not done;


Compiled, but not completely finished and documented ;


Project done, documented and running, ready for use and store in a library)


Project
Num.

Projects under development

Section

Execution
phase


(





)

Student engineer
in charge

Analysis 1

The theory and the Microchip tools

a)
,
b)
,
c)
,
d)
,
e)
,
f)
,
g)



Design 1


A combinational circuit

h)



Anal ysis 2

A sequential system

i )
,
j)
,
k)



Design 2


Counters

l )



De s i gn 3

Adapt at ion t o t he PI CDEM2+

m)



Design 4

Using the LCD display

n)



Desi gn 5

PWM generator and Timer0

o)
,
p)










1.15

Topics and activities checklist

Topics

Activities

Group
member in
charge

Comments

1

2

3

The theory

1.

Microcontroller design
flow and Microchip
tools. A combinational circuit.

a)
,
b)





2.

Analyse
information about microcontrollers
applications

c)





3.

Analyse the Harvard architecture of the
PIC18F4520 and describe their main blocks
and peripherals

d)
,
e)





4.

From C to assembler: disassembling

f)





5.

Deduction of program flow charts from code.
I/O ports. Proteus
-
VSM simulations.

a)
,
g)
,
h)





Application in our FSM style and interrupts


6.

Analyse a counter in FSM style. Explain the
way to program handle interrupts from
digital input ports.

i)
,
j)
,
k)
,
l)





7.

Training boards

m)





Complex application using more
peripherals

8.

The LCD peripheral

n)





9.

Using the Timer0 peripheral. Design a
complex application, such a PWM generator.


o)
,
p)














EX4
: Setting up application
s with microcontrollers





21


1.16

Grading grid

Here you are the way the exercise could be grades.


Analysis 1

The theory and
the Microchip
tools


Design 1

A
combinationa
l circuit

Analysis 2

A
sequential
system

Design 2

Counters

Design 3

Adaptation to
the PICDEM2+

Design 4

Using the
LCD display

Design 5

PWM
generator
and
Timer0


Total

a)
,
b)
,
c)
,
d)
,
e)
,
f)
,
g)

h)

i)
,
j)
,
k)


l)

m)

n)

o)
,
p)

Scores

1.75 p

(0.25 p each)

1.5 p

0.75p

(0.25p each)

1.5p

1p

1p

2.5p

Self
-
assessment








Instructor’s
grades
=
=
=
=
=
=
=
=
=

Do not forget to annotate your own self
-
assessment before
uploading the exercise at your site
.


Individual assessment and group’s cross
-
assessment. Double click to open the Excel spreadsheet and fill in the
yellow cells, so that the mean values will be calculated automatically by the embedded formula. The total
i
ndividual study time has to be in agreement with the table below.






Annotate the cooperative and individual study time carried out to complete this exercise.


Study time
(in hours)

Group work

Classroom and
laboratory sessions


Out of class
sessions


Individual

Student 1

Student 2

Student 3





In
this link
, you can see an example on how to fill in the tables.



Do not forget to annotate this grading grid before uploading the exercise on your site
.



EETAC


CSD: Digital Circuits and Systems




22

1.17

Questions in solving EX2

Write your questions
4

(solved or not), comments, doubts, opinions, etc. here.



(
This section is mandatory. You must complete it to get a mark.)



If you really have solved some of these projects, then you must have many questions that may or may not have
been answered, but it is worth writing them down here as a reminder to answer the
m later on, or just for keeping
track of the many concepts you are learning. Did you come up with any new ideas for similar designs?







4

Ad
d more sheets if necessary to report on your progress or to make comments during the exercise.

EX4
: Setting up application
s with microcontrollers





23


1.18

Improvements to the exercise based on the review and correction

This is an optional section in which you can add anything you like based on the corrections. This section must
also be discussed orally with instructors.