0% found this document useful (0 votes)
215 views

Arabic Course - 01 - Lecture1

Uploaded by

javi_m20
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
215 views

Arabic Course - 01 - Lecture1

Uploaded by

javi_m20
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 40

Programming

Embedded Systems Microcontroller


You Can Practice Microcontroller Programming Easily Now!
Tuesday, December 15, 2009

General Introduction about this course


Assembly


AVR
Bascom-AVRBasic
Proteus

Development Board

50

Practical Class 1

Programming Microcontrollers

Bascom-AVR

Bascom-AVR Compiler

Bascom-AVR


Faculty of Electrical and Electronic Eng.

Automatic Control & Automation Dept.

Compile


Bascom-AVR
LCD Designer

Graphic Converter

*.bgfGLCD

Practical Class 1

Programming Microcontrollers

Plugin Manager
/

Patch Compiler

TCP/IP

LIB Manager
\

Stack Analyzer

PDF Update
ATMEL
AVR
Faculty of Electrical and Electronic Eng.

Automatic Control & Automation Dept.

WORDExport to RTF ifle

.Export to HTML
Bascom-AVR
. .1

1- Directives
Directives are special instructions for the compiler. They can override a setting from the IDE.
2- Configuration
Configuration commands initialize the hardware to the desired state.
3- Variables
Dimension all required variables.
4- Main Program
Contains all executive instructions such as: Mathematical Instruction.
5- Sub Routines

They are sub programs or sub procedures, call from the main program

ProgramSyntax Check

LOOP
.DO

Practical Class 1

Programming Microcontrollers

Program Compile

ProgramSend to programmer

Bascom-AVR

1-WIRE

I2C

RS232



Bascom-AVR

350




TCP/IP


PS2



SPI

ISIS Proteus

ISIS Proteus Simulation


Faculty of Electrical and Electronic Eng.

Automatic Control & Automation Dept.

Proteus


Comparison between most famous C families



AVR, PIC, 8051

AVR

PIC

8051

16MHZ

20MHZ

24MHZ

1Cycle

4Cycle

12Cycle

16/1 = 16MIPS

20/4 = 5MIPS

24/12 = 2MIPS

100%

70%

50%

132

35

215

>256KBytes

<64KBytes

<32KBytes

Liner

banked

Liner

RISC/Harvard

RISC/Harvard

CISC/Von
Neumann

16 Bit

12 Bit

8 Bit


AVR

AVR Microcontrollers Family

8-Bit

AVR

Automotive AVR
AVR Z-Link
Battery Ma nageme nt AVR
CAN AVR
LCD AVR
Lighting AVR
USB AVR
Tiny AVR
MEGA AVR
XMEGA AVR
AT90Sxxxx



IEEE 802.15.4 / ZigBee
1.8~25

CANopen, DeviceNet, OSEKCAN

LCD

USB

20MIPS
32MIPS
MEGA
8

Practical Class 1

Programming Microcontrollers

BatteryM AVR

Lighting AVR

USB AVR

megaAVR

tinyAVR

18 ~ 48 Pin
MAX I/O 4~18
4KB~40KB Flash
256B~1KB EPROM
512B~2KB SRAM
Up To 8MIPS
1.8V 25V

24 ~ 32 Pin
MAX I/O 19~27
8KB~16KB Flash
512B EPROM
512B~1KB SRAM
Up To 16MIPS
2.7V 5.5V

32 ~ 64 Pin
MAX I/O 22~48
8KB~128KB Flash
512B~4KB EPROM
512B~8KB SRAM
Up To 16MIPS
2.7V 5.5V

28 ~ 100 Pin
MAX I/O 23~86
4KB~256KB Flash
512B~4KB EPROM
512B~16KB SRAM
Up To 20MIPS
1.8V 5.5V

8 ~ 32 Pin
MAX I/O 6~28
1KB~8KB Flash
64B~512B EPROM
32B~512B SRAM
Up To 20MIPS
1.8V 5.5V

AVR 8-Bit
Automotive AVR

14 ~ 64 Pin
MAX I/O 6~54
2KB~128KB Flash
128B~4KB EPROM
128B~4KB SRAM
Up To 16MIPS
2.7V 5.5V

CAN AVR

LCD AVR

64 Pin
32KB~128KB Flash
1KB~4KB EPROM
1K~4KB SRAM
Up To 16MIPS
2.7V 5.5V

64 ~ 100 Pin
MAX I/O 54~69
16KB~64KB Flash
512B~2KB EPROM
1KB~4KB SRAM
Up To 20MIPS
1.8V 5.5V

AVR Z-Link

MCU Wireless
chipset for:
IEEE 802.15.4
and
ZigBee
applications.

xmegaAVR

44 ~ 100 Pin
MAX I/O 36~78
16KB~384KB Flash
1KB~4KB EPROM
2KB~32KB SRAM
Up To 32MIPS
1.8V 3.6V

AVR

Reading AVR Package information


AVR



Faculty of Electrical and Electronic Eng.

