SlideShare uma empresa Scribd logo
1 de 28
Baixar para ler offline


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

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

                  

                          




                          




                   Programming
      Embedded Systems Microcontroller

You Can Practice Microcontroller Programming Easily Now!
      WALID BALID, Tuesday, December 15, 2009
Practical Class 10                                                              Programming Microcontrollers

Exp.28:Serial Communications RS485                            RS485

                                                                                       
                               RS485

                                                                           RS485
          RS485  
                                                                               
A,B 
 VA>VB “1” VA<VB
               “1”“0”




                           
 RS485
B A
                 
                                                                                                   




                                                                        RS485
                                     RS485
         ST                              TI                      MAXIM                   LTC
        ST485                         SN75176                    MAX485                 LTC485
                                                                              :RS485
Faculty of Electrical and Electronic Eng.               213               Automatic Control & Automation Dept.
                                                                             

                           RS485
                SPECIFICATIONS                RS232                RS423          RS422                 RS485

      Mode of Operation                    SINGLE-ENDED         SINGLE-ENDED     Differential         Differential
      Total Number of Drivers and            1DRIVER              1DRIVER        1DRIVER              32DRIVER
      Receivers on One Line                  1RECVR               10RECVR        10RECVR              32RECVR
      Maximum Cable Length                     50 FT              4000 FT         4000 FT              4000 FT
                                                                                  10Mb/s               10Mb/s
      Maximum Data Rate                       20kb/s              100kb/s
                                                                                  100Kb/s              100Kb/s
      Maximum Driver Output Voltage            ±25V                 ±6V         -0.25V to +6V         -7V to +12V
      Driver Output Signal
                               Loaded       ±5V to ±15V            ±3.6V           ±2.0V                 ±1.5V
      Level (Loaded Min.)
      Driver Output Signal
                               Unloaded        ±25V                 ±6V             ±6V                   ±6V
      Level (Unloaded Max)
      Driver Load Impedance (Ohms)            3k to 7k             >=450            100                   54
      Max. Driver Current in
                               Power On        N/A                  N/A             N/A                 ±100uA
      High Z State
      Max. Driver Current in
                               Power Off    ±6mA @ ±2v            ±100uA          ±100uA                ±100uA
      High Z State
      Slew Rate (Max.)                        30V/µS             Adjustable         N/A                   N/A
      Receiver Input Voltage Range             ±15V                ±12V         -10V to +10V          -7V to +12V
      Receiver Input Sensitivity                ±3V               ±200mV          ±200mV               ±200mV
      Receiver Input Resistance (Ohms)        3k to 7k             4k min          4k min               >=12k

                                                                                                                  
                                                                       
              
                RS485




                                              

                
                                                       
                                                                                                                  
                              214                       
Practical Class 10                                                              Programming Microcontrollers

                                                                           RS485
  B  A  
                                                        




 

  15Meter 
                                                   Backbone with StubsDaisy Chain




               
   RS485
  
                                                                                          

      Faculty of Electrical and Electronic Eng.               215               Automatic Control & Automation Dept.
                                                                                 




 

                                                                       RS485
                                                                        
                                                 PASSIVE DUPLEX CONTROL (AUTOMATIC ) ü
                                                        ACTIVE DUPLEX CONTROL (RTS Pin ) ü
 RS485    RO, DI      Passive Duplex   ü
 DE/RE Driver
                                  
                                                                                                   
No data to send  §
              “1”
                                                                                       Idle




Master sends a request  §
     Start Bit       
Stop Bit
             Check sum 
                                                              Idle




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


Slave sends a response  §
          add = 07   

                         




                                  

RS485 Driver Active Duplex ü
       RTS Control
                                                                                                    
         No data to send     §
RTS
         “1”   
                                                                                 




Master sends a request  §
     Start Bit       
Stop Bit
Check sum

                                                                                             Idle




Faculty of Electrical and Electronic Eng.                 217                  Automatic Control & Automation Dept.
                                                                                

Slave sends a response 
 add = 07



                                                                                   




                                                                 RS232
             Advantages                                   Disadvantages
       ü System-to-System       ×
              Chip-2-Chip
 1200 ü                            .Chip-2-Sensor 
                                    100kb/s     RS485<>TTL ×
       ü       
  ü                          

                   :RS485MODBUS
         MODEBUS  
Multi Master/Slave
               
                                                                                             
Master Device   MODEBUS        
                                                                               Slave Device

 Slave DeviceMaster DeviceQueryMODEBUS

      Slave             Function                     Start         Start
                                    Byte Count                                    Data               CRC
     Address              Code                     Address Hi    Address Lo

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


       Slave          Function            Byte         Start               Data                     CRC
      Address           Code             Count        Address             Stream             CRC Low     CRC Hi
       1 byte          1 byte            1 byte        2 byte           0 ~ 252 byte              1~2 byte


                                                  1~252Slave Address •
                                                           Function code •
                                                                Byte Count •
                                                        Start Address •
                            255 byte maxData Stream •
                                          Cyclic Redundancy CheckCRC •
   Inter-frame-time             
                                                                                    t3.5




 




 
  Data
                                                         t1.5




             
  
                                                                                                
                                        Inter-character time-out (t1.5) = 750μs
                                          Inter-frame delay (t3.5) = 1.750ms

      Faculty of Electrical and Electronic Eng.                   219               Automatic Control & Automation Dept.
                                                                                   

