SlideShare a Scribd company logo
1 of 40
Download to read offline


       

                     ‫ﺍﻟﺘﺠﺎﺭﺏ ﺍﻟﻌﻤﻠﻴﺔ‬

                    

                          




                          




                 Programming
 Embedded Systems Microcontroller

You Can Practice Microcontroller Programming Easily Now!
              Tuesday, December 15, 2009
                                                                                 

General Introduction about this course                                              


              


                                                                                                 

Assembly               
              
                                                                                       

AVR
                         Bascom-AVRBasic

      Proteus       
                                                                                 

   Development Board         

         50

                                                                                                             




                         2                          
Practical Class 1                                                                  Programming Microcontrollers

Bascom-AVR Compiler                                                           Bascom-AVR


   Bascom-AVR
                     

                                             ·




  

       _ ·




  

Faculty of Electrical and Electronic Eng.                    3               Automatic Control & Automation Dept.
                                                                               

          Compile ·




              ·
                                                                       




                          
                                Bascom-AVR

                                                 LCD Designer   
                                                        
                                                                   


                                                 Graphic Converter   
                                                      
                                                                                  *.bgfGLCD


                          4                       
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.            5                  Automatic Control & Automation Dept.
                                                                                      

                  WORDExport to RTF ile 
                                                          f
                    .Export to HTML
                 Bascom-AVR
                                            . .1
                             2
                                                            
                                                       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
 
      ProgramSyntax Check                      3
                                  4




          ،LOOP ‫ﻳﺘﻮﻗﻊ ﻭﺟﻮﺩ ﺗﻌﻠﻴﻤﺔ‬
          .DO‫ﻫﺬﺍ ﺻﺤﻴﺢ ﻷﻧﻪ ﻳﻮﺟﺪ‬




                                 6                         
Practical Class 1                                                                                  Programming Microcontrollers

   Program   Compile                                        5
                                                                           
                               ProgramSend to programmer                             6
                                     Bascom-AVR
                       ‫لﻮ ﻮ ﺗوﺮ‬
                                   ‫اﻟﴩﻃﻴﺔ‬                 ‫ا ﳤﻴﺌﺔ‬                 ‫اﻟﺘﺤﻮﯾﻼت‬       ‫اﻟﺘﻮﻗ ﺖ واﻟﺘﺎرﱗ‬       ‫اﻟﺘﺄ ﲑ اﻟﺰﻣﲏ‬
         1-WIRE
                                                                                                   ‫اﻟﺘﻌﺎﻣﻞ ﻣﻊ‬
                          ‫ ﺎ دﻹ ا‬I2C‫ج ﺮﺧﻹ‬
                                 ‫ا او ل‬        ‫لﻮ ﻮ ﺗوﺮ‬  ‫ﺗﺼﻨﻴﻒ اﻟﺘﻌﻠ ت‬                                    ‫ت ﺎﻔﻠﳌا‬
                                                                                                                  ‫اﻟﺘﻮﺟﳱﺎ ت‬
                                                       ‫اﻟﱪﳎﻴﺔ ﰲ ﺑ ﺔ اﻟﱪ ﻣﺞ‬
                       ‫لﻮ ﻮ ﺗوﺮ‬                                                                    ‫اﻟﺘﻌﺎﻣﻞ ﻣﻊ‬
          RS232
                               ‫اﻟﺘﺤﲂ ﻋﻦ ﺑﻌﺪ‬              Bascom-AVR                                      ‫ةﺮ ا ا‬
                                                                                                                      ‫اﻟﺘﺤﲂ ﳌﻌﺎﰿ‬
                                                       ‫ﺪد اﻟﺘﻌﻠ ت ﺰﯾﺪ ﻋﻦ‬
          ‫اﳊ ﺴﺎﺑﻴﺔ‬                          ‫لﻮ ﻮ ﺗوﺮ‬                                                                             ‫لﻮ ﻮ ﺗوﺮ‬
          ‫واﳌﺜﻠﺜﺎ ت‬               TCP/IP                   ‫053 ﺗﻌﻠﳰﺔ‬                            ‫اﻟ ﺴﻼﺳﻞ اﶈﺮﻓ ﺔ‬
                                                                                                                          SPI
                                            ‫لﻮ ﻮ ﺗوﺮ‬                   ‫ر ﺎﻬﻇﻹ ا ﺔﺷ ﺷ‬
                                                                         ‫ﺎ‬               ‫ر ﺎﻬﻇﻹ ا ﺔﺷ ﺷ‬
                                                                                          ‫ﺎ‬
                      ‫ت ﺎﻌﻃ ﺎﻘﳌا‬                                                                                ‫تﴍ ﺆ ﳌا ﺰ ﻔﻘ ﻟاوت ﳊ ا‬
                                                                                                                  ‫ﺎﻘﻠ‬              ‫ا‬
                                    PS2                ‫ا ﻟﻜ ﺮ ﺴ ﺘ ﺎ ﻟﻴ ﺔ‬               ‫ﺔ ﻣﻮﺳﺮ ﻟا‬
 
                                                                                                                                  
  ISIS Proteus Simulation                                                                            ISIS Proteus




                
  Faculty of Electrical and Electronic Eng.                                  7                  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
                                                                                           CISC/Von
                               RISC/Harvard            RISC/Harvard
                                                                                           Neumann
                           16 Bit                  12 Bit                  8 Bit

                                                                                                                 
 AVR Microcontrollers Family                                                    AVR®   8-Bit
 AVR
                                                                                                                   

                                                           
 Automotive AVR                                        
 AVR Z-Link                           IEEE 802.15.4 / ZigBee
 Batery M nagem nt A
   t a         e VR                1.8~25
 CAN AVR                           CANopen, DeviceNet, OSEKCAN
 LCD AVR                                            LCD
 Lighting AVR                                  
 USB AVR                                                                    USB
 Tiny AVR                                                        
 MEGA AVR                                    20MIPS
 XMEGA AVR                            32MIPS
 AT90Sxxxx                                MEGA

                              8                        