Automatic Control & Automation Dept.

.ATMEL :AT
:Mega
8,16,32,64,128,256, etc8
2.7V~5.5V L :L
4.5V~5.5V
2016 :8
:P
SOIC, TQFP, LQFPPDIP


IC :I
M

10

Practical Class 1

Programming Microcontrollers

Reading Datasheet of ICs

Datasheet

Bascom-AVR
Assembly




ATmega128

Reading Datasheet of ATmega128

Features
8-bit

High-performance, Low-power AVR 8-bit Microcontroller


Advanced RISC Architecture.
133 Powerful Instructions Most Single Clock Cycle.
32 x 8 General Purpose Working Registers + Peripheral
Control Registers
Fully Static Operation
Up to 16 MIPS Throughput at 16 MHz
On-chip 2-cycle Multiplier
Nonvolatile Program and Data Memories
128K Bytes of In-System Reprogrammable Flash
Endurance: 10,000 Write/Erase Cycles
Optional Boot Code Section with Independent Lock Bits
In-System Programming by On-chip Boot Program - True
Read-While-Write Operation
4K Bytes EEPROM
Endurance: 100,000 Write/Erase Cycles
4K Bytes Internal SRAM
Up to 64K Bytes Optional External Memory Space
Programming Lock for Software Security
SPI Interface for In-System Programming

RISC
133
+ 32 x 8

16 MHz 16


128KB
10,000

EEPROM 4KB
100,000
SRAM 4KB
64KB

SPI

JTAG (IEEE std. 1149.1 Compliant) Interface


Boundary-scan Capabilities According to the JTAG Standard
Extensive On-chip Debug Support
Programming of Flash, EEPROM, Fuses and Lock Bits
through the JTAG Interface
Faculty of Electrical and Electronic Eng.

JTAG

Debug

11

Automatic Control & Automation Dept.

Peripheral Features
8-bit/
Two 8-bit Timer/Counters with Separate Prescalers and
16-bit/
Compare Modes
Two Expanded 16-bit Timer/Counters with Separate

Prescaler, Compare Mode and Capture Mode

Real Time Counter with Separate Oscillator
8-bit PWM
Two 8-bit PWM Channels
6 PWM Channels with Programmable Resolution from 2 to 16-bit PWM
16 Bits
162
Output Compare Modulator
10-bit/
8-channel, 10-bit ADC
I2C
Byte-oriented Two-wire Serial Interface
USARTs
Dual Programmable Serial USARTs
Master/Slave SPI Serial Interface
/SPI
Programmable Watchdog Timer with On-chip Oscillator

On-chip Analog Comparator


Special Microcontroller Features
Power-on Reset and Programmable Brown-out Detection
Internal Calibrated RC Oscillator

External and Internal Interrupt Sources

Six Sleep Modes: Idle, ADC Noise Reduction, Power-save,

Power-down, Standby, and Extended Standby

Software Selectable Clock Frequency
ATmega103 Compatibility Mode Selected by a Fuse
ATmega103
Global Pull-up Disable

I/O and Packages


53 Programmable I/O Lines-PDIP
64-lead TQFP and 64-pad MLF

PDIP/53
TQFP/64

Operating Voltages
2.7 - 5.5V for ATmega128L
4.5 - 5.5V for ATmega128

ATmega128L 2.7 - 5.5V


ATmega128 4.5 - 5.5V

Speed Grades
0 - 8 MHz for ATmega128L
0 - 16 MHz for ATmega128

ATmega128L 8-MHz
ATmega128 16-MHz


ATmega128
. ATmegaxxx

12

Practical Class 1

Programming Microcontrollers

Pin Configur ations


PE0(RXD/PDI) 2
PE0 /
JTAG UART


Faculty of Electrical and Electronic Eng.

13

Automatic Control & Automation Dept.

Block Diagram





RISC Harvard AVR

14

Practical Class 1

Programming Microcontrollers

Standard Systems Design


Von NeumannHarvard
Von-Neumann








Harvard


Methods Architecture Systems Design

.(150 ~ 1500 Instruction) Complex Instruction Set Computer : CISC


.(30 ~ 130 Instruction) Reduced Instruction Set Computer : RISC
.(15 ~ 30 Instruction) Minimum Instruction Set Computer :MISC
CISC

Faculty of Electrical and Electronic Eng.

15

Automatic Control & Automation Dept.



AMD& INTEL
RISC


RISC
DSPsMicrocontrollers

A
MISC

16

Practical Class 1

Programming Microcontrollers

AVR

AVR Development Board

AVR
50
--
Human-Computer Interaction Methods

.1

.2

.3

.4

.5

.LCD 20x4 .6
GLCD 128x64
Faculty of Electrical and Electronic Eng.

17

.7

Automatic Control & Automation Dept.

.8

DTMF

.9

.10
.11

.RC5, RC5-Extended .12


.RC5, RC5-Extended .13
0 9 .14

.0 9999 .15
RS232UART1 .16
UART2 .17
RS485 .18
.19
.20
.21