70Byte9600bps

                                Slave address

                                            

                                         70        ×8         = 560

                                               × 1000 =           .

   58ms             

                                                                               .t3.5= 1.75ms

                                                 


                                                    Start Master


                                                    Set Control Pin


                                                        Waitms 10


                                                   Send Data Frame



                                                  Reset Control Pin



                                                       Waitms 100


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

                                                      
                                                Start Slave

                                                                      NO

                                                 UART INT

                                                        Yes



                                                  Byte1 is                                    Disable UART
                                                 Slave ADD                                      Wait 90ms

                                                                                              NO
                                                        Yes


                                             Get the data at the                                 90ms
                                                                                                Passed?
                                              UART Interface
                                             (MSB First, LSB Last )                                 Yes


                                                                                              Enable UART


                     NO
                                                Check Count
                                                 Check CRC


                                                                             Programming
                                                       YES
                                                                                  OK
   Ignore Data
                                              Set Data Value


                                                       End

               MasterSlaveResponceMODEBUS
    Slave           
                
                       

                           Slave            Function          Byte           CRC
                          Address             Code           Count    CRC Low     CRC Hi
                           1 byte            1 byte          1 byte        1~2 byte

Slave
                                                                                        CRC


Faculty of Electrical and Electronic Eng.                       221           Automatic Control & Automation Dept.
                                                              

                                              RS485|

  Full-DuplexHalf-DuplexRS485
                                                           

                                                       




 

                                                        




 

    RS485
                                         




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

                                            UART<>RS458
                                                    Max485




 

                                                                                             
                                                                      
      Config Print0 = Porte.2 , Mode = Set                           .RS485

  “DE”“1”Config                Print0

                       “0”“DE”

  “DE”
                                                                             

      Faculty of Electrical and Electronic Eng.                223              Automatic Control & Automation Dept.
                                                                        

                                Microcontroller is Master, PC is Slave
$regfile = "m128def.dat"
$crystal = 8000000                                                                  
$baud = 9600
'------------------
Config Print0 = Porte.2 , Mode = Set                                          
Config Pine.2 = Output
                                                                                DE
Config Pine.4 = Input                                                                                   
Key1 Alias Pine.4
Porte.4 = 1
'------------------                                                              
Dim Msg As String * 100
'------------------
Do
   Debounce Key1 , 0 , Sendall , Sub
Loop
End
'------------------
Sendall:
   Print "This is RS485 Test Program"
   Print "RS458 Protocol Done Based-on MAX485"
   Print "University of Aleppo - Syria"
   Print "Faculty of Alectrical & Electronic Engineering"                                
   Print "Control Department"
   Print "Fourth Year Students"
   Print "Computer Aided Design Session"
   Print "Unfutunality This Was The Last Session Lab"
   Print "2nd Semester"
   Print "See You Next Semester Guys ;)"
   Print "Kindest Regards"
   Print "Walid BALID"
   Print ":) :) :) :) :) :) :) :) :) :) :) :)"
   Wait 1
Return

                                                                                                       

                                                                                                       

                                                                                                       

                                                                                                       

                                                                                                       

                                                                                                       

                                                                                                       

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

                                             Microcontroller is Slave, PC is Master
$regfile = "m128def.dat"
$crystal = 8000000                                                                      
$baud = 9600
'-------------------------                                             DE
Config Porte.2 = Output
Config Print = Porte.2 , Mode = Reset                                                        
Open "comd.3:9600,8,n,1" For Output As #1                                  UART
Open "comd.2:9600,8,n,1" For Input As #2                                                     
Config Serialin = Buffered , Size = 250                                  
Enable Interrupts
'-------------------------                                                           
Dim Msg As String * 250
'------------------------
Do                                                                            
   If Ischarwaiting() = 1 Then
      Input Msg
                                                                          UART
      Print #1 , Msg                                                    
   End If
Loop                                                                                UART
End

                                                                                                                      
                                                                                                                      
                                                                                                                      
                                                                                                                      
                                                                                                                      
                                                                                                                      
                                                                                                                      
                                                                                                                      
                                                                                                                      
                                                                                                                      
                                                                                                                      
                                                                                                                      
                                                                                                                      
                                                                                                                      
                                                                                                                      
                                                                                                                      
                                                                                                                      
                                                                                                                      
                                                                                                                      
Faculty of Electrical and Electronic Eng.                     225                 Automatic Control & Automation Dept.
                                                                           

                                      RS232<>RS458
                                                 RS232<>RS458




                               RS232<>RS458




                

                                                                                                          

                                                                                                          

                                                                                                          

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

               RS232<>UART<>RS458
        RS232<>UART<>RS458      
   Max232 UART Max485
                               UART




 
                       RS232<>UART<>RS458




      Faculty of Electrical and Electronic Eng.          227              Automatic Control & Automation Dept.
                                                                                     