Practical Class 1                                                                 Programming Microcontrollers

 BatteryM AVR               Lighting AVR            USB AVR             megaAVR                 tinyAVR
    18 ~ 48 Pin                24 ~ 32 Pin           32 ~ 64 Pin        28 ~ 100 Pin           8 ~ 32 Pin
  MAX I/O 4~18               MAX I/O 19~27         MAX I/O 22~48       MAX I/O 23~86         MAX I/O 6~28
 4KB~40KB Flash             8KB~16KB Flash        8KB~128KB Flash     4KB~256KB Flash        1KB~8KB Flash
256B~1KB EPROM                512B EPROM         512B~4KB EPROM      512B~4KB EPROM        64B~512B EPROM
 512B~2KB SRAM              512B~1KB SRAM         512B~8KB SRAM      512B~16KB SRAM         32B~512B SRAM
   Up To 8MIPS               Up To 16MIPS          Up To 16MIPS        Up To 20MIPS          Up To 20MIPS
    1.8V – 25V                 2.7V – 5.5V          2.7V – 5.5V         1.8V – 5.5V           1.8V – 5.5V

                                            AVR® 8-Bit                               
                                                                                      
 Automotive AVR                CAN AVR               LCD AVR           AVR Z-Link             xmegaAVR
    14 ~ 64 Pin                                     64 ~ 100 Pin                              44 ~ 100 Pin
  MAX I/O 6~54                   64 Pin            MAX I/O 54~69       MCU Wireless         MAX I/O 36~78
 2KB~128KB Flash           32KB~128KB Flash       16KB~64KB Flash        chipset for:      16KB~384KB Flash
128B~4KB EPROM             1KB~4KB EPROM         512B~2KB EPROM        IEEE 802.15.4       1KB~4KB EPROM
 128B~4KB SRAM              1K~4KB SRAM           1KB~4KB SRAM               and           2KB~32KB SRAM
  Up To 16MIPS               Up To 16MIPS          Up To 20MIPS            ZigBee            Up To 32MIPS
   2.7V – 5.5V                2.7V – 5.5V           1.8V – 5.5V         applications.         1.8V – 3.6V
                                                                                                            