.LM35DZ-45C ~ +100C .22


ADCNTC .23
.24

.ADC .25
.26
.27
.28
PWM .29
.30
.31
.32
DACLadder .33
DAC .34

18

Practical Class 1

Programming Microcontrollers

.35
RTC .36

.EEPROM .37
.38
Overflow, Compare & Capture modes .39
MMC .40
Smart Card .41
PS2 .42
PS2 .43
DS18211-Wire .44
LED-Matrix Displays .45
USARTRS232 .46
EEPROM .47
.48
.49
.50
.51

.JTAG .52
.53
ESD, EMC & EMIPCBs .54
RTSMultitasking .55
.56
SPI .57



Faculty of Electrical and Electronic Eng.

19

Automatic Control & Automation Dept.

AVR Development Board Designing schedule

AVR

-1
-2

-3

-4

Embedded EMC,EMR,ESD
Systems
Proteus

-5


compilers

-1

AVR
In System Programming

-2

-3

10060

-4

-5

Embedded Systems Design

self learners

-6

-7

USD120

.USD700

20

Practical Class 1

Programming Microcontrollers

-8

Lab-Center Proteus-7.2

Bascom-AVR
Debugger

-9

RS232 Interface
-10
48 I/O

AVR -11
SPI
-12

-13

5% : a
85% b
c
90%
96% d

.98% e
f
1507045%
-14
-15

Open Source

LabVIEW, VB6, Matlab, etc


Faculty of Electrical and Electronic Eng.

21

-16

Automatic Control & Automation Dept.

Development Board Layout Diagram

22

Practical Class 1

Programming Microcontrollers

Development Board Schematic & Board Design


Faculty of Electrical and Electronic Eng.

23

Automatic Control & Automation Dept.


24

Practical Class 1

Programming Microcontrollers


Faculty of Electrical and Electronic Eng.


25

Automatic Control & Automation Dept.

26

Practical Class 1

Programming Microcontrollers

USART


Faculty of Electrical and Electronic Eng.

27

Automatic Control & Automation Dept.


EEPROM & RTC I2C


28

Practical Class 1

Programming Microcontrollers

RS485


Faculty of Electrical and Electronic Eng.

29

Automatic Control & Automation Dept.

30

Practical Class 1

Programming Microcontrollers

MMC/SD

PWM


Faculty of Electrical and Electronic Eng.

31

Automatic Control & Automation Dept.

PS2

32

Practical Class 1

Programming Microcontrollers

1-Wire

Faculty of Electrical and Electronic Eng.

33

Automatic Control & Automation Dept.

34

Practical Class 1

Programming Microcontrollers

Faculty of Electrical and Electronic Eng.

35

Automatic Control & Automation Dept.

36

Practical Class 1

Programming Microcontrollers


Faculty of Electrical and Electronic Eng.

37

Automatic Control & Automation Dept.

38

Practical Class 1

Programming Microcontrollers


Faculty of Electrical and Electronic Eng.

39

Automatic Control & Automation Dept.


Px.0

Px.1

Px.2

Px.3

Port E

RS485 Interface
INT4~7
UART1
AIN
OC3A,B,C
T3
ICP3

Px.4

Px.5

Px.6

Px.7

Four Buttons/Leds1

PWM>DAC

UART1 with Hand-checking and LEDs Indicators

8-bit DAC Interface


External Port Connector for further connecting and can be set to Pull Up/Down Resistor

Port B

Programmer
SPI
OC1A,B
OC0,2
OC1C

MMC/SD Card SPI Interface

Speaker

IR Sender

PWM

IR Receiver

Hexadecimal Keypad

Port D

External Port Connector for further connecting and can be set to Pull Up/Down Resistor
INT0~3
UART2
TWI
T1~2
ICP1

Four Buttons/Leds2
PS2 SCK

ICP1

T1

Relay2

UART2
RTC & EEPROM

External Port Connector for further connecting and can be set to Pull Up/Down Resistor
DS1820

Port C

Relay1

GLCD Control Bus


LCD
Quad Seven Segment Control Lines

Ex.MI-H

Dual Led-Matrix Display Data Bus


External Port Connector for further connecting and can be set to Pull Up/Down Resistor

Port A

GLCD Data Bus


Ex.MI-L

UART2 Hand-checking

Basic Card
Quad Seven Segment Data Bus

Port F

ADC0~7
JTAG

Port G

External Port Connector for further connecting and can be set to Pull Up/Down Resistor

TOSC
WR/RD

LDR
Resistor

NTC
Resistor

Pressure
sensor

Variable
Resistor

Variable
Resistor

4 Switches
On a line

Temperature
Sensor

JTAG Interface
Dual Led-Matrix Display
Control Lines
ASK TR

ASK RE

RC Circuit

23KHZ Crystal

PS2 Data

1
2

Buttons for Interrupt 4~7 can be set to VCC or GND by Jumper, connected with led indicators.
Buttons for Interrupt 0~3 can be set to VCC or GND by Jumper, connected with led indicators.

40

You might also like