Exp.29:Serial Communications USB                                    USB

                                                                                              
                                 USB

                                                                                                 
                                        USB   
 USB

                                                                         USB
                                                                  480Mb/s ü
                 . Plug & Play  ü
                                   ü
                                              127 ü

                                                                                       :USB

  USB 1.0 & USB 1.1 & USB 2.0& USB 3.0USB

                                 USB 1.01.5 Mbits/s Low Speed §
                                        USB 1.112 Mbits/s Full Speed §
                                     .USB 2.0480 Mbits/s High Speed §
                                  .USB 3.04800 Mbits/s  §


                                                                                

                                                                                                   USB
                                            ”Host Controlled”  USB
                                                  )   
                                                     
                                            USB

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

”On-The-Go”
                                                           

                        USB
                                                           ü
                       ü

 HUB USB
  




                               
                                                                                                             
                                                                                          Plug& Play
 Plug & Play USB
  USB

                                                                     

                                 VID, PID 

 USB
                                              


 Faculty of Electrical and Electronic Eng.                229               Automatic Control & Automation Dept.
                                                                             

                                                              USB 
                                                                     USB
                                                           A §
                                                                  B §

                               
                                                                                      

                           D- & D++5v & GNDUSB

                                                                               VCC1
                                                                                 D-2
                                                                                D+3
            
                                                                                  GND4

  '1'       D+&D-  USB  
 D-  '0' D+ '1'
                                    

                                                       :(Non Return to Zero Invert) NRZI
NRZIUSB
                                                                                  

'0' '1''0'
                                                                 '1'



                  

 '1'
                         


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




                            
                                                                                            
    USB
                                                         D- D+
                                 D- .1
                                 D+ .2
                                  .3




                                                                  
                                                                                            USB
   USB
                                                              USB

                  USB Device USB 
  USB Function Host Controller IC USB
                                          USB

           USBUSB Function

           USB Function  Endpoint  
  EndpointUSB Function
                                   InOut
      Faculty of Electrical and Electronic Eng.                 231                Automatic Control & Automation Dept.
                                                                                    

 USB  
                                EP2 In

 USB Function  
                                                                                    




   
 USB1  EP1 In


                                     [Addr : 2] [Endpoint : EP1] [In]
                                                                    USB1



PipePipe

EP0 In & EP0 Out  Pipe0  Pipe  
                                                                                     

                                                                                            
 Pipe
                                                                                      
                                                      Control Transfers §

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

                                                  Interrupt Transfers §
                                 Isochronous Transfers §
                                                    Bulk Transfers §

                                                                            USB
         Frame     USB  
 1ms  USB1.1, USB2.0
                                      125µs

Transaction 
                                                                                                   

                                                                         
              Token Packet
                                                                                        

         In Token
 Synchronization .1
                                                                                           
 Packet Identity PID .2
                           
 128Address .3
                          Endpoint .4
                               5Cyclic Redundancy CheckCRC .5

 Out Token
                                                                                       In Token

Control Transfer : Setup Token
                                                                                            In Token


Faculty of Electrical and Electronic Eng.               233                Automatic Control & Automation Dept.
                                                                           

1ms±500ns: Start of frame Token
                                     11Frame number




                                                             Data Packet
                                                                        Data0 .1
                                                                        Data1 .2
     16bitCRC1024bit




                           

                                                       Handshake Packet
              Acknowledge

Not acknowledge
             

Stall
                                                                                     

                                                                                                          

                                                                                                          

                                                                                                          

                                                                                                          


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

                                                    USB
 USB  USB 
       
                                       USBHardware .1
                                                      . .2
              
 
                                               
         USB

 USB
UARTUSB

          USB

      FT232         
                                                                   FTDIUSB<>UART

HardwareUSB

USB
                                                                   

            D2XX driver & VCP driver


                                                             
                                                                   .COM




                                   
 Faculty of Electrical and Electronic Eng.               235               Automatic Control & Automation Dept.
                                                                              

                                       D2XX driver & VCP driver

            D2XX.DLL Driver                              VCP Driver                                      
                                                             
         3MB 300 KB/s                           
                               

 Com USB :(Virtual Com Port) VCP
                                                                              ComUSB

   :D2XX.DLL
                                                                        DLL


                   

                                                                                      FT232BM
        ü
                                         VCP& D2XX.DLLFTDI ü
                                                                    USB1.1, USB2.0 ü
                                                 ü
                                                       300kb~2Mb ü
                                                     384FIFO  ü

                                                      128FIFO  ü
                                                   VID, PID ü
 ü

USBUSB
  USB            
                                                                   USB


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

                                                                                     




                                                  




     
  11 
                                                                                                 

                
PWREN#
                                                                                    