Reading AVR Package information                                           AVR

 
                      ––AVR




                      

                                         

Faculty of Electrical and Electronic Eng.                  9                Automatic Control & Automation Dept.
                                                                                  




       
                                                        


                                                               .ATMEL :AT
                                                                      :Mega
                       8,16,32,64,128,256, etc…8
 2.7V~5.5V L :L
                        4.5V~5.5V––
                                         2016 :8
                  :P
 SOIC, TQFP, LQFP…PDIP




                            
IC :I
                  M

                           10                         
Practical Class 1                                                                          Programming Microcontrollers

 Reading Datasheet of ICs                                              


               – Datasheet –

 Bascom-AVR
        Assembly

                  ––

             
                                                                                                                           
 Reading Datasheet of ATmega128                                          ATmega128

                                                   Features ·
 High-performance, Low-power AVR® 8-bit Microcontroller                     8-bit 
 · Advanced RISC Architecture.                                     RISC ·
 – 133 Powerful Instructions Most Single Clock Cycle.                              133 –
 – 32 x 8 General Purpose Working Registers + Peripheral
                                                                 + 32 x 8 –
   Control Registers
 – Fully Static Operation                                                                  –
 – Up to 16 MIPS Throughput at 16 MHz                            16 MHz 16 –
 – On-chip 2-cycle Multiplier                                                                –
 · Nonvolatile Program and Data Memories                                                              ·
 – 128K Bytes of In-System Reprogrammable Flash                        128KB  –
   Endurance: 10,000 Write/Erase Cycles
                                                                                 10,000 
 – Optional Boot Code Section with Independent Lock Bits
   In-System Programming by On-chip Boot Program - True                 –
   Read-While-Write Operation                                     EEPROM    4KB –
 – 4K Bytes EEPROM                                                                                            100,000
   Endurance: 100,000 Write/Erase Cycles
                                                                                 SRAM 4KB–
 – 4K Bytes Internal SRAM
 – Up to 64K Bytes Optional External Memory Space
                                                                        64KB–
 – Programming Lock for Software Security                                 –
 – SPI Interface for In-System Programming                         SPI–
 · JTAG (IEEE std. 1149.1 Compliant) Interface                                                        JTAG  ·
 – Boundary-scan Capabilities According to the JTAG Standard
                                                                        –
 – Extensive On-chip Debug Support
 –Programming of Flash, EEPROM, Fuses and Lock Bits                            Debug–
   through the JTAG Interface                                             –

 Faculty of Electrical and Electronic Eng.                     11                   Automatic Control & Automation Dept.
                                                                                             

                                                                                                           ·
· Peripheral Features
–Two 8-bit Timer/Counters with Separate Prescalers and   8-bit/–
  Compare Modes                                            16-bit/–
–Two Expanded 16-bit Timer/Counters with Separate                                                    
  Prescaler, Compare Mode and Capture Mode
                                                                                    –
– Real Time Counter with Separate Oscillator
– Two 8-bit PWM Channels                                                   8-bit PWM–
– 6 PWM Channels with Programmable Resolution from 2 to  16-bit PWM–
  16 Bits                                                                              162
– Output Compare Modulator
                                                                             10-bit/–
– 8-channel, 10-bit ADC
– Byte-oriented Two-wire Serial Interface
                                                                                       I2C–
– Dual Programmable Serial USARTs                                       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                                      PDIP/53–
– 64-lead TQFP and 64-pad MLF                                        TQFP/64–
· Operating Voltages                                                                                   ·
– 2.7 - 5.5V for ATmega128L                                       ATmega128L 2.7 - 5.5V –
– 4.5 - 5.5V for ATmega128                                          ATmega128 4.5 - 5.5V –
· Speed Grades                                                                                    ·
– 0 - 8 MHz for ATmega128L                                     ATmega128L 8-MHz –
– 0 - 16 MHz for ATmega128                                     ATmega128 16-MHz –


                                                                                     
                                                                                                        

 ATmega128  
                        . ATmegaxxx 



                                12                            