Faculty of Electrical and Electronic Eng.             237                 Automatic Control & Automation Dept.
                                                                              

 3ms Sleep mode  
Sleep=”1”
                                              

Wake up

                                                 

 USB
                                                     Serial Interface EngineSIE
                         USBUSB §
                                                                            CRC §
                               Start Of Packet, End Of Packet, Resume, Reset  §
                                             NRZI §
                                                              PID §

USB1.1USB Transceiver
  D+              USB2.0,
                                                                         

                                                                          FT232BM 
   6MHz48MHz
  EEPROM PID, VID  
                                                                                         
                                      


                                                                                                             
                                                                                                             
                                                                                                             
                                                                                                             

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

                                               RS232<>UART<>USB




 

                                                                                                                

                            RS232<>UART<>USB




 
                                                                                                                
                                                                                                                
                                                                                                                
                                                                                                                




      Faculty of Electrical and Electronic Eng.                239             Automatic Control & Automation Dept.

Mais conteúdo relacionado

Mais procurados

Bdcom s2508 b hardware installation manual
Bdcom s2508 b hardware installation manualBdcom s2508 b hardware installation manual
Bdcom s2508 b hardware installation manualHARRY CHAN PUTRA
 
9520 pulse generator datasheet
9520 pulse generator datasheet9520 pulse generator datasheet
9520 pulse generator datasheetQuantum Composers
 
The Analysis of Dead Time on Switching Loss in High and Low Side MOSFETs of Z...
The Analysis of Dead Time on Switching Loss in High and Low Side MOSFETs of Z...The Analysis of Dead Time on Switching Loss in High and Low Side MOSFETs of Z...
The Analysis of Dead Time on Switching Loss in High and Low Side MOSFETs of Z...IDES Editor
 
Concept Kit:PWM Buck Converter Transients Model
Concept Kit:PWM Buck Converter Transients ModelConcept Kit:PWM Buck Converter Transients Model
Concept Kit:PWM Buck Converter Transients ModelTsuyoshi Horigome
 
Technical s7889
Technical s7889Technical s7889
Technical s7889huslen_du
 
20110224 saf cfip_brochure_en
20110224 saf cfip_brochure_en20110224 saf cfip_brochure_en
20110224 saf cfip_brochure_ennezinamais
 
DRV401AIDWPG4
DRV401AIDWPG4DRV401AIDWPG4
DRV401AIDWPG4spicepark
 
BlueOptics Bo65jtxrx610d 10gbase-bx-cwdm xfp transceiver 10km singlemode lc d...
BlueOptics Bo65jtxrx610d 10gbase-bx-cwdm xfp transceiver 10km singlemode lc d...BlueOptics Bo65jtxrx610d 10gbase-bx-cwdm xfp transceiver 10km singlemode lc d...
BlueOptics Bo65jtxrx610d 10gbase-bx-cwdm xfp transceiver 10km singlemode lc d...CBO GmbH
 
LM380 Audio Power Amplifier
LM380 Audio Power AmplifierLM380 Audio Power Amplifier
LM380 Audio Power AmplifierYong Heui Cho
 
Speed checker for highway
Speed checker for highwaySpeed checker for highway
Speed checker for highwaySumit Sharma
 
Essential Guide Interfaces I/O 2010
Essential Guide Interfaces I/O 2010Essential Guide Interfaces I/O 2010
Essential Guide Interfaces I/O 2010Gilbert Brault
 

Mais procurados (19)

8051f044
8051f0448051f044
8051f044
 
R2 R
R2 RR2 R
R2 R
 
Folheto BCL 21 e 22
Folheto BCL 21 e 22Folheto BCL 21 e 22
Folheto BCL 21 e 22
 
Bdcom s2508 b hardware installation manual
Bdcom s2508 b hardware installation manualBdcom s2508 b hardware installation manual
Bdcom s2508 b hardware installation manual
 
44
4444
44
 
9520 pulse generator datasheet
9520 pulse generator datasheet9520 pulse generator datasheet
9520 pulse generator datasheet
 
The Analysis of Dead Time on Switching Loss in High and Low Side MOSFETs of Z...
The Analysis of Dead Time on Switching Loss in High and Low Side MOSFETs of Z...The Analysis of Dead Time on Switching Loss in High and Low Side MOSFETs of Z...
The Analysis of Dead Time on Switching Loss in High and Low Side MOSFETs of Z...
 
Switcher
SwitcherSwitcher
Switcher
 
Concept Kit:PWM Buck Converter Transients Model
Concept Kit:PWM Buck Converter Transients ModelConcept Kit:PWM Buck Converter Transients Model
Concept Kit:PWM Buck Converter Transients Model
 
49
4949
49
 
Technical s7889
Technical s7889Technical s7889
Technical s7889
 
20110224 saf cfip_brochure_en
20110224 saf cfip_brochure_en20110224 saf cfip_brochure_en
20110224 saf cfip_brochure_en
 
DRV401AIDWPG4
DRV401AIDWPG4DRV401AIDWPG4
DRV401AIDWPG4
 