Practical Class 1                                                                  Programming Microcontrollers


                                        Pin Confgur ations  ·
                                                 i




                                                            
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 NeumannHarvard

                                                                                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
      DSPsMicrocontrollers


µA
           MISC

                                                                                                                  




                            16                          
Practical Class 1                                                                  Programming Microcontrollers

      AVR Development Board                                                    AVR 


  AVR
    50
   --
                                                            Human-Computer Interaction Methods




 
                                                                            
                                   .1
                                                            .2
                                                  /               .3
                                                                              .4
                                                                      .5
                                                            .LCD 20x4 .6
                                                        GLCD 128x64               .7

      Faculty of Electrical and Electronic Eng.                 17                 Automatic Control & Automation Dept.
                                                                               

                                                                                          .8
                                                                                DTMF           .9
                                                                             .10
                                     .11
                               .RC5, RC5-Extended .12
  .RC5, RC5-Extended  .13
                                                 0 – 9 .14
                                             .0 – 9999 .15
  RS232UART1 .16
                                 UART2 .17
                                  RS485 .18
                                                       .19
                                                                                   .20
                                                                          .21
             .LM35DZ-45⁰C ~ +100⁰C .22
    ADCNTC .23
                                                            .24
                                                     .ADC .25
                                                           .26
                                                   .27
                                                       .28
                       PWM .29
                                                                  .30
                                                                           .31
              .32
                    DACLadder .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
        DS18211-Wire .44
               LED-Matrix Displays .45
                        USARTRS232 .46
                                                         EEPROM .47
                                                                          .48
                                                                       .49
                                                                         .50
                                                                   .51
                .JTAG .52
                         .53
     ESD, EMC & EMIPCBs .54
                RTSMultitasking .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
        10060                     -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
                                      1507045%
             -14
 -15

        Open Source   
                                            
              LabVIEW, VB6, Matlab, etc…                 -16
Faculty of Electrical and Electronic Eng.                21                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.
Embedded System Microcontroller Interactive Course using BASCOM-AVR -Lecture1, Included Universal AVR kit full design (Schematic and PCB). By: WALID BALID
Embedded System Microcontroller Interactive Course using BASCOM-AVR -Lecture1, Included Universal AVR kit full design (Schematic and PCB). By: WALID BALID
Embedded System Microcontroller Interactive Course using BASCOM-AVR -Lecture1, Included Universal AVR kit full design (Schematic and PCB). By: WALID BALID
Embedded System Microcontroller Interactive Course using BASCOM-AVR -Lecture1, Included Universal AVR kit full design (Schematic and PCB). By: WALID BALID
Embedded System Microcontroller Interactive Course using BASCOM-AVR -Lecture1, Included Universal AVR kit full design (Schematic and PCB). By: WALID BALID

More Related Content

Viewers also liked

Mini link tn configuration
Mini link tn configurationMini link tn configuration
Mini link tn configuration
Hammad Tabish
 
عمارة الحاسب
عمارة الحاسبعمارة الحاسب
عمارة الحاسب
تقانة
 

Viewers also liked (20)

جودة القدرة Power quality
جودة القدرة Power qualityجودة القدرة Power quality
جودة القدرة Power quality
 
GIS: Geographic Information Systems
GIS: Geographic Information SystemsGIS: Geographic Information Systems
GIS: Geographic Information Systems
 
AVR PPT
AVR PPTAVR PPT
AVR PPT
 
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture6
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture6Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture6
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture6
 
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture3
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture3Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture3
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture3
 
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture4
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture4Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture4
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture4
 
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture9
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture9Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture9
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture9
 
Embedded System Microcontroller Interactive Course using BASCOM-AVR -Lecture7
Embedded System Microcontroller Interactive Course using BASCOM-AVR -Lecture7Embedded System Microcontroller Interactive Course using BASCOM-AVR -Lecture7
Embedded System Microcontroller Interactive Course using BASCOM-AVR -Lecture7
 
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture11
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture11Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture11
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture11
 
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture10
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture10Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture10
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture10
 
Critical system
Critical systemCritical system
Critical system
 
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture...
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture...Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture...
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture...
 
برنامج تدريبى عن المخاطر الكهربائية وطرق الوقاية منها Training program
برنامج تدريبى عن المخاطر الكهربائية وطرق الوقاية منها Training programبرنامج تدريبى عن المخاطر الكهربائية وطرق الوقاية منها Training program
برنامج تدريبى عن المخاطر الكهربائية وطرق الوقاية منها Training program
 
Introduction to Nokia RNC
Introduction to Nokia RNCIntroduction to Nokia RNC
Introduction to Nokia RNC
 
عرض وحدة مهن وتخصصات الحاسب
عرض وحدة مهن وتخصصات الحاسبعرض وحدة مهن وتخصصات الحاسب
عرض وحدة مهن وتخصصات الحاسب
 
Mini link tn configuration
Mini link tn configurationMini link tn configuration
Mini link tn configuration
 
عمارة الحاسب
عمارة الحاسبعمارة الحاسب
عمارة الحاسب
 
مكونات الحاسب الآلي - أنظمة التشغيل
مكونات الحاسب الآلي - أنظمة التشغيلمكونات الحاسب الآلي - أنظمة التشغيل
مكونات الحاسب الآلي - أنظمة التشغيل
 
Routing over ericsson mini link
Routing over ericsson mini linkRouting over ericsson mini link
Routing over ericsson mini link
 
4.tissue conditioning
4.tissue conditioning4.tissue conditioning
4.tissue conditioning
 

Recently uploaded

Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 

Recently uploaded (20)

Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 