BlueOptics Bo65jtxrx610d 10gbase-bx-cwdm xfp transceiver 10km singlemode lc d...
BlueOptics Bo65jtxrx610d 10gbase-bx-cwdm xfp transceiver 10km singlemode lc d...BlueOptics Bo65jtxrx610d 10gbase-bx-cwdm xfp transceiver 10km singlemode lc d...
BlueOptics Bo65jtxrx610d 10gbase-bx-cwdm xfp transceiver 10km singlemode lc d...
 
LM380 Audio Power Amplifier
LM380 Audio Power AmplifierLM380 Audio Power Amplifier
LM380 Audio Power Amplifier
 
Speed checker for highway
Speed checker for highwaySpeed checker for highway
Speed checker for highway
 
DS25CP102 (English)
DS25CP102 (English)DS25CP102 (English)
DS25CP102 (English)
 
Essential Guide Interfaces I/O 2010
Essential Guide Interfaces I/O 2010Essential Guide Interfaces I/O 2010
Essential Guide Interfaces I/O 2010
 
01113 b
01113 b01113 b
01113 b
 

Destaque

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 - Lecture3AL-AWAIL for Electronic Engineering
 
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 - Lecture4AL-AWAIL for Electronic Engineering
 
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 - Lecture11AL-AWAIL for Electronic Engineering
 
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture8
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture8Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture8
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture8AL-AWAIL for Electronic Engineering
 
Embedded System Microcontroller Interactive Course using BASCOM-AVR -Lecture5
Embedded System Microcontroller Interactive Course using BASCOM-AVR -Lecture5Embedded System Microcontroller Interactive Course using BASCOM-AVR -Lecture5
Embedded System Microcontroller Interactive Course using BASCOM-AVR -Lecture5AL-AWAIL for Electronic Engineering
 
Edge Seminar
Edge SeminarEdge Seminar
Edge Seminartijeel
 

Destaque (9)

Edge
EdgeEdge
Edge
 
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 - 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 - Lecture8
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture8Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture8
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture8
 
Edge
EdgeEdge
Edge
 
Embedded System Microcontroller Interactive Course using BASCOM-AVR -Lecture5
Embedded System Microcontroller Interactive Course using BASCOM-AVR -Lecture5Embedded System Microcontroller Interactive Course using BASCOM-AVR -Lecture5
Embedded System Microcontroller Interactive Course using BASCOM-AVR -Lecture5
 
Edge Seminar
Edge SeminarEdge Seminar
Edge Seminar
 
3G Radio Network Planning
3G Radio Network Planning3G Radio Network Planning
3G Radio Network Planning
 

Semelhante a Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture10

RS232 to RS485 converter | GIC India
RS232 to RS485 converter | GIC IndiaRS232 to RS485 converter | GIC India
RS232 to RS485 converter | GIC IndiaPrasadPurohit1988
 
Galvanic isolation & Triad Semiconductor Mixed-Signal ASIC Solutions
Galvanic isolation & Triad Semiconductor Mixed-Signal ASIC SolutionsGalvanic isolation & Triad Semiconductor Mixed-Signal ASIC Solutions
Galvanic isolation & Triad Semiconductor Mixed-Signal ASIC SolutionsTriad Semiconductor
 
Rs232 485 fundamental
Rs232 485 fundamentalRs232 485 fundamental
Rs232 485 fundamentalrounak077
 
1310nm optical transmitter_-_ocdbs-t
1310nm optical transmitter_-_ocdbs-t1310nm optical transmitter_-_ocdbs-t
1310nm optical transmitter_-_ocdbs-therooftit
 
Advanced motion controls dprahis 030a400
Advanced motion controls dprahis 030a400Advanced motion controls dprahis 030a400
Advanced motion controls dprahis 030a400Electromate
 
ComNet FDX60M1A Data Sheet
ComNet FDX60M1A Data SheetComNet FDX60M1A Data Sheet
ComNet FDX60M1A Data SheetJMAC Supply
 
Advanced motion controls dzralte 040l080
Advanced motion controls dzralte 040l080Advanced motion controls dzralte 040l080
Advanced motion controls dzralte 040l080Electromate
 
Advanced motion controls dprahie 030a400
Advanced motion controls dprahie 030a400Advanced motion controls dprahie 030a400
Advanced motion controls dprahie 030a400Electromate
 
RUGGEDCOM RMC20 media converter
RUGGEDCOM RMC20 media converterRUGGEDCOM RMC20 media converter
RUGGEDCOM RMC20 media converterashwini reliserv
 
RS485 LoRaWANコンバーター RS485-LN英文マニュアル
RS485  LoRaWANコンバーター RS485-LN英文マニュアルRS485  LoRaWANコンバーター RS485-LN英文マニュアル
RS485 LoRaWANコンバーター RS485-LN英文マニュアルCRI Japan, Inc.
 

Semelhante a Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture10 (20)

RS232 to RS485 converter | GIC India
RS232 to RS485 converter | GIC IndiaRS232 to RS485 converter | GIC India
RS232 to RS485 converter | GIC India
 