Embedded System Microcontroller Interactive Course using BASCOM-AVR -Lecture1, Included Universal AVR kit full design (Schematic and PCB). By: WALID BALID

  • 1.    ‫ﺍﻟﺘﺠﺎﺭﺏ ﺍﻟﻌﻤﻠﻴﺔ‬     Programming Embedded Systems Microcontroller You Can Practice Microcontroller Programming Easily Now! Tuesday, December 15, 2009
  • 2.   General Introduction about this course                      Assembly                                 AVR  Bascom-AVRBasic       Proteus             Development Board            50     2 
  • 3. Practical Class 1 Programming Microcontrollers Bascom-AVR Compiler  Bascom-AVR    Bascom-AVR    ·   _ ·   Faculty of Electrical and Electronic Eng. 3 Automatic Control & Automation Dept.
  • 4.   Compile ·               ·     Bascom-AVR   LCD Designer                 Graphic Converter            *.bgfGLCD  4 
  • 5. 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. 5 Automatic Control & Automation Dept.
  • 6.   WORDExport to RTF ile  f .Export to HTML  Bascom-AVR . .1  2  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   ProgramSyntax Check 3  4 ،LOOP ‫ﻳﺘﻮﻗﻊ ﻭﺟﻮﺩ ﺗﻌﻠﻴﻤﺔ‬ .DO‫ﻫﺬﺍ ﺻﺤﻴﺢ ﻷﻧﻪ ﻳﻮﺟﺪ‬  6 
  • 7. Practical Class 1 Programming Microcontrollers  Program   Compile         5  ProgramSend to programmer 6  Bascom-AVR ‫لﻮ ﻮ ﺗوﺮ‬ ‫اﻟﴩﻃﻴﺔ‬ ‫ا ﳤﻴﺌﺔ‬ ‫اﻟﺘﺤﻮﯾﻼت‬ ‫اﻟﺘﻮﻗ ﺖ واﻟﺘﺎرﱗ‬ ‫اﻟﺘﺄ ﲑ اﻟﺰﻣﲏ‬ 1-WIRE ‫اﻟﺘﻌﺎﻣﻞ ﻣﻊ‬ ‫ ﺎ دﻹ ا‬I2C‫ج ﺮﺧﻹ‬ ‫ا او ل‬ ‫لﻮ ﻮ ﺗوﺮ‬ ‫ﺗﺼﻨﻴﻒ اﻟﺘﻌﻠ ت‬ ‫ت ﺎﻔﻠﳌا‬ ‫اﻟﺘﻮﺟﳱﺎ ت‬ ‫اﻟﱪﳎﻴﺔ ﰲ ﺑ ﺔ اﻟﱪ ﻣﺞ‬ ‫لﻮ ﻮ ﺗوﺮ‬ ‫اﻟﺘﻌﺎﻣﻞ ﻣﻊ‬ RS232 ‫اﻟﺘﺤﲂ ﻋﻦ ﺑﻌﺪ‬ Bascom-AVR ‫ةﺮ ا ا‬ ‫اﻟﺘﺤﲂ ﳌﻌﺎﰿ‬ ‫ﺪد اﻟﺘﻌﻠ ت ﺰﯾﺪ ﻋﻦ‬ ‫اﳊ ﺴﺎﺑﻴﺔ‬ ‫لﻮ ﻮ ﺗوﺮ‬ ‫لﻮ ﻮ ﺗوﺮ‬ ‫واﳌﺜﻠﺜﺎ ت‬ TCP/IP ‫053 ﺗﻌﻠﳰﺔ‬ ‫اﻟ ﺴﻼﺳﻞ اﶈﺮﻓ ﺔ‬ SPI ‫لﻮ ﻮ ﺗوﺮ‬ ‫ر ﺎﻬﻇﻹ ا ﺔﺷ ﺷ‬ ‫ﺎ‬ ‫ر ﺎﻬﻇﻹ ا ﺔﺷ ﺷ‬ ‫ﺎ‬ ‫ت ﺎﻌﻃ ﺎﻘﳌا‬ ‫تﴍ ﺆ ﳌا ﺰ ﻔﻘ ﻟاوت ﳊ ا‬ ‫ﺎﻘﻠ‬ ‫ا‬ PS2 ‫ا ﻟﻜ ﺮ ﺴ ﺘ ﺎ ﻟﻴ ﺔ‬ ‫ﺔ ﻣﻮﺳﺮ ﻟا‬     ISIS Proteus Simulation  ISIS Proteus   Faculty of Electrical and Electronic Eng. 7 Automatic Control & Automation Dept.
  • 8.   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 CISC/Von  RISC/Harvard RISC/Harvard Neumann  16 Bit 12 Bit 8 Bit   AVR Microcontrollers Family  AVR® 8-Bit  AVR       Automotive AVR   AVR Z-Link  IEEE 802.15.4 / ZigBee Batery M nagem nt A t a e VR  1.8~25 CAN AVR  CANopen, DeviceNet, OSEKCAN LCD AVR LCD Lighting AVR   USB AVR USB Tiny AVR   MEGA AVR 20MIPS XMEGA AVR  32MIPS AT90Sxxxx   MEGA  8 
  • 9. Practical Class 1 Programming Microcontrollers BatteryM AVR Lighting AVR USB AVR megaAVR tinyAVR 18 ~ 48 Pin 24 ~ 32 Pin 32 ~ 64 Pin 28 ~ 100 Pin 8 ~ 32 Pin MAX I/O 4~18 MAX I/O 19~27 MAX I/O 22~48 MAX I/O 23~86 MAX I/O 6~28 4KB~40KB Flash 8KB~16KB Flash 8KB~128KB Flash 4KB~256KB Flash 1KB~8KB Flash 256B~1KB EPROM 512B EPROM 512B~4KB EPROM 512B~4KB EPROM 64B~512B EPROM 512B~2KB SRAM 512B~1KB SRAM 512B~8KB SRAM 512B~16KB SRAM 32B~512B SRAM Up To 8MIPS Up To 16MIPS Up To 16MIPS Up To 20MIPS Up To 20MIPS 1.8V – 25V 2.7V – 5.5V 2.7V – 5.5V 1.8V – 5.5V 1.8V – 5.5V AVR® 8-Bit        Automotive AVR CAN AVR LCD AVR AVR Z-Link xmegaAVR 14 ~ 64 Pin 64 ~ 100 Pin 44 ~ 100 Pin MAX I/O 6~54 64 Pin MAX I/O 54~69 MCU Wireless MAX I/O 36~78 2KB~128KB Flash 32KB~128KB Flash 16KB~64KB Flash chipset for: 16KB~384KB Flash 128B~4KB EPROM 1KB~4KB EPROM 512B~2KB EPROM IEEE 802.15.4 1KB~4KB EPROM 128B~4KB SRAM 1K~4KB SRAM 1KB~4KB SRAM and 2KB~32KB SRAM Up To 16MIPS Up To 16MIPS Up To 20MIPS ZigBee Up To 32MIPS 2.7V – 5.5V 2.7V – 5.5V 1.8V – 5.5V applications. 1.8V – 3.6V   Reading AVR Package information  AVR    ––AVR     Faculty of Electrical and Electronic Eng. 9 Automatic Control & Automation Dept.
  • 10.       .ATMEL :AT   :Mega 8,16,32,64,128,256, etc…8 2.7V~5.5V L :L  4.5V~5.5V––  2016 :8                  :P  SOIC, TQFP, LQFP…PDIP   IC :I  M  10 
  • 11. Practical Class 1 Programming Microcontrollers Reading Datasheet of ICs     – Datasheet –   Bascom-AVR  Assembly   ––     Reading Datasheet of ATmega128  ATmega128 Features · High-performance, Low-power AVR® 8-bit Microcontroller    8-bit  · Advanced RISC Architecture.    RISC · – 133 Powerful Instructions Most Single Clock Cycle.   133 – – 32 x 8 General Purpose Working Registers + Peripheral  + 32 x 8 – Control Registers – Fully Static Operation   – – Up to 16 MIPS Throughput at 16 MHz 16 MHz 16 – – On-chip 2-cycle Multiplier    – · Nonvolatile Program and Data Memories    · – 128K Bytes of In-System Reprogrammable Flash         128KB  – Endurance: 10,000 Write/Erase Cycles   10,000  – Optional Boot Code Section with Independent Lock Bits In-System Programming by On-chip Boot Program - True  – Read-While-Write Operation    EEPROM    4KB – – 4K Bytes EEPROM   100,000 Endurance: 100,000 Write/Erase Cycles  SRAM 4KB– – 4K Bytes Internal SRAM – Up to 64K Bytes Optional External Memory Space  64KB– – Programming Lock for Software Security  – – SPI Interface for In-System Programming  SPI– · JTAG (IEEE std. 1149.1 Compliant) Interface   JTAG  · – Boundary-scan Capabilities According to the JTAG Standard  – – Extensive On-chip Debug Support –Programming of Flash, EEPROM, Fuses and Lock Bits  Debug– through the JTAG Interface  – Faculty of Electrical and Electronic Eng. 11 Automatic Control & Automation Dept.
  • 12.      · · Peripheral Features –Two 8-bit Timer/Counters with Separate Prescalers and  8-bit/– Compare Modes  16-bit/– –Two Expanded 16-bit Timer/Counters with Separate   Prescaler, Compare Mode and Capture Mode  – – Real Time Counter with Separate Oscillator – Two 8-bit PWM Channels   8-bit PWM– – 6 PWM Channels with Programmable Resolution from 2 to  16-bit PWM– 16 Bits  162 – Output Compare Modulator  10-bit/– – 8-channel, 10-bit ADC – Byte-oriented Two-wire Serial Interface  I2C– – Dual Programmable Serial USARTs  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  PDIP/53– – 64-lead TQFP and 64-pad MLF  TQFP/64– · Operating Voltages    · – 2.7 - 5.5V for ATmega128L  ATmega128L 2.7 - 5.5V – – 4.5 - 5.5V for ATmega128  ATmega128 4.5 - 5.5V – · Speed Grades    · – 0 - 8 MHz for ATmega128L  ATmega128L 8-MHz – – 0 - 16 MHz for ATmega128  ATmega128 16-MHz –       ATmega128   . ATmegaxxx   12 
  • 13. Practical Class 1 Programming Microcontrollers Pin Confgur ations  · i   PE0(RXD/PDI) 2     PE0   /               JTAG       UART        Faculty of Electrical and Electronic Eng. 13 Automatic Control & Automation Dept.
  • 14.   Block Diagram ·            RISC  Harvard     AVR        14 
  • 15. Practical Class 1 Programming Microcontrollers Standard Systems Design      Von NeumannHarvard  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.
  • 16.                               AMD& INTEL    RISC                                RISC  DSPsMicrocontrollers  µA  MISC    16 
  • 17. Practical Class 1 Programming Microcontrollers AVR Development Board  AVR  AVR   50  --  Human-Computer Interaction Methods      .1  .2 / .3  .4  .5 .LCD 20x4 .6 GLCD 128x64 .7 Faculty of Electrical and Electronic Eng. 17 Automatic Control & Automation Dept.
  • 18.    .8 DTMF .9  .10  .11 .RC5, RC5-Extended .12 .RC5, RC5-Extended  .13 0 – 9 .14 .0 – 9999 .15 RS232UART1 .16 UART2 .17 RS485 .18  .19  .20  .21 .LM35DZ-45⁰C ~ +100⁰C .22 ADCNTC .23  .24 .ADC .25  .26  .27  .28 PWM .29  .30  .31  .32 DACLadder .33 DAC .34  18 
  • 19. 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 DS18211-Wire .44 LED-Matrix Displays .45 USARTRS232 .46 EEPROM .47  .48  .49  .50  .51 .JTAG .52  .53 ESD, EMC & EMIPCBs .54 RTSMultitasking .55  .56 SPI .57       Faculty of Electrical and Electronic Eng. 19 Automatic Control & Automation Dept.
  • 20.   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 10060 -4                 -5             Embedded Systems Design  self learners  -6   -7  ،USD120   .USD700   20 
  • 21. 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 1507045%  -14  -15          Open Source      LabVIEW, VB6, Matlab, etc… -16 Faculty of Electrical and Electronic Eng. 21 Automatic Control & Automation Dept.
  • 22.   Development Board Layout Diagram        22 
  • 23. Practical Class 1 Programming Microcontrollers Development Board Schematic & Board Design           Faculty of Electrical and Electronic Eng. 23 Automatic Control & Automation Dept.
  • 24.              24 
  • 25. Practical Class 1 Programming Microcontrollers               Faculty of Electrical and Electronic Eng. 25 Automatic Control & Automation Dept.
  • 26.              26 
  • 27. Practical Class 1 Programming Microcontrollers  USART         Faculty of Electrical and Electronic Eng. 27 Automatic Control & Automation Dept.
  • 28.          EEPROM & RTC I2C      28 
  • 29. Practical Class 1 Programming Microcontrollers  RS485         Faculty of Electrical and Electronic Eng. 29 Automatic Control & Automation Dept.
  • 30.              30 
  • 31. Practical Class 1 Programming Microcontrollers  MMC/SD            PWM   Faculty of Electrical and Electronic Eng. 31 Automatic Control & Automation Dept.
  • 32.    PS2                32 
  • 33. Practical Class 1 Programming Microcontrollers              1-Wire Faculty of Electrical and Electronic Eng. 33 Automatic Control & Automation Dept.
  • 34.                34 
  • 35. Practical Class 1 Programming Microcontrollers                                                  Faculty of Electrical and Electronic Eng. 35 Automatic Control & Automation Dept.