Rs232 to rs485 converter
Rs232 to rs485 converterRs232 to rs485 converter
Rs232 to rs485 converter
 
Ad598
Ad598Ad598
Ad598
 
S7 200 cable
S7 200 cableS7 200 cable
S7 200 cable
 
Galvanic isolation & Triad Semiconductor Mixed-Signal ASIC Solutions
Galvanic isolation & Triad Semiconductor Mixed-Signal ASIC SolutionsGalvanic isolation & Triad Semiconductor Mixed-Signal ASIC Solutions
Galvanic isolation & Triad Semiconductor Mixed-Signal ASIC Solutions
 
AD5663.pdf
AD5663.pdfAD5663.pdf
AD5663.pdf
 
Ds ltc100
Ds ltc100Ds ltc100
Ds ltc100
 
22 series relays
22 series relays22 series relays
22 series relays
 
IMG-2102T Industrial Modbus Gateway
IMG-2102T  Industrial Modbus Gateway IMG-2102T  Industrial Modbus Gateway
IMG-2102T Industrial Modbus Gateway
 
Sfp(ft 9001 g-m-lc02)-datasheet_ver_1.1
Sfp(ft 9001 g-m-lc02)-datasheet_ver_1.1Sfp(ft 9001 g-m-lc02)-datasheet_ver_1.1
Sfp(ft 9001 g-m-lc02)-datasheet_ver_1.1
 
Rs232 485 fundamental
Rs232 485 fundamentalRs232 485 fundamental
Rs232 485 fundamental
 
1310nm optical transmitter_-_ocdbs-t
1310nm optical transmitter_-_ocdbs-t1310nm optical transmitter_-_ocdbs-t
1310nm optical transmitter_-_ocdbs-t
 
Advanced motion controls dprahis 030a400
Advanced motion controls dprahis 030a400Advanced motion controls dprahis 030a400
Advanced motion controls dprahis 030a400
 
ComNet FDX60M1A Data Sheet
ComNet FDX60M1A Data SheetComNet FDX60M1A Data Sheet
ComNet FDX60M1A Data Sheet
 
Advanced motion controls dzralte 040l080
Advanced motion controls dzralte 040l080Advanced motion controls dzralte 040l080
Advanced motion controls dzralte 040l080
 
RS235,422,485.pdf
RS235,422,485.pdfRS235,422,485.pdf
RS235,422,485.pdf
 
ABB uno TL Plus
ABB uno TL PlusABB uno TL Plus
ABB uno TL Plus
 
Advanced motion controls dprahie 030a400
Advanced motion controls dprahie 030a400Advanced motion controls dprahie 030a400
Advanced motion controls dprahie 030a400
 
RUGGEDCOM RMC20 media converter
RUGGEDCOM RMC20 media converterRUGGEDCOM RMC20 media converter
RUGGEDCOM RMC20 media converter
 
RS485 LoRaWANコンバーター RS485-LN英文マニュアル
RS485  LoRaWANコンバーター RS485-LN英文マニュアルRS485  LoRaWANコンバーター RS485-LN英文マニュアル
RS485 LoRaWANコンバーター RS485-LN英文マニュアル
 

Último

IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...PsychoTech Services
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 

Último (20)

INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 

Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture10

  • 1.    ‫ﺍﻟﺘﺠﺎﺭﺏ ﺍﻟﻌﻤﻠﻴﺔ‬     Programming Embedded Systems Microcontroller You Can Practice Microcontroller Programming Easily Now! WALID BALID, Tuesday, December 15, 2009
  • 2. Practical Class 10 Programming Microcontrollers Exp.28:Serial Communications RS485 RS485     RS485  RS485           RS485     A,B   VA>VB “1” VA<VB  “1”“0”    RS485 B A                      RS485 RS485 ST TI MAXIM LTC ST485 SN75176 MAX485 LTC485 :RS485 Faculty of Electrical and Electronic Eng. 213 Automatic Control & Automation Dept.
  • 3.       RS485 SPECIFICATIONS RS232 RS423 RS422 RS485 Mode of Operation SINGLE-ENDED SINGLE-ENDED Differential Differential Total Number of Drivers and 1DRIVER 1DRIVER 1DRIVER 32DRIVER Receivers on One Line 1RECVR 10RECVR 10RECVR 32RECVR Maximum Cable Length 50 FT 4000 FT 4000 FT 4000 FT 10Mb/s 10Mb/s Maximum Data Rate 20kb/s 100kb/s 100Kb/s 100Kb/s Maximum Driver Output Voltage ±25V ±6V -0.25V to +6V -7V to +12V Driver Output Signal Loaded ±5V to ±15V ±3.6V ±2.0V ±1.5V Level (Loaded Min.) Driver Output Signal Unloaded ±25V ±6V ±6V ±6V Level (Unloaded Max) Driver Load Impedance (Ohms) 3k to 7k >=450 100 54 Max. Driver Current in Power On N/A N/A N/A ±100uA High Z State Max. Driver Current in Power Off ±6mA @ ±2v ±100uA ±100uA ±100uA High Z State Slew Rate (Max.) 30V/µS Adjustable N/A N/A Receiver Input Voltage Range ±15V ±12V -10V to +10V -7V to +12V Receiver Input Sensitivity ±3V ±200mV ±200mV ±200mV Receiver Input Resistance (Ohms) 3k to 7k 4k min 4k min >=12k                   RS485                         214 
  • 4. Practical Class 10 Programming Microcontrollers  RS485 B  A       15Meter   Backbone with StubsDaisy Chain    RS485    Faculty of Electrical and Electronic Eng. 215 Automatic Control & Automation Dept.
  • 5.         RS485   PASSIVE DUPLEX CONTROL (AUTOMATIC ) ü ACTIVE DUPLEX CONTROL (RTS Pin ) ü RS485    RO, DI      Passive Duplex   ü  DE/RE Driver      No data to send  §              “1” Idle Master sends a request  §      Start Bit        Stop Bit              Check sum  Idle  216 
  • 6. Practical Class 10 Programming Microcontrollers Slave sends a response  §           add = 07        RS485 Driver Active Duplex ü   RTS Control            No data to send     § RTS          “1”     Master sends a request  §      Start Bit        Stop Bit Check sum  Idle Faculty of Electrical and Electronic Eng. 217 Automatic Control & Automation Dept.
  • 7.      Slave sends a response   add = 07       RS232  Advantages  Disadvantages        ü System-to-System       ×    Chip-2-Chip  1200 ü .Chip-2-Sensor   100kb/s RS485<>TTL ×   ü         ü  :RS485MODBUS          MODEBUS   Multi Master/Slave                   Master Device   MODEBUS          Slave Device  Slave DeviceMaster DeviceQueryMODEBUS Slave Function Start Start Byte Count Data CRC Address Code Address Hi Address Lo  218 
  • 8. Practical Class 10 Programming Microcontrollers Slave Function Byte Start Data CRC Address Code Count Address Stream CRC Low CRC Hi 1 byte 1 byte 1 byte 2 byte 0 ~ 252 byte 1~2 byte 1~252Slave Address • Function code • Byte Count • Start Address • 255 byte maxData Stream •  Cyclic Redundancy CheckCRC •  Inter-frame-time              t3.5     Data  t1.5      Inter-character time-out (t1.5) = 750μs Inter-frame delay (t3.5) = 1.750ms Faculty of Electrical and Electronic Eng. 219 Automatic Control & Automation Dept.
  • 9.      70Byte9600bps   Slave address   70 ×8 = 560 × 1000 = .    58ms                .t3.5= 1.75ms   Start Master Set Control Pin Waitms 10 Send Data Frame Reset Control Pin Waitms 100 End  220 
  • 10. Practical Class 10 Programming Microcontrollers   Start Slave NO UART INT Yes Byte1 is Disable UART Slave ADD Wait 90ms NO Yes Get the data at the 90ms Passed? UART Interface (MSB First, LSB Last ) Yes Enable UART NO Check Count Check CRC Programming YES OK Ignore Data Set Data Value End  MasterSlaveResponceMODEBUS     Slave                               Slave Function Byte CRC Address Code Count CRC Low CRC Hi 1 byte 1 byte 1 byte 1~2 byte Slave  CRC Faculty of Electrical and Electronic Eng. 221 Automatic Control & Automation Dept.
  • 11.       RS485| Full-DuplexHalf-DuplexRS485             RS485     222 
  • 12. Practical Class 10 Programming Microcontrollers  UART<>RS458 Max485           Config Print0 = Porte.2 , Mode = Set .RS485 “DE”“1”Config Print0  “0”“DE” “DE”   Faculty of Electrical and Electronic Eng. 223 Automatic Control & Automation Dept.
  • 13.       Microcontroller is Master, PC is Slave $regfile = "m128def.dat" $crystal = 8000000   $baud = 9600 '------------------ Config Print0 = Porte.2 , Mode = Set  Config Pine.2 = Output  DE Config Pine.4 = Input   Key1 Alias Pine.4 Porte.4 = 1 '------------------   Dim Msg As String * 100 '------------------ Do Debounce Key1 , 0 , Sendall , Sub Loop End '------------------ Sendall: Print "This is RS485 Test Program" Print "RS458 Protocol Done Based-on MAX485" Print "University of Aleppo - Syria" Print "Faculty of Alectrical & Electronic Engineering"   Print "Control Department" Print "Fourth Year Students" Print "Computer Aided Design Session" Print "Unfutunality This Was The Last Session Lab" Print "2nd Semester" Print "See You Next Semester Guys ;)" Print "Kindest Regards" Print "Walid BALID" Print ":) :) :) :) :) :) :) :) :) :) :) :)" Wait 1 Return                224 
  • 14. Practical Class 10 Programming Microcontrollers  Microcontroller is Slave, PC is Master $regfile = "m128def.dat" $crystal = 8000000   $baud = 9600 '-------------------------  DE Config Porte.2 = Output Config Print = Porte.2 , Mode = Reset   Open "comd.3:9600,8,n,1" For Output As #1  UART Open "comd.2:9600,8,n,1" For Input As #2   Config Serialin = Buffered , Size = 250   Enable Interrupts '-------------------------   Dim Msg As String * 250 '------------------------ Do   If Ischarwaiting() = 1 Then Input Msg UART Print #1 , Msg  End If Loop  UART End                                       Faculty of Electrical and Electronic Eng. 225 Automatic Control & Automation Dept.
  • 15.       RS232<>RS458 RS232<>RS458 RS232<>RS458          226 
  • 16. Practical Class 10 Programming Microcontrollers  RS232<>UART<>RS458       RS232<>UART<>RS458        Max232 UART Max485 UART    RS232<>UART<>RS458 Faculty of Electrical and Electronic Eng. 227 Automatic Control & Automation Dept.
  • 17.      Exp.29:Serial Communications USB USB     USB            USB     USB  USB  480Mb/s ü  . Plug & Play  ü   ü  127 ü   :USB  USB 1.0 & USB 1.1 & USB 2.0& USB 3.0USB  USB 1.01.5 Mbits/s Low Speed § USB 1.112 Mbits/s Full Speed § .USB 2.0480 Mbits/s High Speed §  .USB 3.04800 Mbits/s  §        USB  ”Host Controlled”  USB        )                USB  228 
  • 18. Practical Class 10 Programming Microcontrollers ”On-The-Go”    USB   ü  ü  HUB USB       Plug& Play  Plug & Play USB   USB      VID, PID   USB   Faculty of Electrical and Electronic Eng. 229 Automatic Control & Automation Dept.
  • 19.       USB   USB  A §  B §     D- & D++5v & GNDUSB  VCC1   D-2   D+3     GND4   '1'       D+&D-  USB    D-  '0' D+ '1'    :(Non Return to Zero Invert) NRZI NRZIUSB   '0' '1''0'  '1'    '1'    230 
  • 20. Practical Class 10 Programming Microcontrollers       USB  D- D+ D- .1 D+ .2  .3      USB  USB  USB                 USB Device USB  USB Function Host Controller IC USB  USB  USBUSB Function          USB Function  Endpoint   EndpointUSB Function  InOut Faculty of Electrical and Electronic Eng. 231 Automatic Control & Automation Dept.
  • 21.       USB    EP2 In  USB Function        USB1  EP1 In [Addr : 2] [Endpoint : EP1] [In]  USB1 PipePipe  EP0 In & EP0 Out  Pipe0  Pipe        Pipe   Control Transfers §  232 
  • 22. Practical Class 10 Programming Microcontrollers Interrupt Transfers § Isochronous Transfers § Bulk Transfers §  USB          Frame     USB    1ms  USB1.1, USB2.0  125µs Transaction                    Token Packet   In Token  Synchronization .1    Packet Identity PID .2    128Address .3  Endpoint .4  5Cyclic Redundancy CheckCRC .5  Out Token  In Token Control Transfer : Setup Token  In Token Faculty of Electrical and Electronic Eng. 233 Automatic Control & Automation Dept.
  • 23.      1ms±500ns: Start of frame Token 11Frame number  Data Packet Data0 .1 Data1 .2 16bitCRC1024bit   Handshake Packet Acknowledge Not acknowledge  Stall            234 
  • 24. Practical Class 10 Programming Microcontrollers  USB  USB  USB     USBHardware .1  . .2                    USB  USB UARTUSB   USB       FT232           FTDIUSB<>UART HardwareUSB  USB    D2XX driver & VCP driver     .COM   Faculty of Electrical and Electronic Eng. 235 Automatic Control & Automation Dept.
  • 25.       D2XX driver & VCP driver D2XX.DLL Driver VCP Driver         3MB 300 KB/s          Com USB :(Virtual Com Port) VCP  ComUSB    :D2XX.DLL  DLL    FT232BM  ü VCP& D2XX.DLLFTDI ü USB1.1, USB2.0 ü  ü 300kb~2Mb ü 384FIFO  ü 128FIFO  ü VID, PID ü  ü USBUSB   USB              USB  236 
  • 26. Practical Class 10 Programming Microcontrollers         11                     PWREN#   Faculty of Electrical and Electronic Eng. 237 Automatic Control & Automation Dept.
  • 27.       3ms Sleep mode   Sleep=”1”   Wake up     USB  Serial Interface EngineSIE USBUSB § CRC § Start Of Packet, End Of Packet, Resume, Reset  § NRZI § PID § USB1.1USB Transceiver   D+              USB2.0,    FT232BM   6MHz48MHz   EEPROM PID, VID                238 
  • 28. Practical Class 10 Programming Microcontrollers  RS232<>UART<>USB      RS232<>UART<>USB           Faculty of Electrical and Electronic Eng. 239 Automatic Control & Automation Dept.