SlideShare ist ein Scribd-Unternehmen logo
1 von 20
Downloaden Sie, um offline zu lesen
ī„ ī„ 

     ī„  ī„ ī†Šī…šī…°ī…Ĩī…Ŋī…ģī…ī„ ī…Œī…‚ī…Ŋī…šī…’ī…‹ī…Ŋī…ģī…ī„ ī†Ēī…ī…Ŋī…šī…‰

                     â€ĢīēīģŸīē˜īē īēŽīē­īē īēīģŸīģŒīģ¤īģ īģ´īē”â€Ŧ

                  ī„  ī„ ī†Ēī…Ŧī…‰ī…ī…šī…ģī…ī„ ī†Ēī…Ąī…ģī…ī…ģī…

                          ī„ ī„ 




                          ī„ ī„ 




                   Programming
      Embedded Systems Microcontroller

You Can Practice Microcontroller Programming Easily Now!
      WALID BALID, Tuesday, December 15, 2009
ī‹‘ī‰ĒīŠŦī‰ļīŠī‰īˆ ī‰ī‰‚ī‹€īŠ¸ī‰šī‰ŽīŠī‰īˆ ī‹’īŠ‰ī‰Ēī‰‰                                                                            īˆ  īˆ  ī‹’īŠ¨ī‰‰ī‰ī‰ĒīŠģī‰īˆ ī‹’ī‰ŽīŠŧīŠ†ī‰

Exp.10: Shift & Rotate Instructions                           īˆ  īˆ ī‹†ī‰ī‰Šī‹‹ī‰ĻīŠģī‰ī‹‹īˆ ī‹’ī‰™ī‰ī‰Ģī‹ĸī‰īˆ ī‰ī‰‚ī‹€ī‹ŽīŠŧīŠ¨ī‰īˆ īˆēī‹‘ī‰Ēī‰ąī‰‚īŠ¨īŠģī‰īˆ ī‹’ī‰‰ī‰Ēī‰–ī‰ŽīŠģī‰


                                                                                       īˆ  īˆ īˆēī‹’ī‰‰ī‰Ēī‰–ī‰ŽīŠģī‰īˆ ī‹…īŠŋīˆ ī‹’ī‹ī‰‚īŠŦīŠģī‰
                                                īˆ  īˆ īˆŽīˆ¨RotateīˆŠ ī‹†ī‰ī‰Šī‹‹ī‰ĻīŠģī‰ī‹‹īˆ īˆ¨ShiftīˆŠīˆ ī‹’ī‰™ī‰ī‰Ģī‹ĸī‰īˆ ī‰ī‰‚ī‹€ī‹ŽīŠŧīŠ¨ī‰īˆ ī‹“īŠŧīŠ§īˆ īŠ˛ī‰ĒīŠ¨ī‰ŽīŠģī‰
                                                                                        īˆ  īˆ īˆēīŠŊī‹Žī‰ĩī‹Œī‰ŽīŠģī‰īˆ īŠĄī‹ąīŠ‹




īˆ  īˆ 
                                                                                        īˆ  īˆ īˆēī‹‘ī‰Šī‰ī‰ĻīŠģī‰īˆ īŠŊī‹€īŠ§īˆ ī‰ ī‰Ēī‰ą
īˆ ī‰ī‰‚ī‹Žī‹–ī‰‚ī‹„ī‰’īŠģī‰īˆ ī‹“īŠŧīŠ§īˆ ī‰Ēī‹ˆīŠ¤ī‹īˆ ī‰ī‰‰īˆ ī‹’ī‰™ī‰ī‰Ģī‰‡īˆŠīˆ īˆŦīˆ¨Shift RightīˆŠīˆ ī‹‚ī‰‚īŠŋī‹ŸīŠģīˆ ī‹’ī‰™ī‰ī‰Ģī‹ĸī‰‚ī‰‰īˆ  S6īˆ ī‰ ī‰‚ī‰ŽīŠ°īŠī‰īˆ ī‹‚ī‹ŒīŠ´ī‹īˆ ī‰“ī‹ŽīŠīˆ ī‰—īŠŋī‰‚ī‹ƒī‰Ēī‰‰īˆ ī‹’ī‰‰ī‰‚ī‰ŽīŠ¸ī‰‰īˆ ī‹‚ī‹ŒīŠ´ī‹ƒīˆ īŠ˛ī‹Œī‰­
                                                       īˆ  īˆ īˆ īˆŽīˆ¨Shift LeftīˆŠīˆ īŠąīŠŧī‰ĸīŠŧīŠģīˆ ī‹’ī‰™ī‰ī‰Ģī‹ĸī‰‚ī‰‰īˆ S7īˆ ī‰ ī‰‚ī‰ŽīŠ°īŠī‰ī‹‹īˆ īˆ¨ī‹’ī‹Žī‹–ī‹Œī‰ēīŠģī‰
īˆ ī‰Šī‰‚ī‰Žī‹ŽīŠģī‰īˆ ī‹ŒīŠīˆ ī‹†ī‰ī‰Šī‹‹ī‰Ĩīˆ ī‹’ī‹ŽīŠŧī‹€īŠ¨ī‰‰īˆ ī‹‚ī‹ŒīŠ´ī‹īˆ  S14īˆ ī‰ ī‰‚ī‰ŽīŠ°īŠī‰ī‹‹īˆ  īˆ¨Rotate RightīˆŠīˆ  īŠ”ī‹€ī‹ŽīŠģī‰īˆ ī‹ŒīŠīˆ ī‹†ī‰ī‰Šī‹‹ī‰Ĩīˆ ī‹’ī‹ŽīŠŧī‹€īŠ¨ī‰‰īˆ ī‹‚ī‹ŒīŠ´ī‹īˆ  S13īˆ ī‰ ī‰‚ī‰ŽīŠ°īŠī‰īˆ īŠšīŠģī‰¨īŠˇ
                                                                                        īˆ  īˆ īˆŽīˆ¨Rotate RightīˆŠ
                                                                                      īˆ  īˆ īˆēīŠŊī‹Žī‰ĩī‹Œī‰ŽīŠģī‰īˆ ī‰ī‰‚ī‰ŠīŠŧī‹ąī‰ŽīŠŋ
                                               īˆ  īˆ īˆ .Jumperīˆ ī‹‚ī‰ī‰Ļī‰ĸī‰Žī‰­ī‰‚ī‰‰ JP9īˆ ī‹‹ JP6īˆ īŠŊī‰ĩī‹ŒīŠģī‰īˆ ī‹’ī‹ąīŠ´ī‹ƒīˆ īŠļī‹īŠĢī‰‡īˆ ī‰‹īŠ
                                                                                                            īˆ  īˆ 

ī‹’ī‰ŽīŠ—ī‹žī‰ī‹‹īˆ ī‹īŠģī‹ ī‰īˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‹’ī‰­ī‰Ļī‹„ī‹‡īˆ ī‹ī‰ŽīŠŗ                      72                          ī‹’ī‹Žī‹ƒī‹‹īˆ–īŠ¸īŠģī‹ĸī‰ī‹‹īˆ ī‹’ī‹Žī‹–ī‰‚ī‰‰ī‰Ēī‹ˆīŠ¸īŠģī‰īˆ ī‹’ī‰­ī‰Ļī‹„īˆšī‰īˆ ī‹’ī‹ŽīŠŧīŠˇ
Practical Class 4                                                           Programming Microcontrollers

                                                                                   īˆ  īˆ īˆēī‹‘ī‰Ļī‹ī‰ĻīŠ†ī‰īˆ ī‰ī‰‚ī‹€ī‹ŽīŠŧīŠ¨ī‰ŽīŠģī‰
                    īˆ  īˆ  ī‹’ī‹ŽīŠ‰īˆ•īŠģī‰īˆ ī‹’ī‹€ī‹ŽīŠŧīŠ¨ī‰ŽīŠģī‰                              īˆ  īˆ  ī‹’ī‹€ī‹ŽīŠŧīŠ¨ī‰ŽīŠģī‰īˆ ī‰ ī‰Ēī‰ą
                                                     īˆ ī‰Ĩī‰ĻīŠ§ī‹‹īˆ  ī‰Šī‰‚ī‰Žī‹ŽīŠģī‰īˆ  ī‹‹ī‰ƒīˆ  īŠ”ī‹€ī‹ŽīŠģī‰īˆ  īŠ•ī‰‡īˆ  īŠžī‹Œī‰šī‰ŽīŠŋīˆ  ī‹…īŠŋīˆ  ī‰ī‰‰īˆ  ī‹’ī‰™ī‰ī‰Ģī‰‡
  Shift var , Right/Left [, shift]
                                                            īˆ  īˆ [, shift]īˆ ī‰Ÿī‰‰īˆ ī‹‘ī‰Ĩī‰ĻīŠŠīˆ ī‹’ī‰™ī‰ī‰Ģī‹ĸī‰īˆ ī‰ī‰‚ī‹ƒī‰‚ī‰Ą
                                                     īˆ ī‰Ĩī‰ĻīŠ§ī‹‹īˆ  ī‰Šī‰‚ī‰Žī‹ŽīŠģī‰īˆ  ī‹‹ī‰ƒīˆ  īŠ”ī‹€ī‹ŽīŠģī‰īˆ  īŠ•ī‰‡īˆ  īŠžī‹Œī‰šī‰ŽīŠŋīˆ  ī‹…īŠŋīˆ  ī‰ī‰‰īˆ  ī‰Ēī‹ī‹‹ī‰Ļī‰
Rotate var , Right/Left [, rotate]
                                                            īˆ  īˆ [, shift]īˆ ī‰Ÿī‰‰īˆ ī‹‘ī‰Ĩī‰ĻīŠŠīˆ ī‹†ī‰ī‰Šī‹‹ī‰ĻīŠģī‰īˆ ī‰ī‰‚ī‹ƒī‰‚ī‰Ą
                                                                                 īˆ  īˆ īˆēī‹‘ī‰Šī‰ī‰ĻīŠģī‰īˆ īŠŊī‹ŽīŠŦī‰˛ī‰īˆ ī‰—īŠŋī‰‚ī‹ƒī‰Ēī‰‰
$regfile = "m128def.dat"
$crystal = 8000000                                                       īˆ  īˆ īˆŽī‰ī‰‚ī‹ˆī‹Žī‰•ī‹Œī‰ŽīŠģī‰
'---------------------
Config Pine.4 = Input
Config Pine.5 = Input
Config Pine.6 = Input
Config Pine.7 = Input

Pine.4 = 1 : Pine.5 = 1
Pine.6 = 1 : Pine.7 = 1
                                                           īˆ ī‰ī‰‚ī‹Žī‹–ī‰‚ī‹„ī‰’īŠģī‰ī‹‹īˆ ī‰œī‹Žī‰ī‰‚īŠ°īŠī‰īˆ ī‰‚ī‹ˆīŠ¨īŠŋīˆ ī‹’īŠŧī‰ĩī‹ŒīŠī‰īˆ ī‰ī‰‚ī‰‰ī‰ī‹Œī‰ŠīŠģī‰īˆ īŠąī‹ī‰ĒīŠ¨ī‰
Shift_r      Alias     Pine.4                                              īˆ  īˆ īˆŽī‹’ī‹Žī‹–ī‹Œī‰ēīŠģī‰
Shift_l      Alias     Pine.5
Rotat_r      Alias     Pine.6
Rotat_l      Alias     Pine.7

Config Portd = Output
Leds Alias Portd
Portd = &B00000001
'---------------------
Do
   Debounce Shift_r , 0 , Sr , Sub
   Debounce Shift_l , 0 , Sl , Sub
   Debounce Rotat_r , 0 , Rr , Sub          īˆ  īˆ īˆŽī‰œī‹Žī‰ī‰‚īŠ°īŠī‰īˆ ī‹’īŠģī‰‚ī‰™īˆ ī‰ˇī‰šīŠ¯īˆ ī‰‚ī‹ˆī‹ŽīŠ¯īˆ ī‹ī‰Žī‹īˆ ī‹ī‰Žī‹Žī‹–ī‰ĒīŠģī‰īˆ ī‰—īŠŋī‰‚ī‹ƒīˆ•īŠģī‰īˆ ī‹’īŠ´īŠŧī‰™
   Debounce Rotat_l , 0 , Rl , Sub
Loop
End
'---------------------
Sr:
   If Leds > 1 Then Shift Leds , Right , 1
Return
'---------------------
Sl:
   If Leds < 128 Then Shift Leds , Left , 1
Return
'---------------------                                       īˆ  īˆ īˆŽī‹’ī‹ŽīŠ§ī‰ĒīŠ°īŠģī‰īˆ ī‰—īŠŋī‰īˆ•īŠģī‰
Rr:
   Rotate Leds , Right , 1
Return
'---------------------
Rl:
   Rotate Leds , Left , 1
Return
'---------------------


Faculty of Electrical and Electronic Eng.       73                   Automatic Control & Automation Dept.
ī‹‘ī‰ĒīŠŦī‰ļīŠī‰īˆ ī‰ī‰‚ī‹€īŠ¸ī‰šī‰ŽīŠī‰īˆ ī‹’īŠ‰ī‰Ēī‰‰                                                                        īˆ  īˆ  ī‹’īŠ¨ī‰‰ī‰ī‰ĒīŠģī‰īˆ ī‹’ī‰ŽīŠŧīŠ†ī‰

      Exp.11: Get RC Value                                īˆ  īˆ īŠąī‰’īŠ¸īŠŋīˆ ī‹‹ī‰ƒīˆ ī‹’īŠŋī‹‹ī‰‚īŠ´īŠŋīˆ ī‹’ī‹€ī‹ŽīŠŗīˆ ī‹‘ī‹•ī‰ī‰ĒīŠŗīˆ īˆēī‹‘ī‰Ēī‰˛īŠ§īˆ ī‹’ī‹ī‰Ĩī‰‚īŠ‡ī‰īˆ ī‹’ī‰‰ī‰Ēī‰–ī‰ŽīŠģī‰


                                                                                         īˆ  īˆ īˆēī‹’ī‰‰ī‰Ēī‰–ī‰ŽīŠģī‰īˆ ī‹…īŠŋīˆ ī‹’ī‹ī‰‚īŠŦīŠģī‰
                                                īˆ  īˆ īˆŽī‹ĩī‰‚īŠ¨īŠŋīˆ īŠąī‰’īŠ¸īŠī‰ī‹‹īˆ ī‹’īŠŋī‹‹ī‰‚īŠ´īŠī‰īˆ ī‹…ī‰šī‰˛īŠģīˆ īˆŸīŠŋī‰ŦīŠģī‰īˆ ī‰ī‰‰ī‰‚ī‰’īŠģī‰īˆ īˆ—īŠŦī‰īˆ ī‹’ī‹€ī‹ŽīŠŗīˆ ī‹‘ī‹•ī‰ī‰ĒīŠŗ
                                                                                          īˆ  īˆ īˆēīŠŊī‹Žī‰ĩī‹Œī‰ŽīŠģī‰īˆ īŠĄī‹ąīŠ‹




īˆ  īˆ 


                                                                                          īˆ  īˆ īˆēī‹‘ī‰Šī‰ī‰ĻīŠģī‰īˆ īŠŊī‹€īŠ§īˆ ī‰ ī‰Ēī‰ą
  īˆ ī‰ī‰‰ī‰‚ī‰’īŠģī‰īˆ  īˆ—īŠŦī‰īˆ  ī‹’ī‹€ī‹ŽīŠŗīˆ  ī‹‘ī‹•ī‰ī‰ĒīŠŗī‹‹īˆ  ī‰ĒīŠŦī‰ļīŠī‰īˆ  ī‹īŠ¸ī‰šī‰ŽīŠī‰īˆ  ī‰Œī‰‚ī‹ąīŠŗī‰ƒīˆ  ī‰Ļī‰™ī‰ƒīˆ  īŠŠīŠŋīˆ  īˆ—īŠŦī‰ŽīŠŋīˆ  īŠąī‰’īŠ¸īŠŋī‹‹īˆ  ī‹‘īˆ—īŠŦī‰ŽīŠŋīˆ  ī‹’īŠŋī‹‹ī‰‚īŠ´īŠŋīˆ  īŠŊī‹Žī‰ĩī‹Œī‰Žī‰‰īˆ  ī‹‚ī‹ŒīŠ´ī‹ƒīˆ  īŠ˛ī‹Œī‰­
                                           īˆ  īˆ īˆŽGetrcīˆ ī‹’ī‹€ī‹ŽīŠŧīŠ¨ī‰ŽīŠģī‰īˆ ī‹‚ī‰ī‰Ļī‰ĸī‰Žī‰­ī‰‚ī‰‰īˆ ī‹ĩī‰‚īŠ¨īŠŋīˆ īŠąī‰’īŠ¸īŠī‰ī‹‹īˆ ī‹’īŠŋī‹‹ī‰‚īŠ´īŠī‰īˆ ī‹…ī‰šī‰˛īŠģīˆ īˆŸīŠŋī‰ŦīŠģī‰
                                                                                                              īˆ  īˆ 
                                                                                        īˆ  īˆ īˆēīŠŊī‹Žī‰ĩī‹Œī‰ŽīŠģī‰īˆ ī‰ī‰‚ī‰ŠīŠŧī‹ąī‰ŽīŠŋ
            īˆ  īˆ īˆŽī‰Šī‰‚ī‹ˆīŠŖī‹ĸī‰īˆ ī‹’ī‰ąī‰‚ī‰ąīˆ īŠŊī‹ŽīŠŦī‰˛ī‰ŽīŠģīˆ SW2īˆ ī‰ ī‰‚ī‰ŽīŠ°īŠī‰īˆ īŠļī‹īŠĢī‰‡īˆ īŠšīŠģī‰¨īŠˇī‹‹īˆ .Jumperīˆ ī‹‚ī‰ī‰Ļī‰ĸī‰Žī‰­ī‰‚ī‰‰ JP14īˆ īŠŊī‰ĩī‹ŒīŠģī‰īˆ ī‹’ī‹ąīŠ´ī‹ƒīˆ īŠļī‹īŠĢī‰‡īˆ ī‰‹īŠ


                                                                                                              īˆ  īˆ 


      ī‹’ī‰ŽīŠ—ī‹žī‰ī‹‹īˆ ī‹īŠģī‹ ī‰īˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‹’ī‰­ī‰Ļī‹„ī‹‡īˆ ī‹ī‰ŽīŠŗ                   74                         ī‹’ī‹Žī‹ƒī‹‹īˆ–īŠ¸īŠģī‹ĸī‰ī‹‹īˆ ī‹’ī‹Žī‹–ī‰‚ī‰‰ī‰Ēī‹ˆīŠ¸īŠģī‰īˆ ī‹’ī‰­ī‰Ļī‹„īˆšī‰īˆ ī‹’ī‹ŽīŠŧīŠˇ
Practical Class 4                                                     Programming Microcontrollers

                                                                              īˆ  īˆ īˆēī‹‘ī‰Ļī‹ī‰ĻīŠ†ī‰īˆ ī‰ī‰‚ī‹€ī‹ŽīŠŧīŠ¨ī‰ŽīŠģī‰
                    īˆ  īˆ  ī‹’ī‹ŽīŠ‰īˆ•īŠģī‰īˆ ī‹’ī‹€ī‹ŽīŠŧīŠ¨ī‰ŽīŠģī‰                      īˆ  īˆ  ī‹’ī‹€ī‹ŽīŠŧīŠ¨ī‰ŽīŠģī‰īˆ ī‰ ī‰Ēī‰ą
                                            īˆ ī‰‹ī‹ąīŠ´īŠģī‰īˆ ī‹“īŠŧīŠ§īˆ īŠžī‹Œī‰ĩī‹ŒīŠŋīˆ īŠąī‰’īŠ¸īŠŋīˆ ī‹…ī‰šī‰˛ī‰‰īˆ ī‹’ī‹€ī‹ŽīŠŧīŠ¨ī‰ŽīŠģī‰īˆ ī‹Šī‰¨ī‹‡īˆ ī‹‚ī‹ŒīŠ´ī‰
                                            īˆ īˆŸīŠŋī‰Ģīˆ  ī‰īŠŗī‹›īŠŋīˆ  īŠŊī‹ŽīŠŦī‰˛ī‰Žī‰‰īˆ  ī‹‚ī‹ŒīŠ´ī‰īˆ  ī‹ī‰‘īˆ  pinxīˆ  ī‹’ī‰‰ī‰ī‹Œī‰ŠīŠģī‰īˆ  ī‹…īŠŋīˆ  y
       īˆ  īˆ var = Getrc(pinx , y)
                                            īˆ īŠĩīŠŧīŠ¨ī‰Žī‰īˆ īˆŸīŠŋī‰Ģīˆ ī‰ī‰‰ī‰‚ī‰‘īˆ ī‹Œī‹‡īˆ ī‰—ī‰ī‰‚ī‹„īŠģī‰ī‹‹īˆ īŠąī‰’īŠ¸īŠī‰īˆ īŠ­ī‹ī‰ĒīŠ°ī‰īˆ ī‹…īŠŋī‰Ģīˆ ī‰°ī‰‚ī‹ŽīŠŗī‹‹
                                                            īˆ  īˆ īˆĄī‹ĩī‰‚īŠ¨īŠŋīˆ īŠąī‰’īŠ¸īŠī‰ī‹‹īˆ ī‹’īŠŋī‹‹ī‰‚īŠ´īŠī‰īˆ ī‹’ī‹€ī‹ŽīŠ´ī‰‰īˆ ī‹‰ī‰Žī‹€ī‹ŽīŠŗ
                                                                                                 īˆ  īˆ 
                                                                          īˆ  īˆ īˆēī‹‘ī‰Šī‰ī‰ĻīŠģī‰īˆ īŠŊī‹ŽīŠŦī‰˛ī‰īˆ ī‰—īŠŋī‰‚ī‹ƒī‰Ēī‰‰
$regfile = "m128def.dat"
$crystal = 8000000                                                 īˆ  īˆ īˆŽī‰ī‰‚ī‹ˆī‹Žī‰•ī‹Œī‰ŽīŠģī‰
'----------------------
Config Lcdpin = Pin , Db4 = Portc.4 ,
Db5 = Portc.5 , Db6 = Portc.6 , Db7 =                   īˆ ī‰Šī‰‚ī‹ˆīŠŖī‹ĸī‰īˆ ī‹’ī‰ąī‰‚ī‰ąīˆ ī‰‚ī‹ˆīŠ¨īŠŋīˆ ī‹’īŠŧī‰ĩī‹ŒīŠī‰īˆ ī‹’ī‰‰ī‰ī‹Œī‰ŠīŠģī‰īˆ īŠąī‹ī‰ĒīŠ¨ī‰
Portc.7 , E = Portc.2 , Rs = Portc.3                              īˆ  īˆ īˆŽī‹’ī‹ŽīŠģī‰‚ī‰Žī‰Žī‹ī‰ĒīŠ¸īŠģī‰
Config Lcd = 20 * 4
'----------------------
Dim Rc_var As Word                                              īˆ  īˆ ī‰ī‹œī‹Œī‰šī‰ŽīŠī‰īˆ īŠąī‹ī‰ĒīŠ¨ī‰
'----------------------
Cls : Cursor Off
Lcd "RC Val= "
Do
   Rc_var = Getrc(ping , 2)
   Locate 1 , 9                                              īˆ  īˆ īˆŽī‹ī‰Žī‹Žī‹–ī‰ĒīŠģī‰īˆ ī‰—īŠŋī‰‚ī‹ƒīˆ•īŠģī‰īˆ ī‹’īŠ´īŠŧī‰™
   Lcd Rc_var
                                                                        īˆ  īˆ 
   Waitms 1000
   Locate 1 , 8 : Lcd Spc(7)
Loop

End

                                                                                                 īˆ  īˆ 




Faculty of Electrical and Electronic Eng.   75                 Automatic Control & Automation Dept.
ī‹‘ī‰ĒīŠŦī‰ļīŠī‰īˆ ī‰ī‰‚ī‹€īŠ¸ī‰šī‰ŽīŠī‰īˆ ī‹’īŠ‰ī‰Ēī‰‰                                                                        īˆ  īˆ  ī‹’īŠ¨ī‰‰ī‰ī‰ĒīŠģī‰īˆ ī‹’ī‰ŽīŠŧīŠ†ī‰

      Exp.12: IR receiver, RC5-code                 īˆ  īˆ īˆ RC5īˆ ī‰Šī‰‚ī‹ŽīŠ¨īŠī‰īˆ īŠĩīŠ¯ī‹‹īˆ IR īˆ īŠžī‰‚ī‰ŠīŠ´ī‰Žī‰­ī‰īˆ ī‹‘ī‰Šī‰ī‰Ĩīˆ īˆēī‹‘ī‰Ēī‰˛īŠ§īˆ ī‹’ī‹Žī‹ƒī‰‚ī‰’īŠģī‰īˆ ī‹’ī‰‰ī‰Ēī‰–ī‰ŽīŠģī‰


                                                                                         īˆ  īˆ īˆēī‹’ī‰‰ī‰Ēī‰–ī‰ŽīŠģī‰īˆ ī‹…īŠŋīˆ ī‹’ī‹ī‰‚īŠŦīŠģī‰
            .RC5, RC5-Extendedīˆ ī‰ī‹œī‹ŒīŠˇī‹Œī‰ī‹‹īˆ•īŠģī‰īˆ īŠĩīŠ¯ī‹‹īˆ īˆ¨CLRM-2038SīˆŠīˆ ī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ ī‰īŠ„īˆ ī‹’īŠ¨ī‰ąī‰ƒīˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠŋīˆ ī‹’īŠ‰ī‰Ēī‰‰īˆ ī‹‹īˆ īŠŊī‹Žī‰ĩī‹Œī‰

                                                                                          īˆ  īˆ īˆēīŠŊī‹Žī‰ĩī‹Œī‰ŽīŠģī‰īˆ īŠĄī‹ąīŠ‹




īˆ  īˆ 
                                                                                          īˆ  īˆ īˆēī‹‘ī‰Šī‰ī‰ĻīŠģī‰īˆ īŠŊī‹€īŠ§īˆ ī‰ ī‰Ēī‰ą
  īˆ īŠŊī‹€īŠ¨ī‰īˆ  īˆžīŠģī‰īˆ  ī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ  ī‰īŠ„īˆ  ī‹’īŠ¨ī‰ąī‹žī‰‚ī‰‰īˆ  ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ  ī‹‘ī‰Ŧī‹ˆī‰•ī‰ƒīˆ  ī‹…īŠŋīˆ  ī‹’īŠŧī‰­ī‰ĒīŠŋīˆ  ī‰ĒīŠŋī‰ī‹‹ī‰ƒīˆ  īŠžī‰‚ī‰ŠīŠ´ī‰Žī‰­ī‰īˆ  ī‹‘ī‰Šī‰ī‰ĻīŠģīˆ  ī‰—īŠŋī‰‚ī‹ƒī‰Ēī‰‰īˆ  ī‹’ī‰‰ī‰‚ī‰ŽīŠ¸ī‰‰īˆ  ī‹‚ī‹ŒīŠ´ī‹ƒīˆ  īŠ˛ī‹Œī‰­
                                                                                     .RC5īˆ īŠžī‹ŒīŠˇī‹Œī‰ī‹‹īˆ•īŠģī‰īˆ ī‰īŠ´īŠ¯ī‹‹
                                                                                        īˆ  īˆ īˆēīŠŊī‹Žī‰ĩī‹Œī‰ŽīŠģī‰īˆ ī‰ī‰‚ī‰ŠīŠŧī‹ąī‰ŽīŠŋ
            īˆ  īˆ īˆŽī‰Šī‰‚ī‹ˆīŠŖī‹ĸī‰īˆ ī‹’ī‰ąī‰‚ī‰ąīˆ īŠŊī‹ŽīŠŦī‰˛ī‰ŽīŠģīˆ SW2īˆ ī‰ ī‰‚ī‰ŽīŠ°īŠī‰īˆ īŠļī‹īŠĢī‰‡īˆ īŠšīŠģī‰¨īŠˇī‹‹īˆ .Jumperīˆ ī‹‚ī‰ī‰Ļī‰ĸī‰Žī‰­ī‰‚ī‰‰ JP18īˆ īŠŊī‰ĩī‹ŒīŠģī‰īˆ ī‹’ī‹ąīŠ´ī‹ƒīˆ īŠļī‹īŠĢī‰‡īˆ ī‰‹īŠ
                                                                                        īˆ  īˆ īˆēī‹‘ī‰Ļī‹ī‰ĻīŠ†ī‰īˆ ī‰ī‰‚ī‹€ī‹ŽīŠŧīŠ¨ī‰ŽīŠģī‰


      ī‹’ī‰ŽīŠ—ī‹žī‰ī‹‹īˆ ī‹īŠģī‹ ī‰īˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‹’ī‰­ī‰Ļī‹„ī‹‡īˆ ī‹ī‰ŽīŠŗ                    76                        ī‹’ī‹Žī‹ƒī‹‹īˆ–īŠ¸īŠģī‹ĸī‰ī‹‹īˆ ī‹’ī‹Žī‹–ī‰‚ī‰‰ī‰Ēī‹ˆīŠ¸īŠģī‰īˆ ī‹’ī‰­ī‰Ļī‹„īˆšī‰īˆ ī‹’ī‹ŽīŠŧīŠˇ
Practical Class 4                                                      Programming Microcontrollers

                    īˆ  īˆ  ī‹’ī‹ŽīŠ‰īˆ•īŠģī‰īˆ ī‹’ī‹€ī‹ŽīŠŧīŠ¨ī‰ŽīŠģī‰                      īˆ  īˆ  ī‹’ī‹€ī‹ŽīŠŧīŠ¨ī‰ŽīŠģī‰īˆ ī‰ ī‰Ēī‰ą
          īˆ  īˆ Config        Rc5 = Pinb.7                IRīˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠŋīˆ ī‰˜ī‰Ēī‰Ąīˆ īŠŠīŠŋīˆ īŠžī‹Œī‰ĩī‹ŒīŠī‰īˆ ī‰‹ī‹ąīŠ´īŠģī‰īˆ īŠąī‹ī‰ĒīŠ¨ī‰
        Getrc5(address , Command)                       īˆ  īˆ īŠŊī‰­ī‰ĒīŠī‰īˆ ī‰Ģī‰‚ī‹ˆīŠ†ī‰īˆ ī‹…īŠŋīˆ ī‰ĒīŠŋī‹žī‰ī‹‹īˆ ī‹†ī‰ī‹Œī‹„īŠ¨īŠģī‰īˆ ī‰ˇī‰šīŠ¯
                                                                           īˆ  īˆ īˆēī‹‘ī‰Šī‰ī‰ĻīŠģī‰īˆ īŠŊī‹ŽīŠŦī‰˛ī‰īˆ ī‰—īŠŋī‰‚ī‹ƒī‰Ēī‰‰
$regfile = "m128def.dat"
$crystal = 8000000                                                  īˆ  īˆ īˆŽī‰ī‰‚ī‹ˆī‹Žī‰•ī‹Œī‰ŽīŠģī‰
'---------------------
Config Lcdpin = Pin , Db4 = Portc.4 ,
Db5 = Portc.5 , Db6 = Portc.6 , Db7 =                   īˆ ī‰Šī‰‚ī‹ˆīŠŖī‹ĸī‰īˆ ī‹’ī‰ąī‰‚ī‰ąīˆ ī‰‚ī‹ˆīŠ¨īŠŋīˆ īŠŊī‰ĩī‹ŒīŠī‰īˆ ī‹’ī‰‰ī‰ī‹Œī‰ŠīŠģī‰īˆ īŠąī‹ī‰ĒīŠ¨ī‰
Portc.7 , E = Portc.2 , Rs = Portc.3                              īˆ  īˆ īˆŽī‹’ī‹ŽīŠģī‰‚ī‰Žī‰Žī‹ī‰ĒīŠ¸īŠģī‰
Config Lcd = 20 * 4
'---------------------
Config Rc5 = Pinb.7                                   īˆ  īˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠī‰īˆ ī‰˜ī‰Ēī‰Ąīˆ ī‹‰īŠ¨īŠŋīˆ īŠŊī‰ĩī‹ŒīŠī‰īˆ ī‰‹ī‹ąīŠ´īŠģī‰īˆ īŠąī‹ī‰ĒīŠ¨ī‰
'---------------------
                                                                 īˆ  īˆ ī‰ī‹œī‹Œī‰šī‰ŽīŠī‰īˆ īŠąī‹ī‰ĒīŠ¨ī‰
Dim Address As Byte , Command As Byte
Enable Interrupts                                            īˆ  īˆ ī‹’īŠŋī‰‚īŠ¨īŠģī‰īˆ ī‹’īŠ¨ī‰ŋī‰‚īŠ´īŠī‰īˆ ī‹īŠŧīŠ§īˆ īŠŊī‹ŽīŠ¨īŠ°ī‰
'---------------------
Cls
Do                                                   īˆ ī‰—īŠŋī‰‚ī‹ƒīˆ•īŠģī‰īˆ ī‹•ī‰‚īŠ§ī‰Ļī‰Žī‰­ī‰īˆ ī‰‚ī‹ˆī‹ŽīŠ¯īˆ ī‹ī‰Žī‹īˆ ī‹ī‰Žī‹Žī‹–ī‰ĒīŠģī‰īˆ ī‰—īŠŋī‰‚ī‹ƒīˆ•īŠģī‰īˆ ī‹’īŠ´īŠŧī‰™
   Gosub Remote_control                          īˆ  īˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‰Ģī‰‚ī‹ˆī‰•īˆ īŠŸīˆ īŠĸī‹ŒīŠŦī‰ēīŠī‰īˆ ī‰ ī‰‚ī‰ŽīŠ°īŠī‰īˆ ī‹’īŠģī‰‚ī‰™īˆ ī‹‘ī‹•ī‰ī‰ĒīŠ´īŠģīˆ ī‹īŠ§ī‰ĒīŠ°īŠģī‰
Loop
'---------------------

Remote_control:
Getrc5(address , Command)
   If Address = 0 Then                                           īˆ  īˆ īˆēī‹īŠ§ī‰ĒīŠ°īŠģīˆ ī‰—īŠŋī‰‚ī‹ƒīˆ•īŠģī‰
       Command = Command And &B01111111             īˆ  īˆ TVīˆ ī‰Ģī‰‚ī‹ˆī‰•īˆ ī‹†ī‰ī‹Œī‹„īŠ§īˆ ī‹Œī‹‡īˆ ī‹†ī‰‚īŠˇīˆ ī‰‚īŠŋīˆ ī‰ī‰§ī‰‡īˆ ī‹†ī‰ī‹Œī‹„īŠ¨īŠģī‰īˆ ī‰ˇī‰šīŠ¯
      Cls
       Lcd "Command is: " ; Command                  īˆ ī‰Ģī‰‚ī‹ˆī‰•īˆ īŠŸīˆ īŠĸī‹ŒīŠŦī‰ēīŠī‰īˆ ī‰ ī‰‚ī‰ŽīŠ°īŠī‰‚ī‰‰īˆ īŠąī‹ī‰ĒīŠ¨ī‰īˆ ī‹’īŠ§ī‰‚ī‰Šī‰ŋī‹‹īˆ ī‰ˇī‰šīŠ¯
      Waitms 50                                       īˆ  īˆ īˆŽī‹ī‰Žī‹Žī‹–ī‰ĒīŠģī‰īˆ ī‰—īŠŋī‰‚ī‹ƒīˆ•īŠģī‰īˆ īŠ•ī‰‡īˆ ī‹‘ī‰Ĩī‹ŒīŠ¨īŠģī‰īˆ ī‹ī‰‘īˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰
   End If
Return
'---------------------

                                                                                                 īˆ  īˆ 




Faculty of Electrical and Electronic Eng.   77                  Automatic Control & Automation Dept.
ī‹‘ī‰ĒīŠŦī‰ļīŠī‰īˆ ī‰ī‰‚ī‹€īŠ¸ī‰šī‰ŽīŠī‰īˆ ī‹’īŠ‰ī‰Ēī‰‰                                                                          īˆ  īˆ  ī‹’īŠ¨ī‰‰ī‰ī‰ĒīŠģī‰īˆ ī‹’ī‰ŽīŠŧīŠ†ī‰

      Exp.13: IR transmi er, RC5-code                    īˆ  īˆ RC5īˆ ī‰Šī‰‚ī‹ŽīŠ¨īŠī‰īˆ īŠĩīŠ¯ī‹‹īˆ IR īˆ īˆ īŠžī‰‚ī‰­ī‰Šī‰‡īˆ ī‹‘ī‰Šī‰ī‰Ĩīˆ īˆēī‰Ēī‰˛īŠ§īˆ ī‹’ī‰’īŠģī‰‚ī‰’īŠģī‰īˆ ī‹’ī‰‰ī‰Ēī‰–ī‰ŽīŠģī‰


                                                                                           īˆ  īˆ īˆēī‹’ī‰‰ī‰Ēī‰–ī‰ŽīŠģī‰īˆ ī‹…īŠŋīˆ ī‹’ī‹ī‰‚īŠŦīŠģī‰
                                                  īˆ  īˆ īˆŽRC5īˆ ī‰Šī‰‚ī‹ŽīŠ¨īŠī‰īˆ īŠĩīŠ¯ī‹‹īˆ ī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ ī‰īŠ„īˆ ī‹’īŠ¨ī‰ąī‰ƒīˆ īŠžī‰‚ī‰­ī‰Šī‰‡īˆ ī‹‘ī‰Šī‰ī‰Ĩīˆ ī‹•ī‰‚ī‹„ī‰‰ī‹‹īˆ īŠŊī‹Žī‰ĩī‹Œī‰
                                                                                             īˆ  īˆ īˆēīŠŊī‹Žī‰ĩī‹Œī‰ŽīŠģī‰īˆ īŠĄī‹ąīŠ‹




īˆ  īˆ 
                                                                                             īˆ  īˆ īˆēī‹‘ī‰Šī‰ī‰ĻīŠģī‰īˆ īŠŊī‹€īŠ§īˆ ī‰ ī‰Ēī‰ą
      RC5, ī‰ī‹œī‹ŒīŠˇī‹Œī‰ī‹‹īˆ•īŠģī‰īˆ  īŠĩīŠ¯ī‹‹īˆ  ī‰ĻīŠ¨ī‰‰īˆ  ī‹…īŠ§īˆ  ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ  ī‰žī‰ī‰ĒīŠĢī‹žīˆ  ī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ  ī‰īŠ„īˆ  ī‹’īŠ¨ī‰ąī‰ƒīˆ  īŠŊī‰­ī‰ĒīŠŋīˆ  ī‹’īŠ‰ī‰Ēī‰‰ī‹‹īˆ  īŠŊī‹Žī‰ĩī‹Œī‰Žī‰‰īˆ  ī‹‚ī‹ŒīŠ´ī‹ƒīˆ  īŠ˛ī‹Œī‰­
                                    īˆ  īˆ īˆŽī‰¸ī‰‚ī‰Ąīˆ ī‹īŠ¸īŠ„īˆ ī‰Ģī‰‚ī‹ˆī‰•īˆ ī‹ī‹€ī‰ļī‹ƒīˆ ī‹†ī‰ƒīˆ ī‹…īŠ¸īŠ™īˆ ī‹’ī‹ī‰‚ī‹ˆī‹„īŠģī‰īˆ īŠŸīˆ ī‰‚ī‹„ī‹ƒī‰ƒīˆ ī‹ī‰ƒīˆ īˆŽRC5-Extended
                                                                                          īˆ  īˆ īˆēīŠŊī‹Žī‰ĩī‹Œī‰ŽīŠģī‰īˆ ī‰ī‰‚ī‰ŠīŠŧī‹ąī‰ŽīŠŋ
                īˆŽī‰Šī‰‚ī‹ˆīŠŖī‹ĸī‰īˆ ī‹’ī‰ąī‰‚ī‰ąīˆ īŠŊī‹ŽīŠŦī‰˛ī‰ŽīŠģīˆ SW2īˆ ī‰ ī‰‚ī‰ŽīŠ°īŠī‰īˆ īŠļī‹īŠĢī‰‡īˆ īŠšīŠģī‰¨īŠˇī‹‹īˆ .Jumperīˆ ī‹‚ī‰ī‰Ļī‰ĸī‰Žī‰­ī‰‚ī‰‰ JP17īˆ īŠŊī‰ĩī‹ŒīŠģī‰īˆ ī‹’ī‹ąīŠ´ī‹ƒīˆ īŠļī‹īŠĢī‰‡īˆ ī‰‹īŠ
                                                                                          īˆ  īˆ īˆēī‹‘ī‰Ļī‹ī‰ĻīŠ†ī‰īˆ ī‰ī‰‚ī‹€ī‹ŽīŠŧīŠ¨ī‰ŽīŠģī‰
                                      īˆ  īˆ īˆēīŠ”ī‰Žī‹Žī‰­ī‰‚ī‰­ī‰ƒīˆ īŠ”ī‰Žī‹Žī‹€ī‹ŽīŠŧīŠ¨ī‰īˆ īŠ•ī‰‡īˆ ī‰˜ī‰‚ī‰ŽīŠīˆ ī‰‚ī‹„ī‹ƒī‰ˆīŠ¯īˆ ī‹’ī‹ī‰Ēī‰˛īŠ§īˆ ī‰ī‰­īˆ ī‰œī‹Žī‰ī‰‚īŠ°īŠŋīˆ ī‹’ī‰™ī‹ŒīŠģīˆ ī‹‘ī‹•ī‰ī‰ĒīŠŗīˆ īŠŊī‰•ī‰ƒīˆ ī‹…īŠŋ
                      īˆ  īˆ  ī‹’ī‹ŽīŠ‰īˆ•īŠģī‰īˆ ī‹’ī‹€ī‹ŽīŠŧīŠ¨ī‰ŽīŠģī‰                                 īˆ  īˆ  ī‹’ī‹€ī‹ŽīŠŧīŠ¨ī‰ŽīŠģī‰īˆ ī‰ ī‰Ēī‰ą
                                                         īˆ ī‰‹ī‹ąīŠ´īŠģī‰īˆ  ī‹“īŠŧīŠ§īˆ  ī‰ĒīŠŋī‹žī‰ī‹‹īˆ  ī‹†ī‰ī‹Œī‹„īŠ¨īŠģī‰ī‹‹īˆ  ī‹’īŠģī‰‚īŠ‡ī‰īˆ  ī‰ī‰‰īˆ  īŠžī‰‚ī‰­ī‰Šī‰‡īˆ  ī‹’ī‹€ī‹ŽīŠŧīŠ¨ī‰
īˆ  īˆ Rc5send          Togbit , Address , Command
                                                                                 RC5īˆ īŠžī‹ŒīŠˇī‹Œī‰ī‹‹īˆ•īŠģī‰īˆ īŠĩīŠ¯ī‹‹īˆ OC1A
      ī‹’ī‰ŽīŠ—ī‹žī‰ī‹‹īˆ ī‹īŠģī‹ ī‰īˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‹’ī‰­ī‰Ļī‹„ī‹‡īˆ ī‹ī‰ŽīŠŗ                      78                        ī‹’ī‹Žī‹ƒī‹‹īˆ–īŠ¸īŠģī‹ĸī‰ī‹‹īˆ ī‹’ī‹Žī‹–ī‰‚ī‰‰ī‰Ēī‹ˆīŠ¸īŠģī‰īˆ ī‹’ī‰­ī‰Ļī‹„īˆšī‰īˆ ī‹’ī‹ŽīŠŧīŠˇ
Practical Class 4                                                     Programming Microcontrollers

                                                                          īˆ  īˆ īˆēī‹‘ī‰Šī‰ī‰ĻīŠģī‰īˆ īŠŊī‹ŽīŠŦī‰˛ī‰īˆ ī‰—īŠŋī‰‚ī‹ƒī‰Ēī‰‰
$regfile = "m128def.dat"
$crystal = 8000000                                                 īˆ  īˆ īˆŽī‰ī‰‚ī‹ˆī‹Žī‰•ī‹Œī‰ŽīŠģī‰
'---------------------
Config Debounce = 200
                                                    īˆ  īˆ īˆŽīŠžī‰‚ī‰­ī‰Šī‹ĸī‰īˆ ī‰ ī‰‚ī‰ŽīŠ°īŠŋīˆ īŠŠīŠŋīˆ īŠŊī‰ĩī‹ŒīŠī‰īˆ ī‰‹ī‹ąīŠ´īŠģī‰īˆ īŠąī‹ī‰ĒīŠ¨ī‰
Config Pine.4 = Input
Porte.4 = 1
'---------------------
Dim Togbit As Byte , Command As Byte ,
Address As Byte
                                                                īˆ  īˆ ī‰ī‹œī‹Œī‰šī‰ŽīŠī‰īˆ īŠąī‹ī‰ĒīŠ¨ī‰
Command = 12                                                 īˆ  īˆ ī‰ī‹œī‹Œī‰šī‰Žī‹€īŠŧīŠģīˆ ī‹ī‹ŽīŠ´īŠģī‰īˆ ī‰Ĩī‰‚ī‹„ī‰­ī‰‡
Togbit = 0
Address = 0
'---------------------
Do
                                                   īˆ ī‹“īŠŧīŠ§īˆ ī‰ĒīŠŋī‹žī‰īˆ īŠžī‰‚ī‰­ī‰Šī‰‡īˆ ī‰‚ī‹ˆī‹ŽīŠ¯īˆ ī‹ī‰Žī‹īˆ ī‹ī‰Žī‹Žī‹–ī‰ĒīŠģī‰īˆ ī‰—īŠŋī‰‚ī‹ƒīˆ•īŠģī‰īˆ ī‹’īŠ´īŠŧī‰™
   Debounce Pine.4 , 0 , Pwr_cmd , Sub
Loop                                             īˆ  īˆ īˆŽī‰ ī‰‚ī‰ŽīŠ°īŠī‰īˆ īŠĄīŠŦī‰šīˆ īˆƒīˆ ī‰‚ī‹€īŠŧīŠˇ OC1A pin īˆ ī‰‹ī‹ąīŠ´īŠģī‰
                                                                        īˆ  īˆ 
End
'---------------------

Pwr_cmd:
   Rc5send Togbit , Address , Command            īˆ ī‹‘ī‰Ĩī‹ŒīŠ¨īŠģī‰īˆ ī‹ī‰‘īˆ ī‹†ī‰ī‹Œī‹„īŠ¨īŠģī‰ī‹‹īˆ ī‰ĒīŠŋī‹žī‰īˆ īŠžī‰‚ī‰­ī‰Šī‰‡īˆ ī‹‰ī‹ŽīŠ¯īˆ ī‹ī‰Žī‹īˆ ī‹īŠ§ī‰ĒīŠ°īŠģīˆ ī‰—īŠŋī‰‚ī‹ƒīˆ•īŠģī‰
   Waitms 200
Return                                                        īˆ  īˆ īˆŽī‹ī‰Žī‹Žī‹–ī‰ĒīŠģī‰īˆ ī‰—īŠŋī‰‚ī‹ƒīˆ•īŠģī‰īˆ īŠ•ī‰‡
'-------------


                                                                                                 īˆ  īˆ 
īˆ                                   īˆ 




Faculty of Electrical and Electronic Eng.   79                Automatic Control & Automation Dept.
ī‹‘ī‰ĒīŠŦī‰ļīŠī‰īˆ ī‰ī‰‚ī‹€īŠ¸ī‰šī‰ŽīŠī‰īˆ ī‹’īŠ‰ī‰Ēī‰‰                                                                               īˆ  īˆ  ī‹’īŠ¨ī‰‰ī‰ī‰ĒīŠģī‰īˆ ī‹’ī‰ŽīŠŧīŠ†ī‰

Appendix: Exp.12 and Exp.13                                           īˆ  īˆ īˆ īˆēī‹‘ī‰Ēī‰˛īŠ§īˆ ī‹’ī‰’īŠģī‰‚ī‰’īŠģī‰ī‹‹īˆ ī‹’ī‹Žī‹ƒī‰‚ī‰’īŠģī‰īˆ ī‹’ī‰‰ī‰Ēī‰–ī‰ŽīŠŧīŠģīˆ īŠĩī‰šīŠŧīŠŋ


                       RC5-codeīˆ ī‰Šī‰‚ī‹ŽīŠ¨īŠī‰ī‹‹īˆ ī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ ī‰īŠ„īˆ ī‹’īŠ¨ī‰ąī‹žī‰‚ī‰‰īˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‰Ģī‰‚ī‹ˆī‰•īˆ ī‹…īŠ§īˆ īŠŊī‰ļīŠ°īŠŋīˆ ī‰ ī‰Ēī‰ą
                               Detailed Article about Remote Control and IR Module

What is infrared?                                                             īˆ  īˆ īˆŋī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ ī‰īŠ„īˆ ī‹’īŠ¨ī‰ąī‹žī‰īˆ ī‹ī‹‡īˆ ī‰‚īŠŋ
īˆ ī‰īŠ„īˆ ī‹’īŠ¨ī‰ąī‹žī‰īˆ ī‹†ī‰‡īˆ ī‹’īŠ´ī‹ŽīŠ´īŠ‡ī‰īˆ īŠŸīˆ īˆŽī‰‚ī‹„ī‹Žī‹ŽīŠ§ī‹žīˆ ī‹’ī‹Žī‹–ī‰ĒīŠī‰īˆ ī‰ī‰ī‰Ĩī‰Ĩīˆ–īŠģī‰īˆ ī‹’īŠŋī‰Ŧī‰™īˆ ī‰īŠ„īˆ īŠŠīŠ´ī‹īˆ ī‹ī‹–ī‰ĒīŠŋīˆ īˆ—īŠĢīˆ ī‹ī‹–ī‹Œī‰šīˆ īŠĒī‰‚īŠ¨ī‰ąī‰‡īˆ ī‹’īŠŗī‰‚ī‰ŋīˆ ī‹…īŠ§īˆ ī‹‘ī‰Šī‰‚ī‰ŠīŠ§īˆ ī‹ī‹‡
īˆ ī‹†ī‰ƒīˆ īŠ”īŠ¨īŠŧīŠģīˆ ī‹…īŠ¸īŠ™īˆ ī‹œīˆ ī‰ī‰¨īˆšīˆ ī‹ĩī‰ī‰Ļī‰•īˆ ī‹‘īˆ—ī‰ļīŠŗīˆ ī‹’ī‰•ī‹ŒīŠŋīˆ ī‹ī‹‡ī‹‹īˆ  950nmīˆ ī‹’īŠ¨ī‰ąī‹žī‰īˆ ī‹Šī‰¨īˆšīˆ ī‹‰ī‰•ī‹ŒīŠī‰īˆ īŠžī‹Œī‰ŋīˆ īŠ­īŠŧī‰Šī‹īˆ ī‹īŠ¨ī‹Žī‰Šī‰ŋīˆ ī‹•ī‹Œī‰šīˆ ī‹ī‹‡īˆ ī‹•ī‰ī‰Ēī‹€īŠ‡ī‰
                                                            īˆ  īˆ īˆŽī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ ī‰īŠ„īˆ ī‹’īŠ¨ī‰ąī‹žī‰īˆ īŠŊī‰­ī‰ĒīŠŋīˆ ī‹…īŠŋīˆ ī‰“īŠ¨ī‰Šī‹„īŠī‰īˆ ī‹•ī‹Œī‰ēīŠģī‰īˆ ī‹”ī‰Ēī‰



                         īˆ  īˆ 
īˆ īˆŦī‹ī‹–ī‰ĒīŠŋīˆ  īŠžī‰‚īŠ‰īˆ  ī‹…ī‹€ī‰šīˆ  īŠšīŠģī‰§ī‹‹īˆ  ī‹‘ī‰Ŧī‹ˆī‰•ī‹žī‰‚ī‰‰īˆ  ī‰ĻīŠ¨ī‰‰īˆ  ī‹…īŠ§īˆ  ī‹īŠ¸ī‰šī‰ŽīŠŧīŠģīˆ  ī‰‚ī‹ˆīŠŧī‹ˆī‰­ī‰ƒī‹‹īˆ  īŠļī‰Ēī‹ąīŠģī‰īˆ  ī‰ˇī‰Ąī‰Šī‰ƒīˆ  ī‹…īŠŋīˆ  ī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ  ī‰īŠ„īˆ  ī‹’īŠ¨ī‰ąī‹žī‰īˆ  īˆ•ī‰ŽīŠ¨ī‰
īˆ ī‹’īŠģī‹Œī‹ˆī‰­īˆ īŠ•ī‰‡īˆ ī‹’īŠ¯ī‰‚ī‰šī‹ĸī‰‚ī‰‰īˆ īˆŽī‹ī‹–ī‰ĒīŠī‰īˆ ī‰žī‰ĒīŠ¨īŠģī‰ī‹‹īˆ ī‹ī‹€īŠŗī‰ĒīŠģī‰īˆ īŠŊī‹Žī‰–ī‰Žī‰ŽīŠģī‰īˆ ī‹‘ī‰Ŧī‹ˆī‰•ī‰ƒī‹‹īˆ ī‹’ī‹ŽīŠģī‰Ŧī‹„īŠī‰īˆ ī‹’ī‹Žī‹–ī‰‚ī‰‰ī‰Ēī‹ˆīŠ¸īŠģī‰īˆ ī‹‘ī‰Ŧī‹ˆī‰•ī‹žī‰īˆ īŠŸīˆ ī‹‘ī‰Ēī‰’īŠ¸ī‰‰īˆ ī‹‚ī‰Ļī‰ĸī‰Žī‰Žī‰ī‹‹
īˆ īŠŠīŠŋīˆ  ī‹‚ī‰Ĩī‰‚ī‰ļī‰Žī‰īˆ  ī‹†ī‰ƒīˆ  ī‹…īŠ¸īŠ™īˆ  ī‰īŠŗī‹ŒīŠģī‰īˆ  ī‰¯īŠ°ī‹ƒīˆ  īŠŸīˆ  ī‰‚ī‹ˆī‹„īŠ¸īŠģī‹‹īˆ  īˆŦī‹ī‰Žī‹Žī‰ŋī‰‚ī‹„īŠŦīŠŋī‹‹ī‰Ēī‹ˆīŠ¸īŠģī‰īˆ  īŠŊī‰Ąī‰Ļī‰ŽīŠģī‰īˆ  ī‹…īŠŋīˆ  ī‹ī‹ƒī‰‚īŠ¨ī‰īˆ  ī‹œīˆ  ī‰‚ī‹ˆī‹ƒī‰ƒīˆ  ī‰‚ī‹€īŠˇīˆ  īˆŦī‰‚ī‹‡ī‰Ļī‹ŽīŠģī‹Œī‰
īˆ ī‰‚ī‹ˆī‹„īŠŋīˆ  īˆžīŠģī‰īˆ  ī‰ī‰‚īŠ§ī‰‚īŠ¨ī‰ąī‹ĸī‰īˆ  ī‹…īŠŋīˆ  ī‰ŧī‹ī‰ĒīŠ§īˆ  īŠąī‹Žī‰ŋīˆ  īŠžī‰‚īŠ‰īˆ  ī‹“īŠŧīŠ§īˆ  ī‹ī‹ŒīŠ„īˆ  ī‹ĩī‹ī‰’īŠŋīˆ  ī‰¯ī‹€ī‰˛īŠģī‰īˆ  ī‹’īŠ¨ī‰ąī‰„īŠˇīˆ  ī‹”ī‰Ēī‰Ąī‰ƒīˆ  ī‹•ī‰ī‰ĒīŠ›īˆ  ī‰īŠ„īˆ  ī‰ī‰‚īŠ§ī‰‚īŠ¨ī‰ąī‰‡
                                                īˆ  īˆ īˆŽīŠžī‰‚ī‰­ī‰Šī‹ĸī‰īˆ ī‹’ī‹ŽīŠģī‰‚īŠ¨īŠ¯īˆ ī‹“īŠŧīŠ§īˆ ī‹Šī‰Šī‹‹ī‰Ļī‰‰īˆ ī‰Ēī‰‘ī‹›ī‹Žī‰­īˆ ī‰ī‰¨ī‹‡ī‹‹īˆ īˆŦī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ ī‰īŠ„īˆ ī‹’īŠ¨ī‰ąī‹žī‰
īˆ īˆēī‹ĩī‹ī‰’īŠŋīˆ ī‰‚ī‹ƒī‰Ĩī‰‚ī‰Žī‰•ī‰„īŠˇīˆ ī‹‘ī‰Šī‰ī‰Ēī‰™īˆ ī‰Šī‰Ļī‰ļī‰īˆ īˆžīŠģī‰īˆ ī‹‚ī‰‚ī‰Žī‰•ī‹žī‰īˆ ī‹ĩī‰‚ī‰ĩī‹Œī‰Ąī‹‹īˆ īˆŦī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ ī‰īŠ„īˆ ī‹’īŠ¨ī‰ąī‹žī‰īˆ ī‰ĻīŠģī‹Œī‰īˆ ī‹†ī‰ƒīˆ ī‹…īŠ¸īŠ™īˆ ī‹•ī‰‚ī‹Žī‰ąī‹žī‰īˆ ī‹…īŠŋīˆ īˆ—ī‰’īŠˇīˆ ī‹†ī‰‡
īˆ ī‹’īŠ°ī‹ī‰ŦīŠī‰īˆ  ī‹’īŠ¨ī‰ąī‹žī‰īˆ  ī‹ī‰Ĩī‰‚īŠ°ī‰ŽīŠģīˆ  īŠŊī‰­ī‰ĒīŠī‰īˆ  ī‰Ģī‰‚ī‹ˆī‰–īŠŧīŠģīˆ  ī‹†ī‰ī‹Œī‹„īŠ§īˆ  ī‹‹ī‰ƒīˆ  ī‰ ī‰‚ī‰ŽīŠ°īŠŋīˆ  ī‹‚ī‰ī‰Ļī‰ĸī‰Žī‰­ī‰īˆ  ī‰‹īŠīˆ  īŠšīŠģī‰¨īŠģīˆ  īˆŦī‰Šī‰‚īŠ‡ī‰īˆ  ī‹•ī‰‚īŠī‰īˆ  īˆŦī‹†ī‰ī‰ĒīŠ¯ī‹žī‰īˆ  īˆŦī‰œī‹Žī‰‰ī‰‚ī‰ļīŠī‰
īˆ ī‰‚īˆšīˆ ī‰‹ī‹Žī‰–ī‰Žī‰Žī‹īˆ ī‹†ī‰ƒīˆ ī‰‹īŠīˆ īˆžīŠģī‰īˆ ī‹’ī‹ŽīŠ´ī‹ŽīŠ´īŠ‡ī‰īˆ ī‰ī‰‚ī‹ƒī‰‚ī‹Žī‰ŠīŠģī‰īˆ ī‹…īŠ§īˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠī‰īˆ īˆ•ī‰ĸī‹ŽīŠģī‹‹īˆ ī‹ī‰Šī‰ī‰Ēī‰™īˆ ī‰Šī‰ī‰Ļī‰ĩī‰‡īˆ ī‰‚īˆšīˆ īˆžīŠģī‰īˆ ī‹‚ī‰‚ī‰Žī‰•ī‹žī‰īˆ ī‹…īŠ§īˆ ī‹‘ī‰Šī‰Ĩī‰‚ī‰ļīŠģī‰
                                   īˆ  īˆ īˆŽīˆ¨AddressīˆŠīˆ ī‹†ī‰ī‹Œī‹„īŠ¨īŠģī‰īˆ ī‰Ÿī‰‰īˆ ī‹‰ī‹„īŠ§īˆ īˆ•īŠ¨ī‹ī‹‹īˆ ī‹ĩī‰‚īŠ´ī‰™ī‹œīˆ ī‹‰ī‰šī‰šī‹Œī‹ƒīˆ īŠ˛ī‹Œī‰­īˆ ī‰‚īŠŋīˆ ī‰ī‰¨ī‹‡ī‹‹īˆ īˆŦī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‹‚ī‰‚īŠ¤ī‹ƒ
īˆ 36KHZīˆ ī‹…ī‹€ī‰šīˆ ī‹Œī‹‡īˆ īŠŊī‰ēīŠ¯ī‹žī‰īˆ ī‹’īŠ¨ī‰ąī‹žī‰īˆ īŠžī‰‚īŠ‰ī‹‹īˆ  30KHZ – 60KHZīˆ īŠ”ī‰‰īˆ ī‰ ī‹‹ī‰īˆ–ī‰īˆ ī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ ī‰īŠ„īˆ ī‹’īŠ¨ī‰ąī‹žī‰īˆ ī‰ī‰ī‰Ĩī‰Ĩī‰Ēī‰īˆ ī‹’īŠŋī‰Ŧī‰™īˆ ī‹†ī‰‡
īˆ 36KHZ, 38KHZīˆ īŠ”ī‰ŽīŠŋī‰ŦīŠ‡ī‰īˆ ī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ ī‰īŠ„īˆ ī‹’īŠ¨ī‰ąī‹žī‰‚ī‰‰īˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‹‘ī‰Ŧī‹ˆī‰•ī‰ƒīˆ ī‹‚ī‰Ļī‰ĸī‰Žī‰Žī‰īˆ īŠšīŠģī‰¨īŠģīˆ īˆŽīˆ¨38KHZīˆŠīˆ ī‹‰īŠģī‹Œī‰™īˆ īˆžīŠģī‰īˆ ī‹‚ī‰ŦīŠ‡ī‰ī‹‹
īˆ ī‰Šī‹‹ī‰Ĩīˆ īŠžī‹ī‰Ąīˆ ī‹‘ī‰ĒīŠŋīˆ īŠąīŠģī‰ƒīˆ  36~38īˆ ī‰Œī‰¨ī‰‰ī‰¨ī‰Žī‹īˆ īŠ˛ī‹Œī‰­īˆ ī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ ī‰īŠ„īˆ ī‹’īŠ¨ī‰ąī‹ŸīŠģīˆ īŠŊī‰­ī‰ĒīŠī‰īˆ ī‹ī‹–ī‰‚ī‹„ī‰’īŠģī‰īˆ ī‹†ī‰ƒīˆ īˆŸīŠ¨ī‹īˆ ī‰ī‰¨ī‹‡ī‹‹īˆ ī‰ī‰‚īŠŋī‹ŒīŠŧīŠ¨īŠī‰īˆ īŠžī‰‚ī‰­ī‰Šī‹ĸ
                 īˆ  īˆ īˆŽī‹īŠ´ī‹ąī‹„īŠŋīˆ ī‰ĒīŠ°ī‰ĩīˆ ī‹’ī‹€ī‹ŽīŠŗīˆ īŠŊī‰•ī‰ƒīˆ ī‹…īŠŋīˆ ī‹…īŠˇī‰‚ī‰­īˆ ī‹†ī‹ŒīŠ¸ī‹Žī‰­ī‹‹īˆ īˆŦī‹īŠ´ī‹ąī‹„īŠŋīˆ ī‰Ļī‰™ī‰ī‹‹īˆ ī‹’ī‹€ī‹ŽīŠ´īŠģī‰īˆ īŠŊī‰•ī‰ƒīˆ ī‹…īŠŋīˆ ī‹’ī‹Žī‹ƒī‰‚ī‰‘īˆ ī‰Ļī‰™ī‰ī‹‹īˆ ī‹Šī‰Šī‰ĻīŠŗ
īˆ ī‰ī‰ī‰Ĩī‰Ĩīˆ–īŠģī‰īˆ  ī‹Šī‰¨ī‹‡īˆ  īŠžī‰‚ī‰ŠīŠ´ī‰Žī‰­ī‰īˆ  īŠŸīˆ  ī‹…ī‹€īŠ¸ī‰īˆ  ī‹’ī‰‰ī‹ŒīŠ¨ī‰ļīŠģī‰īˆ  ī‹…īŠ¸īŠģīˆ  īˆŦī‹’īŠŧī‹ˆī‰­īˆ  ī‹’īŠģī‰„ī‰ŽīŠŋīˆ  ī‹ī‹‡īˆ  36KHZ, 38KHZīˆ  ī‰Ĩī‰Ĩī‰Ēī‰īˆ  īŠžī‰‚ī‰­ī‰Šī‰‡īˆ  ī‹’īŠģī‰„ī‰ŽīŠŋīˆ  ī‹†ī‰‡
īˆ ī‰ŧīŠ¨ī‰‰īˆ ī‹‚ī‹ŒīŠ´ī‰īˆ ī‰‹ī‰Šī‰ŽīŠģī‰īˆ ī‰ī‰¨īˆšīˆ īˆŦīŠĄī‹Žīˆī‰īˆ ī‰—ī‹Žī‰–ī‰ēīŠģī‰īˆ ī‰ī‰ī‰Ĩī‰Ĩī‰Ēī‰īˆ ī‰‚ī‹ˆīŠ¨īŠŋīˆ ī‰ī‰ŠīŠˇī‰ī‰Ēī‰ī‹‹īˆ ī‹•ī‰ī‹Œīˆšī‰īˆ īˆ•īŠ§īˆ ī‰īŠŧīŠ´ī‰Žī‹ƒī‰īˆ ī‰ī‰ī‰Ĩī‰Ĩīˆ–īŠģī‰īˆ ī‹Šī‰¨ī‹‡īˆ ī‹†ī‰ƒīˆ ī‹ĩī‰‚ī‰ĩī‹Œī‰ļī‰Ąī‹‹
īˆ īŠšīŠ¯īˆ  ī‰ī‰ī‰Šī‰ī‰Ĩī‹‹īˆ  ī‹’īŠŋī‰ŦīŠ‡ī‰īˆ  ī‰ī‰‚ī‰šī‰ąī‰ĒīŠŋīˆ  ī‹“īŠŧīŠ§īˆ  ī‰‚ī‹ˆī‰Žī‹Žī‹„ī‰‰īˆ  īŠŸīˆ  ī‹ī‹ŒīŠ„īˆ  īˆžīŠģī‰īˆ  ī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ  ī‰īŠ„īˆ  ī‹’īŠ¨ī‰ąī‹žī‰īˆ  ī‰ī‹ī‰ŠīŠ´ī‰Žī‰ŽīŠŋīˆ  ī‰˜ī‰‚ī‰Žī‹ƒī‰ˆī‰‰īˆ  ī‰ī‰‚īŠˇī‰Ēī‰˛īŠģī‰

ī‹’ī‰ŽīŠ—ī‹žī‰ī‹‹īˆ ī‹īŠģī‹ ī‰īˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‹’ī‰­ī‰Ļī‹„ī‹‡īˆ ī‹ī‰ŽīŠŗ                           80                        ī‹’ī‹Žī‹ƒī‹‹īˆ–īŠ¸īŠģī‹ĸī‰ī‹‹īˆ ī‹’ī‹Žī‹–ī‰‚ī‰‰ī‰Ēī‹ˆīŠ¸īŠģī‰īˆ ī‹’ī‰­ī‰Ļī‹„īˆšī‰īˆ ī‹’ī‹ŽīŠŧīŠˇ
Practical Class 4                                                                   Programming Microcontrollers

īˆ īŠŊīŠ¸ī‰˛īŠģī‰īˆ  īˆ  īˆŽī‹’ī‹ŽīŠ´ī‹ŽīŠ´īŠ‡ī‰īˆ  ī‹‘ī‰Šī‰‚ī‰ąī‹ĸī‰īˆ  ī‰¸ī‹ī‰ĸī‰Žī‰­ī‰īˆ  ī‹“īŠŧīŠ§īˆ  ī‰ĻīŠ§ī‰‚ī‰Žī‹īˆ  ī‹Šī‰Šī‹‹ī‰Ļī‰‰īˆ  ī‰ī‰¨ī‹‡ī‹‹īˆ  īˆŦī‹’ī‰‰ī‹ŒīŠĢī‰ĒīŠŋīˆ  īˆ—īŠŦīŠģī‰īˆ  ī‹‚ī‰Ŧī‰šīŠŧīŠģīˆ  ī‰ˇīŠ´īŠģī‰īˆ  ī‰ī‰ī‰Šī‰ī‰Ĩī‹‹īˆ  īˆ—īŠ°ī‰˛ī‰ŽīŠģī‰
īˆ ī‹‘ī‰ĻīŠ§ī‰‚īŠŗīˆ  ī‹“īŠŧīŠ§īˆ  27uSīˆ  ī‹’īŠ¨ī‰‰ī‰ĒīŠŋīˆ  ī‹‘ī‰Šī‰‚ī‰ąī‰‡īˆ  īŠĩī‹Žī‰Šī‹ąī‰Žī‰‰īˆ  īŠšīŠģī‰§ī‹‹īˆ  īˆŦ36KHZīˆ  ī‰Ĩī‰Ĩī‰Ēī‰īˆ  īŠžī‰‚ī‰­ī‰Šī‰‡īˆ  īŠŊī‰•ī‰ƒīˆ  ī‹…īŠŋīˆ  ī‹’ī‹ąī‹Žī‰Žī‰‰īˆ  īŠžī‰‚ī‰­ī‰Šī‰‡īˆ  ī‹‘ī‰Šī‰ī‰Ĩīˆ  īŠ”ī‰Šī‹īˆ  ī‹īŠģī‰‚ī‰ŽīŠģī‰
               īˆ  īˆ īˆŽ2īˆ īŠŊīŠ¸ī‰˛īŠģī‰īˆ īŠŸīˆ ī‰‚ī‹€īŠˇīˆ ī‰‚ī‹ˆīŠŧī‹ī‰ĻīŠ¨ī‰ī‹‹īˆ ī‹’īŠŧī‰­ī‰ĒīŠī‰īˆ ī‹‘ī‰Šī‰‚ī‰ąī‹ĸī‰īˆ ī‹‚ī‹ī‰Žī‰­ī‰‚ī‰‰īˆ ī‹‚ī‹ŒīŠ´ī‹Žī‰­īˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠī‰īˆ ī‹†ī‰‡īˆ īˆŽ1īˆ īŠŊīŠ¸ī‰˛īŠģī‰īˆ ī‰Šī‹Œī‰Žī‰­ī‰Ŧī‹ƒī‰īˆ–īŠģī‰




         īˆ  īˆ                                                      īˆ  īˆ 
                     īˆ  īˆ 1īˆ īŠŊīŠ¸ī‰˛īŠģī‰                                              īˆ  īˆ 2īˆ īŠŊīŠ¸ī‰˛īŠģī‰
                           īˆ  īˆ īˆŽī‹‘ī‰Šī‰‚ī‰ąī‹ŖīŠģīˆ ī‹īŠ´ī‹ąī‹„īŠī‰īˆ ī‹”ī‹Œī‰Žī‰ŽīŠī‰īˆ ī‰ī‰ŽīŠ¸īŠ§īˆ ī‰ĻīŠŗīˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠī‰īˆ īŠŊī‰Ąī‰ī‰Ĩīˆ ī‹‘ī‰Ĩī‹Œī‰•ī‹ŒīŠī‰īˆ īŠŊī‹ī‰ĻīŠ¨ī‰ŽīŠģī‰īˆ ī‹‘ī‰Šī‰ī‰Ĩīˆ ī‹†ī‰ƒīˆ īŠĨī‰™ī‹ī‹ƒ

What is IR Transmiting pr ot ocol s?
                  t                                      īˆ  īˆ  īˆŋī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ ī‰īŠ„īˆ ī‹’īŠ¨ī‰ąī‹žī‰īˆ ī‹‚ī‰ī‰Ļī‰ĸī‰Žī‰­ī‰‚ī‰‰īˆ īŠžī‰‚ī‰­ī‰Šī‹ĸī‰īˆ īˆ—ī‹ī‰‚īŠ¨īŠŋīˆ ī‹ī‹‡ī‰‚īŠŋ
īˆ īˆŦRC5īˆ  īˆŦSIRCSīˆ  īˆŦNECīˆ īˆēī‰‚ī‹ˆī‹„īŠŋīˆ  īˆŦī‰ī‹ī‰ŠīŠ´ī‰Žī‰ŽīŠī‰īˆ  ī‰‚ī‹ˆī‹ŽīŠŧīŠ§īˆ  īŠŊī‹€īŠ¨ī‰īˆ  īˆžīŠģī‰īˆ  īˆ¨ī‰ī‹œī‹ŒīŠˇī‹Œī‰ī‹‹ī‰Ēī‰‰īˆŠīˆ  īŠžī‰‚ī‰­ī‰Šī‹ĸī‰īˆ  īˆ—ī‹ī‰‚īŠ¨īŠŋīˆ  ī‹…īŠŋīˆ  īˆ—ī‰’īŠ¸īŠģī‰īˆ  īŠēī‰‚ī‹„ī‹‡
īˆ ī‰‚ī‹ˆī‰Žī‹Žī‹„ī‰‰ī‹‹īˆ  īŠžī‰‚ī‰­ī‰Šī‹ĸī‰īˆ  ī‹’ī‰•ī‹ŒīŠŋīˆ  īŠŊīŠ¸ī‰ąīˆ  īŠŸīˆ  ī‰‚ī‹ˆī‰ēīŠ¨ī‰‰īˆ  ī‹…īŠ§īˆ  ī‰ī‹œī‹ŒīŠˇī‹Œī‰ī‹‹īˆ•īŠģī‰īˆ  ī‹Šī‰¨ī‹‡īˆ  īŠąīŠŧī‰ŽīŠ…ī‹‹īˆ  īˆŽSonyīˆ  īˆŦSAMSUNGīˆ  īˆŦJAPAN
                                                                                              īˆ  īˆ īˆ īˆŽīˆ¨WaveformsīˆŠ

RC5 Transmi ing protocols?                                                                   RC5īˆ īŠžī‰‚ī‰­ī‰Šī‹ĸī‰īˆ ī‰Šī‰‚ī‹ŽīŠ¨īŠŋ
īˆ 14īˆ  ī‹…īŠŋīˆ  ī‰Šī‰‚ī‹ąīŠŗīˆ  īŠžī‰‚ī‰­ī‰Šī‰ˆī‰‰īˆ  ī‰ˇī‰ĸīŠŧī‰Žī‹ī‹‹īˆ  ī‰¯ī‰ŠīŠŧī‹ŽīŠ¯īˆ ī‹’īŠˇī‰Ēī‰ąīˆ ī‹‰ī‰ī‰Šī‹Œī‰ŋīˆ  ī‹ī‰¨īŠģī‰īˆ  RC5īˆ ī‰Šī‰‚ī‹ŽīŠ¨īŠŋīˆ  ī‹“īŠŧīŠ§īˆ  ī‹īŠŧīŠˇīˆ  īŠŊīŠ¸ī‰˛ī‰‰īˆ  ī‰‹ī‰ļī‹„ī‹īˆ  ī‰‚ī‹„īŠŋī‰‚ī‹€ī‰Žī‹‡ī‰īˆ  ī‹†ī‰‡
īˆ ī‹…īŠŋīˆ ī‰Šī‰‚ī‹ąīŠ´īŠģī‰īˆ ī‰ī‰¨ī‹‡ī‹‹īˆ īˆŦī‹’ī‰ēī‰Šī‹ƒīˆ īŠŊīŠ¸īŠģīˆ 1.728mSīˆ ī‹…īŠŋī‰Ŧī‰‰ī‹‹īˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‰Ģī‰‚ī‹ˆī‰•īˆ ī‰Šī‰ī‰Šī‰Ģī‰ƒīˆ ī‰Ļī‰™ī‰ƒīˆ ī‹“īŠŧīŠ§īˆ īŠĄīŠŦī‰ēīŠģī‰īˆ ī‰‚ī‹ˆī‹ŽīŠ¯īˆ ī‹ī‰Žī‹īˆ ī‹‘ī‰ĒīŠŋīˆ īŠŊīŠˇīˆ īŠŸīˆ ī‹’ī‰ēī‰Šī‹ƒ
                                                       īˆ  īˆ īˆŽī‹ĩī‰‚ī‰ŋī‹ŒīŠŦī‰ēīŠŋīˆ ī‰ ī‰‚ī‰ŽīŠ°īŠī‰īˆ ī‰ī‹ŽīŠ´ī‰‰ī‰ƒīˆ ī‰ī‰§ī‰‡īˆ 130mSīˆ īŠŊīŠˇīˆ ī‰Šī‰ĒīŠ¸ī‰Žī‹īˆ ī‰ī‰‚ī‰ēī‰Šī‹„īŠģī‰
                                            īˆ  īˆ īˆēī‹’ī‹ŽīŠģī‰‚ī‰ŽīŠģī‰īˆ ī‰ī‰īˆ–īŠŋī‰ī‰Šī‰‚ī‰ŠīŠģī‰īˆ īŠ•ī‰‡īˆ īŠ˛ī‰ĒīŠ¨ī‰ŽīŠģī‰īˆ ī‰‹īŠīˆ īŠžī‹ŒīŠˇī‹Œī‰ī‹‹īˆ•īŠģī‰īˆ ī‰ī‰¨ī‹‡īˆ īŠŊī‹€īŠ§īˆ ī‰ƒī‰Ļī‰ŠīŠŋīˆ ī‹ī‹ˆīŠ°īŠģī‹‹
                                                                       īˆŽīˆ¨Address LengthīˆŠīˆ ī‹†ī‰ī‹Œī‹„īŠ¨īŠģī‰īˆ īŠžī‹Œī‰ŋ -
                                                              īˆŽīˆ¨Command LengthīˆŠīˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‰ĒīŠŋī‰ƒīˆ īŠžī‹Œī‰ŋ -
                                                                   īˆŽīˆ¨Carrier Frequency īˆŠīˆ īŠŊīŠŗī‰‚ī‹„īŠģī‰īˆ ī‰Ĩī‰Ĩī‰Ēī‰ -
                                                                  īˆŽīˆ¨Start BitīˆŠīˆ īŠžī‰‚ī‰­ī‰Šī‹ĸī‰īˆ ī‹’ī‹ī‰ī‰Ļī‰‰īˆ ī‹’ī‰ēī‰Šī‹ƒīˆ ī‹…īŠŋī‰Ģ -
                                              īˆŽīˆ¨High-Bit-TimeīˆŠīˆ "1"īˆ ī‹īŠ´ī‹ąī‹„īŠī‰īˆ ī‹”ī‹Œī‰Žī‰Žī‹€īŠŧīŠģīˆ īŠžī‰‚ī‰­ī‰Šī‹ĸī‰īˆ ī‹’ī‰ēī‰Šī‹ƒīˆ ī‹…īŠŋī‰Ģ -
                                               īˆŽīˆ¨Low-Bit-TimeīˆŠīˆ "0"īˆ ī‹īŠ´ī‹ąī‹„īŠī‰īˆ ī‹”ī‹Œī‰Žī‰Žī‹€īŠŧīŠģīˆ īŠžī‰‚ī‰­ī‰Šī‹ĸī‰īˆ ī‹’ī‰ēī‰Šī‹ƒīˆ ī‹…īŠŋī‰Ģ -
                                                                   īˆŽīŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠī‰īˆ īŠĒī‹Œī‹ƒīˆ ī‰‹ī‰Žī‰™īˆ īŠąīŠŧī‰ŽīŠ…īˆ ī‰ī‰īˆ–īŠŋī‰ī‰Šī‰‚ī‰ŠīŠģī‰īˆ ī‹Šī‰¨ī‹‡īˆ ī‹†ī‰‡
īˆ ī‰‚ī‹€ī‹ˆī‹„īŠŋīˆ īŠŊīŠ¸īŠģī‹‹īˆ īˆŦī‹ī‰Šī‰‚ī‰Žī‹īˆ īŠąī‰ļī‹ƒī‹‹īˆ īˆŸī‹ŽīŠ™īˆ īŠąī‰ļī‹ƒīˆ ī‹‰īŠģīˆ īˆēīŠ”ī‹€ī‰ŽīŠŗīˆ īŠ•ī‰‡īˆ ī‹ī‰ŽīŠ´ī‹„īŠŋīˆ ī‰Ļī‰™ī‰ī‹‹īˆ ī‰ī‰‰īˆ ī‹ī‹‡īˆ ī‰ī‰‚ī‰ēī‰Šī‹„īŠģī‰īˆ ī‰Šī‰‚ī‹ąīŠŗīˆ ī‹…īŠŋīˆ ī‹’ī‰ēī‰Šī‹ƒīˆ īŠŊīŠˇīˆ ī‹†ī‰‡
īˆ ī‹ī‰ŽīŠ´īŠģī‰īˆ ī‹†ī‰ˆīŠ¯īˆ īˆŦī‹īŠ´ī‹ąī‹„īŠŋīˆ ī‰Ļī‰™ī‰ī‹‹īˆ ī‹Œī‹‡īˆ īŠžī‰‚ī‰­ī‰Šī‹ĸī‰īˆ īŠ˛ī‰Ēī‰ŋīˆ ī‹…īŠŋīˆ īŠŊī‰­ī‰ĒīŠī‰īˆ ī‰ī‰ŠīŠģī‰īˆ ī‹†ī‰‚īŠˇīˆ ī‰ī‰§ī‰ˆīŠ¯īˆ īˆŽī‹ĩī‰‚ī‹€ī‹–ī‰ī‰Ĩīˆ ī‰Ēī‰Ąī‹ĄīŠģīˆ ī‰¯īŠˇī‰‚īŠ¨īŠŋīˆ ī‹īŠ´ī‹ąī‹„īŠŋīˆ ī‹”ī‹Œī‰Žī‰ŽīŠŋ
Faculty of Electrical and Electronic Eng.                   81                Automatic Control & Automation Dept.
ī‹‘ī‰ĒīŠŦī‰ļīŠī‰īˆ ī‰ī‰‚ī‹€īŠ¸ī‰šī‰ŽīŠī‰īˆ ī‹’īŠ‰ī‰Ēī‰‰                                                                            īˆ  īˆ  ī‹’īŠ¨ī‰‰ī‰ī‰ĒīŠģī‰īˆ ī‹’ī‰ŽīŠŧīŠ†ī‰

 īˆ īŠŊī‰­ī‰ĒīŠī‰īˆ ī‰ī‰ŠīŠģī‰īˆ ī‹†ī‰‚īŠˇīˆ ī‰ī‰§ī‰‡ī‹‹īˆ īˆŦī‹īŠ´ī‹ąī‹„īŠŋīˆ ī‰ĒīŠ°ī‰ĩīˆ ī‹†ī‹ŒīŠ¸ī‹Žī‰­īˆ ī‹ī‰Šī‰‚ī‰Žī‹ŽīŠģī‰īˆ ī‹ī‰ŽīŠ´īŠģī‰īˆ ī‰‚ī‹€ī‹„ī‹Žī‰‰īˆ īˆŦī‹īŠ´ī‹ąī‹„īŠŋīˆ ī‰Ļī‰™ī‰ī‹‹īˆ ī‹†ī‹ŒīŠ¸ī‹Žī‰­īˆ ī‰ī‰ŠīŠģī‰īˆ ī‹…īŠŋīˆ īˆŸī‹Žī‹€ī‹ŽīŠģī‰
                                                  īˆ  īˆ īˆŽī‹ĩī‰‚īŠŋī‰‚īŠ—īˆ ī‹’īŠ´ī‰‰ī‰‚ī‰ŽīŠģī‰īˆ ī‹’īŠģī‰‚īŠ‡ī‰īˆ ī‰¯īŠ¸īŠ§īˆ ī‹†ī‹ŒīŠ¸ī‰Žī‰ŽīŠ¯īˆ īˆŦī‹īŠ´ī‹ąī‹„īŠŋīˆ ī‰ĒīŠ°ī‰ĩīˆ ī‹Œī‹‡




                                 īˆ  īˆ ī‹‰īŠŧī‰ŠīŠ´ī‰Žī‰Žī‰īˆ īŠ˛ī‹Œī‰­īˆ ī‹ī‰¨īŠģī‰īˆ ī‹īŠ´ī‹ŽīŠ´īŠ‡ī‰īˆ īŠĩī‹ąī‹„īŠī‰īˆ īŠ”ī‰Šī‹īˆ īŠŊīŠ¸ī‰˛īŠģī‰
 īˆ ī‰ī‰ŠīŠŧīŠģīˆ ī‹īŠ´ī‹ąī‹„īŠī‰īˆ ī‹”ī‹Œī‰Žī‰ŽīŠī‰īˆ ī‰¯īŠ°ī‹ƒīˆ ī‹‰īŠģīˆ ī‹†ī‹ŒīŠ¸ī‹Žī‰­īˆ īˆŦīŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠī‰īˆ ī‰ī‰ŠīŠģī‰īˆ ī‹…īŠŋīˆ īˆŸī‹Žī‹€ī‹ŽīŠģī‰īˆ ī‹ī‰ŽīŠ´īŠģī‰īˆ ī‹†ī‰ƒīˆ ī‰—ī‰Žī‹„ī‰Žī‰Žī‰īˆ ī‹†ī‰ƒīˆ īŠšī‹„īŠ¸īŠ™īˆ īˆŦī‰Ēī‰Ąī‰…īˆ ī‹“ī‹„īŠ¨īŠ–
 īˆ ī‰Ļī‰™ī‰ī‹‹īˆ ī‹Œī‹‡īˆ īŠŊī‰­ī‰ĒīŠī‰īˆ ī‰ī‰ŠīŠģī‰īˆ ī‹†ī‰ƒīˆ īˆŸīŠ¨ī‹īˆ ī‰ī‰¨ī‹‡ī‹‹īˆ īˆŦī‹īŠ´ī‹ąī‹„īŠŋīˆ ī‰Ļī‰™ī‰ī‹‹īˆ ī‹”ī‹Œī‰Žī‰ŽīŠŋīˆ ī‰‚īˆšīˆ ī‹•ī‰‚īŠŗī‰Šī‰ŦīŠģī‰īˆ ī‹’ī‰ēī‰Šī‹„īŠģī‰īˆ ī‰ĻīŠƒīˆ īŠĩī‰‰ī‰‚ī‰ŽīŠģī‰īˆ īŠŊīŠ¸ī‰˛īŠģī‰īˆ ī‹…īŠŋīˆ īˆŦīŠŊī‰­ī‰ĒīŠī‰
                                                    īˆ  īˆ īˆŽī‹‰ī‰ŽīŠ¸īŠ§īˆ ī‹†ī‹ŒīŠ¸ī‹Žī‰­īˆ ī‹ī‰Šī‰‚ī‰Žī‹ŽīŠģī‰īˆ ī‹ī‰ŽīŠ´īŠģī‰īˆ ī‹…īŠ¸īŠģī‹‹īˆ īˆŦī‰‚ī‰ēī‹ī‰ƒīˆ ī‹īŠ´ī‹ąī‹„īŠŋ
 īˆ īˆ—īŠ°ī‰˛ī‰ŽīŠģī‰īˆ īŠēī‰‚īŠ¯īˆ ī‹‘ī‰Šī‰ī‰Ĩīˆ īŠ•ī‰‡īˆ īŠŊī‰ļī‰īˆ ī‹†ī‰ƒīˆ ī‰‹īŠīˆ  27Âĩsīˆ ī‰‚ī‹ˆī‹„īŠŋīˆ īŠŊīŠˇīˆ ī‰Šī‹‹ī‰Ĩīˆ īˆžīŠģī‰īˆ ī‰ī‰‚ī‰ēī‰Šī‹„īŠģī‰īˆ ī‹…īŠŋīˆ ī‰Ĩī‰ĻīŠŠīˆ ī‰Ĩī‰ĻīŠ§īˆ īŠēī‰‚ī‹„ī‹‡īˆ īŠžī‹ŒīŠˇī‹Œī‰ī‹‹īˆ•īŠģī‰īˆ ī‰ī‰¨ī‹‡īˆ īŠŸ
 īˆ ī‰ī‰¨ī‹‡īˆ īˆŦī‰˜ī‰ĒīŠˆī‰īˆ īŠ•ī‰‡īˆ ī‹‰īŠŧīŠ´ī‹ƒīˆ ī‹ī‰‘īˆ ī‹…īŠŋī‹‹īˆ ī‰œī‹Žī‰šī‰ļīŠģī‰īˆ ī‰Ĩī‰Ĩīˆ–īŠģī‰īˆ ī‹Œī‹‡īˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠī‰īˆ ī‰Ĩī‰Ĩīˆ–īŠģī‰īˆ ī‹†ī‰ƒīˆ ī‹ī‹ˆīŠ°ī‹ŽīŠģīˆ īˆ¨demodulatorīˆŠīˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠī‰īˆ īŠŊī‰Ąī‰ī‰Ĩīˆ ī‹‘ī‰Ĩī‹Œī‰•ī‹ŒīŠī‰
 īˆ 64īˆ ī‹īŠģī‰‚ī‰ŽīŠģī‰‚ī‰‰ī‹‹īˆ īˆŦīŠžī‰‚ī‰­ī‰Šī‹ĸī‰īˆ ī‰ī‰‚ī‰Žī‰‰īˆ ī‹…īŠŋīˆ ī‰ī‰‰īˆ īŠŊīŠˇīˆ ī‹…īŠŋīˆ ī‹ī‰ŽīŠŗīˆ īŠŊīŠ¸īŠģīˆ ī‹’ī‰ēī‰Šī‹ƒīˆ 32īˆ ī‹Œī‹‡īˆ ī‰¯ī‰ŠīŠŧī‹ŽīŠ¯īˆ ī‹’īŠˇī‰Ēī‰ąīˆ ī‰ī‹ī‰ŠīŠ´ī‰Žī‰ŽīŠīˆ ī‰ī‰‚ī‰ēī‰Šī‹„īŠģī‰īˆ ī‹…īŠŋīˆ ī‰Ĩī‰ĻīŠ¨īŠģī‰
 īˆ 32īˆ īŠŊī‹ī‰ĻīŠ¨ī‰ŽīŠģī‰īˆ īŠšīŠ¯īˆ ī‹’īŠŧī‰™ī‰ĒīŠŋīˆ īŠŸīˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠī‰īˆ īŠ˛ī‰Ēī‰ŋīˆ īŠŸīˆ ī‰‚ī‹„ī‹ī‰ĻīŠģīˆ ī‹†ī‹ŒīŠ¸ī‹Žī‰­īˆ ī‹‰ī‹ƒī‰ˆīŠ¯īˆ  "0"īˆ īŠžī‰‚ī‰­ī‰Šī‰‡īˆ īŠŊī‰•ī‰ƒīˆ ī‹…īŠŋīˆ ī‹‰ī‹ƒī‰ˆīŠ¯īˆ ī‹‰ī‹ŽīŠŧīŠ§ī‹‹īˆ īˆŽī‰ī‰‰īˆ īŠŊīŠ¸īŠģīˆ ī‹’ī‰ēī‰Šī‹ƒ
                                               īˆ  īˆ īˆŽ32 x 27Âĩs of silenceīˆ ī‰‚ī‹ˆī‹ŽīŠŧī‹īˆ ī‹ī‰‘īˆ 27Âĩsīˆ ī‰‚ī‹ˆī‹„īŠŋīˆ īŠŊīŠˇīˆ ī‰Šī‹‹ī‰Ĩīˆ ī‹’īŠ¨ī‰‰ī‰ĒīŠŋīˆ ī‹’ī‰ēī‰Šī‹ƒ
 īˆ ī‹’īŠ¨ī‰‰ī‰ĒīŠŋīˆ ī‹’ī‰ēī‰Šī‹ƒīˆ  32īˆ ī‰‚ī‹ˆī‹ŽīŠŧī‹īˆ ī‹ī‰‘īˆ  32 x 27Âĩs of silenceīˆ īˆŦī‹ĩī‰‚īŠŋī‰‚īŠ—īˆ ī‹’ī‰ŽīŠˇī‰‚īŠ¨īŠī‰īˆ ī‹’īŠģī‰‚īŠ‡ī‰īˆ ī‰‚ī‹„ī‹ī‰ĻīŠģīˆ ī‹†ī‹ŒīŠ¸ī‹Žī‰­īˆ īˆ  "1"īˆ īŠžī‰‚ī‰­ī‰Šī‰‡īˆ īŠŊī‰•ī‰ƒīˆ ī‹…īŠŋīˆ ī‰‚ī‹€ī‹„ī‹Žī‰‰
                                                                                       īˆ  īˆ īˆŽ27Âĩsīˆ ī‰‚ī‹ˆī‹„īŠŋīˆ īŠŊīŠˇīˆ ī‰Šī‹‹ī‰Ĩ




                          īˆ  īˆ 
                             |   +---|                                 |---+   |
                             |   |   |                                 |   |   |
                             |   |   |                                 |   |   |
                             |---+   |                                 |   +---|
                              <----->                                   <----->
                              1.7778ms                                 1.7778ms
                              Logic 1                                   Logic 0
                                                                                                              īˆ  īˆ 




īˆ  īˆ 
                                  īˆ  īˆ RC5īˆ ī‰ŸīŠģīˆ īŠžī‰‚ī‰­ī‰Šī‹ĸī‰īˆ īŠžī‹ŒīŠˇī‹Œī‰ī‹‹ī‰Ēī‰‰īˆ īŠ”ī‰Šī‹īˆ īŠŊīŠ¸ī‰˛īŠģī‰

  ī‹’ī‰ŽīŠ—ī‹žī‰ī‹‹īˆ ī‹īŠģī‹ ī‰īˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‹’ī‰­ī‰Ļī‹„ī‹‡īˆ ī‹ī‰ŽīŠŗ                        82                        ī‹’ī‹Žī‹ƒī‹‹īˆ–īŠ¸īŠģī‹ĸī‰ī‹‹īˆ ī‹’ī‹Žī‹–ī‰‚ī‰‰ī‰Ēī‹ˆīŠ¸īŠģī‰īˆ ī‹’ī‰­ī‰Ļī‹„īˆšī‰īˆ ī‹’ī‹ŽīŠŧīŠˇ
Practical Class 4                                                                   Programming Microcontrollers

                                              īˆ  īˆ īˆēī‹īŠģī‰‚ī‰ŽīŠģī‰īˆ īŠŊīŠ¸ī‰˛īŠģī‰īˆ ī‹“īŠŧīŠ§īˆ ī‹ī‹–ī‰‚ī‹„ī‰‘īˆ 14Bitsīˆ ī‹…īŠŋīˆ RC5īˆ īŠžī‹ŒīŠˇī‹Œī‰ī‹‹ī‰Ēī‰‰īˆ ī‹†ī‹ŒīŠ¸ī‰Žī‹
īˆ  īˆ  Bit1 īˆ  īˆ  Bit2     Bit3      Bit4      Bit5 Bit6 Bit7 Bit8 Bit9 Bit10 Bit11 Bit12 Bit13 Bit14
 īˆ  īˆ  start bits īˆ  īˆ  control                   īˆ  īˆ  Address                         īˆ  īˆ  Command
 īˆ īŠšīŠŧīŠ—īˆ ī‹ĩī‰‚ī‹€ī‹–ī‰ī‰Ĩīˆ ī‹ī‹‡ī‹‹īˆ īˆ¨Start Bits or AGC "Automatic Gain ControlīˆĸīˆŠīˆ īŠžī‰‚ī‰­ī‰Šī‹ĸī‰īˆ ī‹’ī‹ī‰ī‰Ļī‰‰īˆ ī‰ī‰‚ī‰Žī‰‰īˆ ī‹ī‹‡īˆ  īˆēBits1-2 -
                                    īˆŽī‹’īŠ¨ī‰ąī‹žī‰īˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠŋīˆ ī‰œī‰‰ī‰Ēī‰‰īˆ ī‹īŠģī‹ ī‰īˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‹‘ī‰Ēī‹ī‰‚īŠ¨īŠŋīˆ īŠŸīˆ ī‰ĻīŠ§ī‰‚ī‰Žī‰īˆ ī‹ī‹‡ī‹‹īˆ īˆŽ"1"īˆ ī‹’ī‹€ī‹ŽīŠ´īŠģī‰
 īˆ ī‰ĒīŠ°ī‰ļīŠģī‰īˆ īŠ”ī‰‰īˆ ī‹‰ī‰Žī‹€ī‹ŽīŠŗīˆ īˆ—īŠŦī‰Žī‰īˆ ī‰ī‰ŠīŠģī‰īˆ ī‰ī‰¨ī‹‡īˆ īˆŦīˆ¨Control Bit or Toggle BitīˆŠīˆ  CHECK bitīˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‰ī‰‰īˆ ī‹Œī‹‡īˆ īˆēBit3 -
 īˆ ī‰ī‰§ī‰‡īˆ ī‹ī‹ˆīŠ°ī‹ŽīŠģīˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‰Ģī‰‚ī‹ˆī‰•īˆ ī‰Ļī‹ŽīŠ°ī‹īˆ ī‰ī‰¨ī‹‡īˆ īˆŽī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‰Šī‰ī‰Šī‰Ģī‰ƒīˆ ī‰Ļī‰™ī‰ƒīˆ īŠĄīŠŦī‰šīˆ ī‰‚ī‹ˆī‹ŽīŠ¯īˆ ī‹ī‰Žī‹īˆ ī‹‘ī‰ĒīŠŋīˆ īŠŊīŠˇīˆ īŠŸīˆ ī‹īŠ´ī‹ąī‹„īŠŋīˆ ī‰Ļī‰™ī‰ī‹ŒīŠģī‰ī‹‹
 īˆ īˆŦīŠĄīŠŦī‰ēīŠģī‰‚ī‰‰īˆ ī‰Ēī‹€ī‰Žī‰Žī‰ī‹‹īˆ ī‰Ļī‰™ī‰ī‹‹īˆ ī‹īŠŗī‰ĒīŠģī‰īˆ īŠĄīŠŦī‰ēī‰īˆ īŠšī‹ƒī‰īˆ ī‰Šī‹Œī‰ļī‰īˆ â€“īˆ ī‰ĒīŠŋī‹žī‰īˆ ī‰Šī‰ĒīŠ¸ī‰Žī‹ī‹‹īˆ ī‰Šī‰ī‰Šī‰Ģī‹žī‰īˆ ī‰Ļī‰™ī‰ƒīˆ ī‹“īŠŧīŠ§īˆ īŠĄīŠŦī‰ēī‰īˆ ī‰īŠģī‰Ģī‰‚īŠŋ
 īˆ ī‹…ī‹ī‰Šī‰‚ī‹ąīŠŗīˆ īŠŊī‰­īˆ—ī‰­īˆ ī‹‰ī‹ƒī‹žīˆ ī‰Ļī‰™ī‰ī‹‹īˆ ī‹‘ī‰‚ī‹„īŠ´īŠģī‰īˆ ī‹…īŠŋīˆ ī‹ĩī‹œī‰Ļī‰‰īˆ 11īˆ ī‹‘ī‰‚ī‹„īŠ´īŠģī‰īˆ ī‰Šī‰‚ī‹Žī‰Žī‰Ąī‰īˆ ī‰Ļī‹ī‰Ēī‰īˆ īŠšī‹ƒī‰īˆ ī‹ī‹ˆīŠ°ī‹Žī‰­īˆ ī‰Ģī‰‚ī‹ˆīŠ†ī‰īˆ ī‹†ī‰ˆīŠ¯īˆ ī‰ī‰ŠīŠģī‰īˆ ī‰ī‰¨ī‹‡īˆ ī‹œī‹ŒīŠŧīŠ¯
                                                                         īˆŽī‰‚ī‹ˆī‰ŽīŠ°ī‹ƒīˆ ī‹’ī‹€ī‹ŽīŠ´īŠģī‰īˆ ī‰‚ī‹€īˆšīˆ ī‰ī‰‚ī‰ēī‰Šī‹„īŠģī‰īˆ ī‹…īŠŋ
 īˆ ī‰‹ī‹Žī‰–ī‰Žī‰Žī‹īˆ ī‹†ī‰ƒīˆ ī‰‹īŠīˆ ī‹ī‰¨īŠģī‰īˆ ī‰Ģī‰‚ī‹ˆīŠ†ī‰īˆ īŠĒī‹Œī‹ƒīˆ ī‰Šī‰‚ī‹Žī‰Žī‰Ąī‰‚ī‰‰īˆ ī‹īŠģīˆ ī‰œī‹€ī‰Žī‰īˆ ī‹’ī‰Žī‹€īŠˆī‰īˆ ī‰ī‰‚ī‰Žī‰ŠīŠģī‰īˆ ī‹Šī‰¨ī‹‡īˆ īˆŦī‹†ī‰ī‹Œī‹„īŠ¨īŠģī‰īˆ ī‰ī‰‚ī‰Žī‰‰īˆ ī‹ī‹‡īˆ īˆēBits4-8 -
                             īˆēī‹īŠģī‰‚ī‰ŽīŠģī‰īˆ īŠŊīŠ¸ī‰˛īŠģī‰īˆ ī‹“īŠŧīŠ§īˆ ī‹ī‹‡ī‹‹īˆ īˆ¨2^5=32īˆŠīˆ ī‰Ģī‰‚ī‹ˆī‰•īˆ 32īˆ ī‰ŸīŠģīˆ ī‹’ī‹ƒī‹Œī‹„īŠ§īˆ ī‹īŠģīˆ īŠĩīŠ´īŠ„īˆ ī‹ī‹‡ī‹‹īˆ īˆŦī‰ĒīŠŋī‰ī‹‹ī‹ŸīŠģ
                          SYSTEM ADDRESS             EQUIPMENT
                                 0                   TV SET 1
                                 1                   TV SET 2
                                 2                   VIDEOTEXT
                                 3                   EXPANSION FOR TV 1 AND 2
                                 4                   LASER VIDEO PLAYER
                                 5                   VIDEO RECORDER 1 (VCR 1)
                                 6                   VIDEO RECORDER 2 (VCR 2)
                                 7                   RESERVED
                                 8                   SAT 1
                                 9                   EXPANSION FOR VCR 1 OR 2
                                10                   SAT 2
                                11                   RESERVED
                                12                   CD VIDEO
                                13                   RESERVED
                                14                   CD PHOTO
                                15                   RESERVED
                                16                   AUDIO PREAMPLIFIER 1
                                17                   RECEIVER / TUNER
                                18                   TAPE / CASSETE RECORDER
                                19                   AUDIO PREAMPLIFIER 2
                                20                   CD
                                21                   AUDIO RACK
                                22                   AUDIO SAT RECEIVER
                                23                   DCC RECORDER
                                24                   RESERVED
                                25                   RESERVED
                                26                   WRITABLE CD
                               26-31                 RESERVED

  Faculty of Electrical and Electronic Eng.                    83               Automatic Control & Automation Dept.
ī‹‘ī‰ĒīŠŦī‰ļīŠī‰īˆ ī‰ī‰‚ī‹€īŠ¸ī‰šī‰ŽīŠī‰īˆ ī‹’īŠ‰ī‰Ēī‰‰                                                                                      īˆ  īˆ  ī‹’īŠ¨ī‰‰ī‰ī‰ĒīŠģī‰īˆ ī‹’ī‰ŽīŠŧīŠ†ī‰

īˆ ī‹ĩī‰‚īŠ¨ī‰Šī‰īˆ īŠŊī‰­ī‰ĒīŠī‰īˆ ī‰ĒīŠŋī‹žī‰īˆ ī‹†ī‰ī‹Œī‹„īŠ§īˆ ī‹…īŠ§īˆ ī‹ī‹Œī‰ŽīŠ„īˆ ī‹’ī‰Žī‰ŽīŠģī‰īˆ ī‰ī‰‚ī‰Žī‰ŠīŠģī‰īˆ ī‹Šī‰¨ī‹‡īˆ īˆŦī‹’ī‹ŽīŠ°ī‹ŽīŠŖī‹ŒīŠģī‰īˆ ī‰ĒīŠŋī‰ī‹‹ī‹žī‰īˆ ī‰ī‰‚ī‰Žī‰‰īˆ ī‹ī‹‡īˆ  īˆēBits9-14 -
īˆ ī‹ī‹‡ī‹‹īˆ  īˆ¨2^6=64īˆŠīˆ  ī‹īŠ°ī‹ŽīŠŖī‹‹īˆ ī‰ ī‰‚ī‰ŽīŠ°īŠŋīˆ  64īˆ ī‹‚ī‰ī‰Ļī‰ĸī‰Žī‰­ī‰īˆ ī‹īŠģīˆ īŠĩīŠ´īŠ„īˆ ī‹ī‹‡ī‹‹īˆ īˆŦī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‰Ģī‰‚ī‹ˆī‰•īˆ ī‹“īŠŧīŠ§īˆ ī‰Ĩī‹Œī‰•ī‹ŒīŠī‰īˆ ī‰Šī‰ŦīŠŧīŠģ
                                                        īˆēī‹īŠģī‰‚ī‰ŽīŠģī‰īˆ īŠŊīŠ¸ī‰˛īŠģī‰īˆ ī‹“īŠŧīŠ§īˆ ī‹’ī‹Žī‰­ī‰‚ī‹ŽīŠ´īŠģī‰īˆ ī‹‘ī‰Ŧī‹ˆī‰•ī‹ŸīŠģīˆ ī‹’ī‰Šī‰Žī‹„īŠģī‰‚ī‰‰

                               COMMAND (in decimal)           DESCRIPTION of FUNCTION
                                       0-9            NUMERIC KEYS 0 - 9
                                       12             STANDBY
                                       13             MUTE
                                       14             PRESETS
                                       16             VOLUME UP
                                       17             VOLUME DOWN
                                       18             BRIGHTNESS +
                                       19             BRIGHTNESS -
                                       20             COLOR SATURATION +
                                       21             COLOR SATURATION -
                                       22             BASS UP
                                       23             BASS DOWN
                                       24             TREBLE +
                                       25             TREBLE -
                                       26             BALANCE RIGHT
                                       27             BALANCE LEFT
                                       48             PAUSE
                                       50             FAST REVERSE
                                       52             FAST FORWARD-
                                       53             PLAY
                                       54             STOP
                                       55             RECORD
                                       63             SYSTEM SELECT
                                       71             DIM LOCAL DISPLAY
                                       77             LINEAR FUNCTION (+)
                                       78             LINEAR FUNCTION (-)
                                       80             STEP UP
                                       81             STEP DOWN
                                       82             MENU ON
                                       83             MENU OFF
                                       84             DISPLAY A/V SYS STATUS
                                       85             STEP LEFT
                                       86             STEP RIGHT
                                       87             ACKNOWLEDGE
                                       88             PIP ON/OFF
                                       89             PIP SHIFT
                                       90             PIP MAIN SWAP
                                       91             STROBE ON/OFF
                                       92             MULTI STROBE
                                       93             MAIN FROZEN
                                       94             3/9 MULTI SCAN
                                       95             PIP SELECT
                                       96             MOSAIC MULTI PIP
                                       97             PICTURE DNR
                                       98             MAIN STORED
                                       99             PIP STROBE
                                       100            RECALL MAIN PICTURE
                                       101            PIP FREEZE
                                       102            PIP STEP UP
                                       103            PIP STEP DOWN
                                       118            SUB MODE
                                       119            OPTIONS BUS MODE
                                       123            CONNECT
                                       124            DISCONNECT




ī‹’ī‰ŽīŠ—ī‹žī‰ī‹‹īˆ ī‹īŠģī‹ ī‰īˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‹’ī‰­ī‰Ļī‹„ī‹‡īˆ ī‹ī‰ŽīŠŗ                             84                             ī‹’ī‹Žī‹ƒī‹‹īˆ–īŠ¸īŠģī‹ĸī‰ī‹‹īˆ ī‹’ī‹Žī‹–ī‰‚ī‰‰ī‰Ēī‹ˆīŠ¸īŠģī‰īˆ ī‹’ī‰­ī‰Ļī‹„īˆšī‰īˆ ī‹’ī‹ŽīŠŧīŠˇ
Practical Class 4                                                                Programming Microcontrollers

Interfacing IR Receiver to uC.                                             ī‰ĒīŠŦī‰ļīŠŋīˆ īˆ’ī‰‚īŠ¨īŠŋīˆ īŠ•ī‰‡īˆ IR īˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠŋīˆ īŠĄī‰‰ī‰Š
     īˆ  īˆ īˆŽuPīˆ ī‹‹ī‰ƒīˆ uCīˆ īŠŠīŠŋīˆ ī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ ī‰īŠ„īˆ ī‰īŠ¨ī‰ąī‰ƒīˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠŋīˆ īŠŊī‰ĩī‹‹īˆ ī‰Ļī‹„īŠ§īˆ ī‰‚ī‹ˆī‰ī‰‚īŠ§ī‰ī‰ĒīŠŋīˆ ī‰‹īŠīˆ īˆžīŠģī‰īˆ ī‰Šī‹ŒīŠŋī‹žī‰īˆ ī‰ŧīŠ¨ī‰‰īˆ ī‹‘ī‰ĒīŠ´īŠ°īŠģī‰īˆ ī‹Šī‰¨ī‹‡īˆ ī‰œī‰šī‹Œī‰
 īˆŽ"0"=On | "1" = oīŦ€īˆ â€“īˆ ī‰ī‰‚ī‰ēī‰Šī‹„īŠŧīŠģīˆ ī‹īŠ´ī‹ąī‹„īŠī‰īˆ ī‹”ī‹Œī‰Žī‰ŽīŠī‰īˆ ī‰¯īŠ¸īŠ¨ī‹īˆ īŠ˛ī‹Œī‰­īˆ ī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ ī‰īŠ„īˆ ī‹’īŠ¨ī‰ąī‹žī‰īˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠŋīˆ ī‹†ī‰ƒīˆ ī‹‰ī‰Šī‰Žī‹ƒī‰ īˆ  īˆ­1
                            īˆŽ"1"īˆ ī‹”ī‹Œī‰Žī‰ŽīŠī‰īˆ ī‹“īŠŧīŠ§īˆ ī‹†ī‹ŒīŠ¸ī‹Žī‰­īˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠī‰īˆ ī‰˜ī‰Ēī‰Ąīˆ ī‹†ī‰ˆīŠ¯īˆ īˆ¨inactivityīˆŠīˆ īŠžī‰‚ī‰­ī‰Šī‹ĸī‰īˆ ī‹‚ī‰ĻīŠ§īˆ īŠžī‰‚ī‰™īˆ īŠŸ īˆ  īˆ­2
īˆ ī‹’īŠģī‰‚ī‰™īˆ ī‹’ī‰ŠīŠŗī‰ī‰ĒīŠŋī‹‹īˆ ī‹’ī‹Žī‰•ī‰Šī‰‚ī‰Ąīˆ ī‹’īŠ¨ī‰ŋī‰‚īŠ´īŠŋīˆ ī‰‹ī‹ąīŠŗīˆ īŠ•ī‰‡īˆ ī‹‹ī‰ƒīˆ ī‹‹ī‰ĒīŠ¸ī‹ī‰‚īŠī‰īˆ ī‰Œī‰‚ī‹ąīŠŗī‰ƒīˆ ī‹…īŠŋīˆ ī‰‹ī‹ąīŠŗīˆ ī‹ī‰ƒīˆ īŠ•ī‰‡īˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠī‰īˆ ī‰˜ī‰Ēī‰Ąīˆ īŠĄī‰‰ī‰Šīˆ ī‹…īŠ¸īŠ™ īˆ  īˆ­3
īˆ īŠžī‰‚ī‰ŠīŠ´ī‰Žī‰­ī‰‚ī‰‰īˆ  ī‰ƒī‰Ļī‰Šī‰īˆ  ī‰‚ī‹ˆī‹„ī‹Žī‰™īˆ  īˆŦīŠžī‰‚ī‰­ī‰Šī‰‡īˆ  ī‹’īŠģī‰‚ī‰™īˆ  ī‰Ĩī‹Œī‰•ī‹‹īˆ  ī‹“īŠŧīŠ§īˆ  ī‹ĩī‹’īŠģī‹œī‰Ĩīˆ  ī‰ŧīŠ°ī‰ĸī‹„īŠī‰īˆ  ī‹”ī‹Œī‰Žī‰ŽīŠī‰īˆ  īŠ•ī‰‡īˆ  ī‹‰ī‰ŽīŠģī‰‚ī‰™īˆ  īˆ—īŠŦī‰Žī‰īˆ  ī‹“ī‰Žī‰™īˆ  ī‰‹ī‹ąīŠ´īŠģī‰
                                                                            īˆŽī‰ī‰‰īˆ 14īˆ ī‹…īŠŋīˆ ī‹’īŠ°īŠģī‹›īŠī‰īˆ ī‹‘ī‰ĒīŠ°ī‹Žī‰˛īŠģī‰
īˆ ī‹œīˆ īŠšīŠģī‰¨īŠģīˆ īŠšīŠģī‰§īˆ ī‰ĻīŠ¨ī‰‰īˆ ī‹’ī‹€ī‹ˆīŠŋīˆ īˆ—īŠĢīˆ ī‰‚ī‹ˆī‹„īŠ¸īŠģī‹‹īˆ īˆŦīŠžī‰‚ī‰­ī‰Šī‹ĸī‰īˆ ī‹’ī‹ŽīŠŧī‹€īŠ§īˆ ī‹•ī‰Ļī‰Šī‰‰īˆ īŠšīŠŋī‹īŠ§ī‹ĸīˆ īŠĄīŠ´īŠ¯īˆ ī‹’ī‹€ī‹ˆīŠŋīˆ īŠ•ī‹‹ī‹žī‰īˆ ī‹’ī‰‘ī‹ī‰’īŠģī‰īˆ ī‰ī‰‚ī‰Žī‰ŠīŠģī‰īˆ ī‹†ī‰‡ īˆ  īˆ­4
īˆ ī‰Ģī‰‚ī‹ˆīŠ†ī‰īˆ ī‹†ī‰ī‹Œī‹„īŠ§īˆ ī‹“īŠŧīŠ§īˆ ī‹ī‹ŒīŠ„īˆ īˆžīŠģī‰īˆ ī‹’ī‹ŽīŠģī‰‚ī‰ŽīŠģī‰īˆ ī‰Ēī‰˛īŠ§īˆ ī‰Ļī‰™ī‹žī‰īˆ ī‰ī‰‚ī‰Žī‰ŠīŠģī‰īˆ īŠŊī‰ŠīŠ´ī‰Žī‰­ī‰īˆ īŠĄīŠ´īŠ¯īˆ īˆŦī‰‚ī‹ˆīŠŧī‹ŽīŠŧīŠ„ī‹‹īˆ ī‰‚ī‹ˆīŠ¸īŠ°ī‰‰īˆ ī‹‚ī‹ŒīŠ´ī‰ī‹‹īˆ ī‰‚ī‹ˆīŠŧī‰ŠīŠ´ī‰Žī‰Žī‰
īˆ īŠšī‹„īŠ¸īŠ™īˆ ī‰‚ī‹‡ī‰ĻīŠ¨ī‰‰īˆ 4.752mSīˆ ī‹Šī‰Šī‰ĻīŠŗīˆ ī‹…īŠŋī‰Ģīˆ ī‰Šī‰‚īŠ¤ī‰Žī‹ƒī‰‚ī‰‰īˆ īŠšīŠģī‰§īˆ ī‹†ī‹ŒīŠ¸ī‹ī‹‹īˆ īˆŦī‰Ģī‰‚ī‹ˆīŠ†ī‰īˆ ī‹“īŠŧīŠ§īˆ īŠĸī‹ŒīŠŦī‰ēīŠī‰īˆ ī‰Šī‰ŦīŠŧīŠģīˆ ī‹ĩī‰‚īŠ¨ī‰Šī‰īˆ ī‰Œī‹ŒīŠŧī‹ąīŠī‰īˆ ī‰ĒīŠŋī‹žī‰ī‹‹
īˆ īˆŽ1.728mSīˆ ī‹ī‹‡īˆ ī‰Ēī‰Ąī‰…ī‹‹īˆ ī‰ī‰‰īˆ īŠŊīŠˇīˆ īŠ”ī‰‰īˆ ī‹’ī‹Žī‹„īŠŋī‰ŦīŠģī‰īˆ īŠŊī‰ĩī‰ī‹ŒīŠ°īŠģī‰īˆ ī‹†ī‰ƒīˆ ī‹‘ī‰‚īŠ§ī‰ī‰ĒīŠŋīˆ īŠŠīŠŋīˆ ī‰Ēī‰˛īŠ§īˆ ī‰Ļī‰™ī‹žī‰īˆ ī‰ī‰‚ī‰Žī‰ŠīŠŧīŠģīˆ ī‹‘ī‹•ī‰ī‰ĒīŠ´īŠģī‰īˆ ī‹’ī‹ŽīŠŧī‹€īŠ§īˆ ī‰ƒī‰Ļī‰Šī‰īˆ ī‹†ī‰ƒ
                                                                       īˆŽī‰Ļī‹„ī‰ŠīŠģī‰īˆ ī‰ī‰¨ī‹‡īˆ ī‰œī‰šī‹Œī‹īˆ ī‹īŠģī‰‚ī‰ŽīŠģī‰īˆ īŠŊīŠ¸ī‰˛īŠģī‰




                                                  īˆ  īˆ 
CLRM-2038S IR Module                                             CLRM-2038Sīˆ ī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ ī‰īŠ„īˆ ī‹’īŠ¨ī‰ąī‹žī‰īˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠŋ
      īˆ  īˆ īˆēī‹’ī‹ŽīŠģī‰‚ī‰ŽīŠģī‰īˆ ī‹’ī‹Žī‰­ī‰‚ī‰­ī‹žī‰īˆ ī‰ī‰‚īŠ°ī‰ĩī‰ī‹ŒīŠī‰īˆ ī‹‰īŠģī‹‹īˆ CLRM-2038Sīˆ ī‰˜ī‰§ī‹Œī‹€ī‹„īŠģī‰īˆ ī‹…īŠŋīˆ ī‹Œī‹‡īˆ ī‰‚ī‹„īŠ§ī‹‹ī‰Ēī‰˛īŠŋīˆ īŠŸīˆ ī‹‚ī‰Ļī‰ĸī‰Žī‰ŽīŠī‰īˆ ī‹’īŠ¨ī‰ąī‹žī‰īˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠŋīˆ ī‹†ī‰‡
                                            īˆŽī‰īŠŗī‹ŒīŠģī‰īˆ ī‰¯īŠ°ī‹ƒīˆ īŠŸīˆ ī‹‘ī‰Šī‰‚ī‰ąī‰‡īˆ ī‹ī‰ĸī‰ēīŠŋī‹‹īˆ ī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ ī‰īŠ„īˆ ī‹’īŠ¨ī‰ąī‰ƒīˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠŋ īˆ  īˆ­1
                                            īˆŽPCMīˆ ī‰ī‰ī‰Ĩī‰Ĩī‰Ēī‰īˆ īŠŊī‰•ī‰ƒīˆ ī‹…īŠŋīˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠī‰īˆ īŠ˛ī‹īŠĢīˆ īŠŊī‰Ąī‰ī‰Ĩīˆ ī‰Ēī‹ī‰ĒīŠ—īˆ ī‰œī‰ąī‰ĒīŠŋ īˆ  īˆ­2
                                                             īˆŽī‹’ī‹ąī‹Žīˆī‰īˆ ī‹•ī‰ī‹Œī‰šī‹žī‰‚ī‰‰īˆ ī‰Ēī‰‘ī‰„ī‰ŽīŠģī‰īˆ ī‰Ļī‰šīˆ ī‹’ī‹ŽīŠģī‰‚īŠ§īˆ ī‹’īŠ§ī‰‚ī‹„īŠŋ īˆ  īˆ­3
                                               īˆŽī‹ī‹–ī‰‚ī‰‰ī‰Ēī‹ˆīŠ¸īŠģī‰īˆ īŠŊīŠ´īŠ‡ī‰īˆ ī‰ī‰‚ī‰‰ī‰ī‰Ēī‹ąī‰šī‰īˆ ī‰Ļī‰šīˆ ī‹’īŠ§ī‰‚ī‹„ī‹€īŠŧīŠģīˆ ī‰Šī‹Œī‹ąīŠŋīˆ īŠĒī‰Šī‰Ĩ īˆ  īˆ­4
                                               īˆŽ2.7V~5.5Vīˆ īŠŊī‹€īŠ¨īŠģī‰īˆ īŠžī‰‚īŠ‰īˆ ī‹…ī‹€ī‰šīˆ ī‰ŧīŠ°ī‰ĸī‹„īŠŋīˆ ī‹’īŠŗī‰‚ī‰ŋīˆ īŠēī‹ī‹ˆī‰Žī‰­ī‰ īˆ  īˆ­5
                                                  īˆŽTTL, CMOSīˆ ī‹īŠ´ī‹ąī‹„īŠī‰īˆ ī‹”ī‹Œī‰Žī‰ŽīŠī‰īˆ ī‰ī‰‚ī‰ŠīŠŧī‹ąī‰ŽīŠŋīˆ īŠŠīŠŋīˆ īŠĩīŠ¯ī‰ī‹Œī‰ŽīŠŋ īˆ  īˆ­6
                                                             īˆŽNEC code,RC5 codeīˆ īˆ—ī‹ī‰‚īŠ¨īŠŋīˆ īŠŠīŠŋīˆ īŠĩīŠ¯ī‰ī‹Œī‰ŽīŠŋ īˆ  īˆ­7
                                                                             īˆŽ38KHZīˆ īŠŊīŠŋī‰‚īŠ‡ī‰īˆ ī‰Ĩī‰Ĩī‰Ēī‰ īˆ  īˆ­8
Faculty of Electrical and Electronic Eng.               85                 Automatic Control & Automation Dept.
ī‹‘ī‰ĒīŠŦī‰ļīŠī‰īˆ ī‰ī‰‚ī‹€īŠ¸ī‰šī‰ŽīŠī‰īˆ ī‹’īŠ‰ī‰Ēī‰‰                                                                               īˆ  īˆ  ī‹’īŠ¨ī‰‰ī‰ī‰ĒīŠģī‰īˆ ī‹’ī‰ŽīŠŧīŠ†ī‰

                                                                               īˆŽ12mīˆ ī‹“ī‰Žī‰™īˆ īŠžī‰‚ī‰ŠīŠ´ī‰Žī‰­ī‹œī‰īˆ ī‹’īŠ¯ī‰‚ī‰ŽīŠŋ īˆ  īˆ­9
                                                                īˆēī‹’ī‹ŽīŠģī‰‚ī‰ŽīŠģī‰īˆ ī‰ī‰‚īŠ´ī‹Žī‰Šī‹ąī‰ŽīŠģī‰īˆ īŠŊī‰•ī‰ƒīˆ ī‹…īŠŋīˆ ī‹‰īŠŋī‰ī‰Ļī‰ĸī‰Žī‰­ī‰īˆ ī‹…īŠ¸īŠ™ īˆ  īˆ­10
                                                                        īˆŽīˆ¨Optical switchīˆŠīˆ ī‹ī‹–ī‹Œī‰šīˆ ī‰ ī‰‚ī‰ŽīŠ°īŠŋ ¡
                             īˆŽAudio, TV, VCR, CD, MD, DVD, etcīˆ īˆēīŠŊī‰’īŠŋīˆ ī‹‘ī‰Ŧī‹ˆī‰•ī‹žī‰‚ī‰‰īˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‰ī‰‚īŠ´ī‹Žī‰Šī‹ąī‰ ¡
                                          Air-conditioner, Fan, CATV, etcīˆ īˆēīŠŊī‰’īŠŋīˆ ī‹’ī‹ŽīŠģī‰Ŧī‹„īŠī‰īˆ ī‹‘ī‰Ŧī‹ˆī‰•ī‹žī‰‚ī‰‰īˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰ ¡




      Pins Confg. & Int ernal D agram
              i               i                                     īˆ  īˆ  CLRM-2038Sīˆ ī‰ŸīŠģīˆ ī‹’ī‹ŽīŠŧī‰Ąī‰ī‰ĻīŠģī‰īˆ ī‹’ī‹Žī‹„ī‰ŠīŠģī‰ī‹‹īˆ ī‰Œī‰‚ī‹ąīŠŗī‹žī‰īˆ īŠĒī‰Ģī‹Œī‰
                                                          īˆŽCLRM-2038Sīˆ īŠŊī‰ŠīŠ´ī‰Žī‰Žī‹€īŠŧīŠģīˆ ī‹’ī‹ŽīŠŧī‰Ąī‰ī‰ĻīŠģī‰īˆ ī‹’ī‹Žī‹„ī‰ŠīŠģī‰īˆ ī‰œī‰šī‹Œī‹īˆ ī‹īŠģī‰‚ī‰ŽīŠģī‰īˆ īŠŊīŠ¸ī‰˛īŠģī‰




īˆ  īˆ 
                                                                                                                     īˆ  īˆ 
                                     īˆ  īˆ īˆŽCLRM-2038Sīˆ īŠŊī‰ŠīŠ´ī‰Žī‰Žī‹€īŠŧīŠģīˆ ī‰Œī‰‚ī‹ąīŠŗī‹žī‰īˆ īŠĒī‰Ģī‹Œī‰ī‹‹īˆ ī‹īŠ´ī‹ŽīŠ´īŠ‡ī‰īˆ īŠŊīŠ¸ī‰˛īŠģī‰īˆ ī‰œī‰šī‹Œī‰īˆ ī‹’ī‹ŽīŠģī‰‚ī‰ŽīŠģī‰īˆ īŠžī‰‚īŠ¸ī‰ąī‹žī‰




           īˆ  īˆ                         īˆ                                 īˆ  īˆ 
                                                                                      īˆ  īˆ 
      ī‹’ī‰ŽīŠ—ī‹žī‰ī‹‹īˆ ī‹īŠģī‹ ī‰īˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‹’ī‰­ī‰Ļī‹„ī‹‡īˆ ī‹ī‰ŽīŠŗ                             86                      ī‹’ī‹Žī‹ƒī‹‹īˆ–īŠ¸īŠģī‹ĸī‰ī‹‹īˆ ī‹’ī‹Žī‹–ī‰‚ī‰‰ī‰Ēī‹ˆīŠ¸īŠģī‰īˆ ī‹’ī‰­ī‰Ļī‹„īˆšī‰īˆ ī‹’ī‹ŽīŠŧīŠˇ
Practical Class 4                                                                Programming Microcontrollers

Rc5 receiver interface                                               īˆ ī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ ī‰īŠ„īˆ ī‹’īŠ¨ī‰ąī‹žī‰īˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠīˆ ī‹’ī‹€ī‹–ī‹īŠī‰īˆ ī‹‘ī‰Šī‰ī‰Ĩ
īˆ ī‹’ī‹ī‰¨īŠŦī‰ŽīŠģī‰īˆ ī‰Œī‰‚ī‹ąīŠŗī‰ƒīˆ īŠŠīŠŋīˆ ī‹ī‰Ģī‰ī‹Œī‰ŽīŠģī‰īˆ ī‹“īŠŧīŠ§īˆ 4.7uFīˆ īŠąī‰’īŠ¸īŠŋīˆ īŠŠī‰šī‹‹īˆ ī‰‹īŠīˆ ī‹‰ī‹ƒī‰ˆīŠ¯īˆ īˆŦīˆ’ī‰‚īŠ¨īŠŋīˆ īŠŠīŠŋīˆ ī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ ī‰īŠ„īˆ ī‹’īŠ¨ī‰ąī‰ƒīˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠŋīˆ īŠĄī‰‰ī‰Šīˆ ī‰Ļī‹„īŠ§
īˆ ī‰ī‰¨īˆšīˆ ī‹’ī‹€ī‹–ī‹īŠī‰īˆ ī‹‘ī‰Šī‰ī‰Ĩīˆ ī‰œī‰šī‹Œī‹īˆ ī‹īŠģī‰‚ī‰ŽīŠģī‰īˆ īŠŊīŠ¸ī‰˛īŠģī‰īˆ īˆŽī‰‹īŠģī‰‚īŠŦīŠģī‰īˆ īŠŸīˆ īŠŊī‹€īŠ¨ī‹īˆ ī‹…īŠģīˆ ī‹œī‰‡ī‹‹īˆ īˆŦī‰Œī‰‚ī‹ąīŠŗī‹žī‰īˆ īŠšīŠŧī‰īˆ īŠ•ī‰‡īˆ ī‹…īŠ¸īŠ™īˆ ī‰‚īŠŋīˆ ī‰Œī‰ĒīŠŗī‰ƒī‹‹īˆ īŠŊī‰ŠīŠ´ī‰Žī‰Žī‹€īŠŧīŠģ
                                                                                                  īˆ  īˆ īˆŽīŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠī‰
                                                                                                           īˆ  īˆ 




īˆ  īˆ 
                                                       īˆ  īˆ 
IRSAT Remote Control                                                                 īˆ  īˆ  IRSATīˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‰Ģī‰‚ī‹ˆī‰•
                                                                                            īˆēī‰Ģī‰‚ī‹ˆīŠ†ī‰īˆ ī‰ī‰‚īŠ°ī‰ĩī‰ī‹ŒīŠŋ
                                            īˆ  īˆ IRSAT RC5 TV Remote Control with 33 Keysīˆ īˆēī‰˜ī‰§ī‹Œī‹€ī‹„īŠģī‰ ¡
                                                                  īˆ  īˆ  China (mainland) īˆēī‰„ī‰˛ī‹„īŠī‰īˆ ī‰ĻīŠŧī‰‰ ¡
                                                                           AA x 2īˆ īˆēī‰ī‰‚ī‹ī‰Šī‰‚ī‹ąī‰ŠīŠģī‰īˆ īŠĒī‹Œī‹ƒ ¡
                                                                         10 metersīˆ īˆēīŠžī‰‚ī‰­ī‰Šī‹ĸī‰īˆ īŠžī‰‚īŠ‰ ¡
                                                                         īˆŽ3Îŧ Aīˆ īˆēStandby current ¡
                                                                            17x4.7x2.5cmīˆ īˆēī‰Ĩī‰‚īŠ¨ī‰‰ī‹žī‰ ¡
                                                                                                           īˆ  īˆ 
IRSAT Remote Control Key Commands                                     īˆ  īˆ  IRSATīˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‰Ģī‰‚ī‹ˆīŠ†īˆ ī‰œī‹Žī‰ī‰‚īŠ°īŠī‰īˆ ī‹…ī‹ī‹‹ī‰‚ī‹„īŠ§
īˆ ī‹’ī‹Žī‹ƒī‹‹īˆ–īŠ¸īŠģī‹ĸī‰īˆ ī‹’ī‰­ī‰Ļī‹„ī‹ˆīŠŧīŠģīˆ īŠŊī‹–ī‰ī‹‹ī‹žī‰īˆ ī‹’īŠˇī‰Ēī‰˛īŠģīˆ ī‹ĩī‰‚ī‰ļī‹Žī‰ļī‰Ąīˆ īŠŠī‹„ī‰ļīŠŋīˆ ī‹‰ī‹ƒī‰ˆīŠ¯īˆ  ī‹Šī‰‚ī‹ƒī‰Ĩī‰ƒīˆ īŠŊīŠ¸ī‰˛īŠģī‰īˆ ī‹“īŠŧīŠ§īˆ ī‰œī‰šī‹ŒīŠī‰īˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‰Ģī‰‚ī‹ˆīŠ†īˆ ī‹’ī‰Šī‰Žī‹„īŠģī‰‚ī‰‰
                                                     īˆēī‹īŠŧī‹īˆ ī‰‚ī‹€ī‹ŽīŠ¯īˆ ī‰˜ī‰Šī‰ĻīŠī‰īˆ īŠžī‹‹ī‰ĻīŠ†ī‰īˆ īŠŸīˆ ī‹’ī‰šī‰šī‹ŒīŠŋī‹‹īˆ ī‹’ī‰ĩī‰‚ī‰Ąīˆ ī‹’ī‹ŽīŠ°ī‹ŽīŠŖī‹‹īˆ īŠŊī‹–ī‹œī‰Ĩīˆ īŠĩīŠ¯ī‹‹




Faculty of Electrical and Electronic Eng.                    87            Automatic Control & Automation Dept.
ī‹‘ī‰ĒīŠŦī‰ļīŠī‰īˆ ī‰ī‰‚ī‹€īŠ¸ī‰šī‰ŽīŠī‰īˆ ī‹’īŠ‰ī‰Ēī‰‰                                                                  īˆ  īˆ  ī‹’īŠ¨ī‰‰ī‰ī‰ĒīŠģī‰īˆ ī‹’ī‰ŽīŠŧīŠ†ī‰

      COMMAND (in Hex)            DESCRIPTION of FUNCTION
           0-9                       NUMERIC KEYS 0 - 9
           12
           13
           14
           16                          VOLUME UP
           17                         VOLUME DOWN
               18

               19
               20

               21

               22                        BASS UP
               23                       BASS DOWN
               24

               25

               26

               27

               48

               50
               52                            F1
               53                            F2
               54                            F3
               55                            F4
               63
               71



 RC5 Sender                                                         īˆ  īˆ  īˆ RC5īˆ īŠžī‹ŒīŠˇī‹Œī‰ī‹‹ī‰Ēī‰‰īˆ īŠžī‰‚ī‰­ī‰Šī‰‡īˆ ī‹‘ī‰Šī‰ī‰Ĩ
īˆ  īˆ īˆēī‹īŠģī‰‚ī‰ŽīŠģī‰īˆ īŠŊīŠ¸ī‰˛īŠģī‰īˆ ī‹‘ī‰‚īŠ§ī‰ī‰ĒīŠŋīˆ īŠŠīŠŋīˆ OC1(A)īˆ ī‰‹ī‹ąīŠ´īŠģī‰īˆ īŠ•ī‰‡īˆ ī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ ī‰īŠ„īˆ ī‹’īŠ¨ī‰ąī‰ƒīˆ īŠŊī‰­ī‰ĒīŠŋīˆ īŠŊī‹Žī‰ĩī‹Œī‰Žī‰‰īˆ ī‹īŠŗīˆ īˆ īˆēī‹‘ī‰Šī‰ī‰ĻīŠŧīŠģīˆ ī‹ī‰ĒīŠ¤ī‹„īŠģī‰īˆ īŠĄī‹ąī‰ĸīŠī‰




                     īˆ  īˆ 

 ī‹’ī‰ŽīŠ—ī‹žī‰ī‹‹īˆ ī‹īŠģī‹ ī‰īˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‹’ī‰­ī‰Ļī‹„ī‹‡īˆ ī‹ī‰ŽīŠŗ                 88                     ī‹’ī‹Žī‹ƒī‹‹īˆ–īŠ¸īŠģī‹ĸī‰ī‹‹īˆ ī‹’ī‹Žī‹–ī‰‚ī‰‰ī‰Ēī‹ˆīŠ¸īŠģī‰īˆ ī‹’ī‰­ī‰Ļī‹„īˆšī‰īˆ ī‹’ī‹ŽīŠŧīŠˇ
Practical Class 4                                                            Programming Microcontrollers


                                                                īˆ  īˆ īˆēBascom-AVRīˆ ī‹’ī‹—ī‹Žī‰‰īˆ ī‹‚ī‰ī‰Ļī‰ĸī‰Žī‰­ī‰‚ī‰‰īˆ ī‰—īŠŋī‰‚ī‹ƒīˆ•īŠģī‰
īˆ īŠžī‹ŒīŠˇī‹Œī‰ī‹‹ī‰Ēī‰‰īˆ  ī‹“īŠŧīŠ§īˆ  ī‹ī‹ŒīŠ„īˆ  īˆžīŠģī‰ī‹‹īˆ  ī‹’ī‹ŽīŠ‰īˆ•īŠģī‰īˆ  ī‹’ī‹—ī‹Žī‰ŠīŠģī‰īˆ  īŠŸīˆ  ī‹‘ī‰Ĩī‹Œī‰•ī‹ŒīŠī‰īˆ  RC5īˆ  ī‹’ī‰Šī‰ŽīŠ¸īŠŋīˆ  ī‹•ī‰‚īŠ§ī‰Ļī‰Žī‰­ī‰‚ī‰‰īˆ  ī‹īŠģī‰‚ī‰ŽīŠģī‰īˆ  ī‰—īŠŋī‰‚ī‹ƒīˆ•īŠģī‰īˆ  ī‹‚ī‹ŒīŠ´ī‹īˆ  īŠ˛ī‹Œī‰­
                                                                                              īˆ  īˆ īˆŽīŠžī‰‚ī‰­ī‰Šī‹ĸī‰
īˆ ī‹…īŠŋī‰Ģīˆ  ī‰Œī‰‚ī‰ŽīŠ‡īˆ  Timer1īˆ  ī‰īŠŗī‹›īŠī‰īˆ  īŠŊī‹ŽīŠŦī‰˛ī‰Žī‰‰īˆ  ī‹‚ī‹ŒīŠ´ī‰īˆ  īˆžīŠģī‰ī‹‹īˆ  RC5SENDīˆ  ī‹’ī‹€ī‹ŽīŠŧīŠ¨ī‰ŽīŠģī‰īˆ  ī‹‚ī‰ī‰Ļī‰ĸī‰Žī‰­ī‰‚ī‰‰īˆ  īŠžī‹ŒīŠˇī‹Œī‰ī‹‹īˆ•īŠģī‰īˆ  īŠžī‰‚ī‰­ī‰Šī‰‡īˆ  ī‹ī‰Žī‹
                                                                                 īˆ  īˆ īˆŽī‹īŠģī‰…īˆ īŠŊīŠ¸ī‰˛ī‰‰īˆ ī‰ī‰‚ī‰ēī‰Šī‹„īŠģī‰
$regfile = "m8def.dat"                                   ' specify the used micro
$crystal = 4000000                                       ' used crystal frequency

Dim Togbit As Byte , Command As Byte , Address As Byte

Command = 12                                             ' power on off
Togbit = 0                                               ' make it 0 or 32 to set the toggle bit
Address = 0

Do
   Waitms 200
   Rc5send Togbit , Address , Command
Loop

End


RC5 Receiver                                                            īˆ  īˆ  RC5īˆ īŠžī‹ŒīŠˇī‹Œī‰ī‹‹ī‰Ēī‰‰īˆ īŠžī‰‚ī‰ŠīŠ´ī‰Žī‰­ī‰īˆ ī‹‘ī‰Šī‰ī‰Ĩ
                                                                              īˆ  īˆ īˆ īˆēī‹‘ī‰Šī‰ī‰ĻīŠŧīŠģīˆ ī‹ī‰ĒīŠ¤ī‹„īŠģī‰īˆ īŠĄī‹ąī‰ĸīŠī‰
           īˆ  īˆ īˆēī‹īŠģī‰‚ī‰ŽīŠģī‰īˆ īŠŊīŠ¸ī‰˛īŠģī‰īˆ ī‹‘ī‰‚īŠ§ī‰ī‰ĒīŠŋīˆ īŠŠīŠŋīˆ ī‹‹ī‰ĒīŠ¸ī‹ī‰‚īŠī‰īˆ ī‰Œī‰‚ī‹ąīŠŗī‰ƒīˆ ī‰Ļī‰™ī‰ƒīˆ īŠ•ī‰‡īˆ ī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ ī‰īŠ„īˆ ī‹’īŠ¨ī‰ąī‹žī‰īˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠŋīˆ ī‰˜ī‰Ēī‰Ąīˆ īŠŊī‹Žī‰ĩī‹Œī‰Žī‰‰īˆ ī‹īŠŗ




                                     īˆ  īˆ 
                                                                                                       īˆ  īˆ 
                                                                īˆ  īˆ īˆŽBascom-AVRīˆ ī‹’ī‹—ī‹Žī‰‰īˆ ī‹‚ī‰ī‰Ļī‰ĸī‰Žī‰­ī‰‚ī‰‰īˆ ī‰—īŠŋī‰‚ī‹ƒīˆ•īŠģī‰
īˆ īŠžī‹ŒīŠˇī‹Œī‰ī‹‹ī‰Ēī‰‰īˆ  ī‹“īŠŧīŠ§īˆ  ī‹ī‹ŒīŠ„īˆ  īˆžīŠģī‰ī‹‹īˆ  ī‹’ī‹ŽīŠ‰īˆ•īŠģī‰īˆ  ī‹’ī‹—ī‹Žī‰ŠīŠģī‰īˆ  īŠŸīˆ  ī‹‘ī‰Ĩī‹Œī‰•ī‹ŒīŠī‰īˆ  RC5īˆ  ī‹’ī‰Šī‰ŽīŠ¸īŠŋīˆ  ī‹•ī‰‚īŠ§ī‰Ļī‰Žī‰­ī‰‚ī‰‰īˆ  ī‹īŠģī‰‚ī‰ŽīŠģī‰īˆ  ī‰—īŠŋī‰‚ī‹ƒīˆ•īŠģī‰īˆ  ī‹‚ī‹ŒīŠ´ī‹īˆ  īŠ˛ī‹Œī‰­
                                                                                            īˆ  īˆ īˆŽīŠžī‰‚ī‰ŠīŠ´ī‰Žī‰­ī‹œī‰
īˆ īŠŊīŠ¸ī‰˛ī‰‰īˆ ī‰ī‰‚ī‰ēī‰Šī‹„īŠģī‰īˆ ī‰ĻīŠ¨īŠģīˆ  Timer0īˆ ī‰īŠŗī‹›īŠī‰īˆ īŠŊī‹ŽīŠŦī‰˛ī‰Žī‰‰īˆ ī‹‚ī‹ŒīŠ´ī‰īˆ īˆžīŠģī‰ī‹‹īˆ  getrc5īˆ ī‹’ī‹€ī‹ŽīŠŧīŠ¨ī‰ŽīŠģī‰īˆ ī‹‚ī‰ī‰Ļī‰ĸī‰Žī‰­ī‰‚ī‰‰īˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠī‰īˆ ī‹’īŠģī‰‚ī‰™īˆ ī‰ˇī‰šīŠ¯īˆ ī‹ī‰Žī‹
                                                                                                   īˆ  īˆ īˆŽī‹īŠģī‰…
                                                                                                       īˆ  īˆ 
Faculty of Electrical and Electronic Eng.           89                 Automatic Control & Automation Dept.
ī‹‘ī‰ĒīŠŦī‰ļīŠī‰īˆ ī‰ī‰‚ī‹€īŠ¸ī‰šī‰ŽīŠī‰īˆ ī‹’īŠ‰ī‰Ēī‰‰                                                              īˆ  īˆ  ī‹’īŠ¨ī‰‰ī‰ī‰ĒīŠģī‰īˆ ī‹’ī‰ŽīŠŧīŠ†ī‰

$regfile = "m8def.dat"                                      ' specify the used micro
$crystal = 4000000                                          ' used crystal frequency
$baud = 19200                                               ' use baud rate
$lib "mcsbyte.lbx"

Config Rc5 = Pind.2                        ' pin we want to use for the receiver input

Enable Interrupts                          ' enable the interrupts
Dim Address As Byte , Command As Byte      'reserve space for variables

Print "Waiting for RC5..."

Do
  Getrc5(address , Command)                ' check if a key on the remote is pressed

  If Address = 0 Then                      'we check for the TV address and that is
     Command = Command And &B01111111      'clear the toggle bit (bit7)
     Print Address ; " " ; Command
  End If
Loop
End




                                Red: AGC pulses (ON)
                               Blue: Check bit (flipping)
                                 White: Address (00)
                                  Green: Command




ī‹’ī‰ŽīŠ—ī‹žī‰ī‹‹īˆ ī‹īŠģī‹ ī‰īˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‹’ī‰­ī‰Ļī‹„ī‹‡īˆ ī‹ī‰ŽīŠŗ               90                   ī‹’ī‹Žī‹ƒī‹‹īˆ–īŠ¸īŠģī‹ĸī‰ī‹‹īˆ ī‹’ī‹Žī‹–ī‰‚ī‰‰ī‰Ēī‹ˆīŠ¸īŠģī‰īˆ ī‹’ī‰­ī‰Ļī‹„īˆšī‰īˆ ī‹’ī‹ŽīŠŧīŠˇ

Weitere ähnliche Inhalte

Andere mochten auch

Embedded System Microcontroller Interactive Course using BASCOM-AVR -Lecture7
Embedded System Microcontroller Interactive Course using BASCOM-AVR -Lecture7Embedded System Microcontroller Interactive Course using BASCOM-AVR -Lecture7
Embedded System Microcontroller Interactive Course using BASCOM-AVR -Lecture7AL-AWAIL for Electronic Engineering
 
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture6
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture6Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture6
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture6AL-AWAIL for Electronic Engineering
 
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture9
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture9Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture9
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture9AL-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 - Lecture10
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture10Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture10
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture10AL-AWAIL for Electronic Engineering
 
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture...
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture...Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture...
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture...AL-AWAIL for Electronic Engineering
 
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture12
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture12Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture12
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture12AL-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
 

Andere mochten auch (9)

Embedded System Microcontroller Interactive Course using BASCOM-AVR -Lecture7
Embedded System Microcontroller Interactive Course using BASCOM-AVR -Lecture7Embedded System Microcontroller Interactive Course using BASCOM-AVR -Lecture7
Embedded System Microcontroller Interactive Course using BASCOM-AVR -Lecture7
 
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture6
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture6Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture6
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture6
 
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture9
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture9Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture9
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture9
 
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture11
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture11Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture11
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture11
 
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture10
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture10Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture10
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture10
 
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture...
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture...Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture...
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture...
 
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture12
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture12Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture12
Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture12
 
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
 
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
 

Ähnlich wie Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture4

Automatic light project
Automatic light projectAutomatic light project
Automatic light projectkspece0928
 
2.3 sequantial logic circuit
2.3 sequantial logic circuit2.3 sequantial logic circuit
2.3 sequantial logic circuitWan Afirah
 
netfilter and iptables
netfilter and iptablesnetfilter and iptables
netfilter and iptablesKernel TLV
 
Day4 Lab
Day4 LabDay4 Lab
Day4 LabRon Liu
 
Twin wheeler modified for arduino simplified serial protocol to sabertooth v21
Twin wheeler modified for arduino simplified serial protocol to sabertooth v21Twin wheeler modified for arduino simplified serial protocol to sabertooth v21
Twin wheeler modified for arduino simplified serial protocol to sabertooth v21josnihmurni2907
 
Example MVS Console Interface
Example MVS Console InterfaceExample MVS Console Interface
Example MVS Console InterfaceDavid Young
 
ARC2015_I_Slides
ARC2015_I_SlidesARC2015_I_Slides
ARC2015_I_SlidesZaid Al-Khatib
 
PhD thesis defense
PhD thesis defensePhD thesis defense
PhD thesis defenseDamien Cassou
 

Ähnlich wie Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture4 (9)

Automatic light project
Automatic light projectAutomatic light project
Automatic light project
 
2.3 sequantial logic circuit
2.3 sequantial logic circuit2.3 sequantial logic circuit
2.3 sequantial logic circuit
 
netfilter and iptables
netfilter and iptablesnetfilter and iptables
netfilter and iptables
 
Day4 Lab
Day4 LabDay4 Lab
Day4 Lab
 
Emtp Mahseredjian R&D
Emtp Mahseredjian R&DEmtp Mahseredjian R&D
Emtp Mahseredjian R&D
 
Twin wheeler modified for arduino simplified serial protocol to sabertooth v21
Twin wheeler modified for arduino simplified serial protocol to sabertooth v21Twin wheeler modified for arduino simplified serial protocol to sabertooth v21
Twin wheeler modified for arduino simplified serial protocol to sabertooth v21
 
Example MVS Console Interface
Example MVS Console InterfaceExample MVS Console Interface
Example MVS Console Interface
 
ARC2015_I_Slides
ARC2015_I_SlidesARC2015_I_Slides
ARC2015_I_Slides
 
PhD thesis defense
PhD thesis defensePhD thesis defense
PhD thesis defense
 

KÃŧrzlich hochgeladen

Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...Pooja Nehwal
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxShobhayan Kirtania
 
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
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
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
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 

KÃŧrzlich hochgeladen (20)

Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptx
 
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
 
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"
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
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
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 

Embedded System Microcontroller Interactive Course using BASCOM-AVR - Lecture4

  • 1. ī„ ī„  ī„  ī„ ī†Šī…šī…°ī…Ĩī…Ŋī…ģī…ī„ ī…Œī…‚ī…Ŋī…šī…’ī…‹ī…Ŋī…ģī…ī„ ī†Ēī…ī…Ŋī…šī…‰ â€ĢīēīģŸīē˜īē īēŽīē­īē īēīģŸīģŒīģ¤īģ īģ´īē”â€Ŧ ī„  ī„ ī†Ēī…Ŧī…‰ī…ī…šī…ģī…ī„ ī†Ēī…Ąī…ģī…ī…ģī… ī„ ī„  ī„ ī„  Programming Embedded Systems Microcontroller You Can Practice Microcontroller Programming Easily Now! WALID BALID, Tuesday, December 15, 2009
  • 2. ī‹‘ī‰ĒīŠŦī‰ļīŠī‰īˆ ī‰ī‰‚ī‹€īŠ¸ī‰šī‰ŽīŠī‰īˆ ī‹’īŠ‰ī‰Ēī‰‰ īˆ  īˆ  ī‹’īŠ¨ī‰‰ī‰ī‰ĒīŠģī‰īˆ ī‹’ī‰ŽīŠŧīŠ†ī‰ Exp.10: Shift & Rotate Instructions īˆ  īˆ ī‹†ī‰ī‰Šī‹‹ī‰ĻīŠģī‰ī‹‹īˆ ī‹’ī‰™ī‰ī‰Ģī‹ĸī‰īˆ ī‰ī‰‚ī‹€ī‹ŽīŠŧīŠ¨ī‰īˆ īˆēī‹‘ī‰Ēī‰ąī‰‚īŠ¨īŠģī‰īˆ ī‹’ī‰‰ī‰Ēī‰–ī‰ŽīŠģī‰ īˆ  īˆ īˆēī‹’ī‰‰ī‰Ēī‰–ī‰ŽīŠģī‰īˆ ī‹…īŠŋīˆ ī‹’ī‹ī‰‚īŠŦīŠģī‰ īˆ  īˆ īˆŽīˆ¨RotateīˆŠ ī‹†ī‰ī‰Šī‹‹ī‰ĻīŠģī‰ī‹‹īˆ īˆ¨ShiftīˆŠīˆ ī‹’ī‰™ī‰ī‰Ģī‹ĸī‰īˆ ī‰ī‰‚ī‹€ī‹ŽīŠŧīŠ¨ī‰īˆ ī‹“īŠŧīŠ§īˆ īŠ˛ī‰ĒīŠ¨ī‰ŽīŠģī‰ īˆ  īˆ īˆēīŠŊī‹Žī‰ĩī‹Œī‰ŽīŠģī‰īˆ īŠĄī‹ąīŠ‹ īˆ  īˆ  īˆ  īˆ īˆēī‹‘ī‰Šī‰ī‰ĻīŠģī‰īˆ īŠŊī‹€īŠ§īˆ ī‰ ī‰Ēī‰ą īˆ ī‰ī‰‚ī‹Žī‹–ī‰‚ī‹„ī‰’īŠģī‰īˆ ī‹“īŠŧīŠ§īˆ ī‰Ēī‹ˆīŠ¤ī‹īˆ ī‰ī‰‰īˆ ī‹’ī‰™ī‰ī‰Ģī‰‡īˆŠīˆ īˆŦīˆ¨Shift RightīˆŠīˆ ī‹‚ī‰‚īŠŋī‹ŸīŠģīˆ ī‹’ī‰™ī‰ī‰Ģī‹ĸī‰‚ī‰‰īˆ  S6īˆ ī‰ ī‰‚ī‰ŽīŠ°īŠī‰īˆ ī‹‚ī‹ŒīŠ´ī‹īˆ ī‰“ī‹ŽīŠīˆ ī‰—īŠŋī‰‚ī‹ƒī‰Ēī‰‰īˆ ī‹’ī‰‰ī‰‚ī‰ŽīŠ¸ī‰‰īˆ ī‹‚ī‹ŒīŠ´ī‹ƒīˆ īŠ˛ī‹Œī‰­ īˆ  īˆ īˆ īˆŽīˆ¨Shift LeftīˆŠīˆ īŠąīŠŧī‰ĸīŠŧīŠģīˆ ī‹’ī‰™ī‰ī‰Ģī‹ĸī‰‚ī‰‰īˆ S7īˆ ī‰ ī‰‚ī‰ŽīŠ°īŠī‰ī‹‹īˆ īˆ¨ī‹’ī‹Žī‹–ī‹Œī‰ēīŠģī‰ īˆ ī‰Šī‰‚ī‰Žī‹ŽīŠģī‰īˆ ī‹ŒīŠīˆ ī‹†ī‰ī‰Šī‹‹ī‰Ĩīˆ ī‹’ī‹ŽīŠŧī‹€īŠ¨ī‰‰īˆ ī‹‚ī‹ŒīŠ´ī‹īˆ  S14īˆ ī‰ ī‰‚ī‰ŽīŠ°īŠī‰ī‹‹īˆ  īˆ¨Rotate RightīˆŠīˆ  īŠ”ī‹€ī‹ŽīŠģī‰īˆ ī‹ŒīŠīˆ ī‹†ī‰ī‰Šī‹‹ī‰Ĩīˆ ī‹’ī‹ŽīŠŧī‹€īŠ¨ī‰‰īˆ ī‹‚ī‹ŒīŠ´ī‹īˆ  S13īˆ ī‰ ī‰‚ī‰ŽīŠ°īŠī‰īˆ īŠšīŠģī‰¨īŠˇ īˆ  īˆ īˆŽīˆ¨Rotate RightīˆŠ īˆ  īˆ īˆēīŠŊī‹Žī‰ĩī‹Œī‰ŽīŠģī‰īˆ ī‰ī‰‚ī‰ŠīŠŧī‹ąī‰ŽīŠŋ īˆ  īˆ īˆ .Jumperīˆ ī‹‚ī‰ī‰Ļī‰ĸī‰Žī‰­ī‰‚ī‰‰ JP9īˆ ī‹‹ JP6īˆ īŠŊī‰ĩī‹ŒīŠģī‰īˆ ī‹’ī‹ąīŠ´ī‹ƒīˆ īŠļī‹īŠĢī‰‡īˆ ī‰‹īŠ īˆ  īˆ  ī‹’ī‰ŽīŠ—ī‹žī‰ī‹‹īˆ ī‹īŠģī‹ ī‰īˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‹’ī‰­ī‰Ļī‹„ī‹‡īˆ ī‹ī‰ŽīŠŗ 72 ī‹’ī‹Žī‹ƒī‹‹īˆ–īŠ¸īŠģī‹ĸī‰ī‹‹īˆ ī‹’ī‹Žī‹–ī‰‚ī‰‰ī‰Ēī‹ˆīŠ¸īŠģī‰īˆ ī‹’ī‰­ī‰Ļī‹„īˆšī‰īˆ ī‹’ī‹ŽīŠŧīŠˇ
  • 3. Practical Class 4 Programming Microcontrollers īˆ  īˆ īˆēī‹‘ī‰Ļī‹ī‰ĻīŠ†ī‰īˆ ī‰ī‰‚ī‹€ī‹ŽīŠŧīŠ¨ī‰ŽīŠģī‰ īˆ  īˆ  ī‹’ī‹ŽīŠ‰īˆ•īŠģī‰īˆ ī‹’ī‹€ī‹ŽīŠŧīŠ¨ī‰ŽīŠģī‰ īˆ  īˆ  ī‹’ī‹€ī‹ŽīŠŧīŠ¨ī‰ŽīŠģī‰īˆ ī‰ ī‰Ēī‰ą īˆ ī‰Ĩī‰ĻīŠ§ī‹‹īˆ  ī‰Šī‰‚ī‰Žī‹ŽīŠģī‰īˆ  ī‹‹ī‰ƒīˆ  īŠ”ī‹€ī‹ŽīŠģī‰īˆ  īŠ•ī‰‡īˆ  īŠžī‹Œī‰šī‰ŽīŠŋīˆ  ī‹…īŠŋīˆ  ī‰ī‰‰īˆ  ī‹’ī‰™ī‰ī‰Ģī‰‡ Shift var , Right/Left [, shift] īˆ  īˆ [, shift]īˆ ī‰Ÿī‰‰īˆ ī‹‘ī‰Ĩī‰ĻīŠŠīˆ ī‹’ī‰™ī‰ī‰Ģī‹ĸī‰īˆ ī‰ī‰‚ī‹ƒī‰‚ī‰Ą īˆ ī‰Ĩī‰ĻīŠ§ī‹‹īˆ  ī‰Šī‰‚ī‰Žī‹ŽīŠģī‰īˆ  ī‹‹ī‰ƒīˆ  īŠ”ī‹€ī‹ŽīŠģī‰īˆ  īŠ•ī‰‡īˆ  īŠžī‹Œī‰šī‰ŽīŠŋīˆ  ī‹…īŠŋīˆ  ī‰ī‰‰īˆ  ī‰Ēī‹ī‹‹ī‰Ļī‰ Rotate var , Right/Left [, rotate] īˆ  īˆ [, shift]īˆ ī‰Ÿī‰‰īˆ ī‹‘ī‰Ĩī‰ĻīŠŠīˆ ī‹†ī‰ī‰Šī‹‹ī‰ĻīŠģī‰īˆ ī‰ī‰‚ī‹ƒī‰‚ī‰Ą īˆ  īˆ īˆēī‹‘ī‰Šī‰ī‰ĻīŠģī‰īˆ īŠŊī‹ŽīŠŦī‰˛ī‰īˆ ī‰—īŠŋī‰‚ī‹ƒī‰Ēī‰‰ $regfile = "m128def.dat" $crystal = 8000000 īˆ  īˆ īˆŽī‰ī‰‚ī‹ˆī‹Žī‰•ī‹Œī‰ŽīŠģī‰ '--------------------- Config Pine.4 = Input Config Pine.5 = Input Config Pine.6 = Input Config Pine.7 = Input Pine.4 = 1 : Pine.5 = 1 Pine.6 = 1 : Pine.7 = 1 īˆ ī‰ī‰‚ī‹Žī‹–ī‰‚ī‹„ī‰’īŠģī‰ī‹‹īˆ ī‰œī‹Žī‰ī‰‚īŠ°īŠī‰īˆ ī‰‚ī‹ˆīŠ¨īŠŋīˆ ī‹’īŠŧī‰ĩī‹ŒīŠī‰īˆ ī‰ī‰‚ī‰‰ī‰ī‹Œī‰ŠīŠģī‰īˆ īŠąī‹ī‰ĒīŠ¨ī‰ Shift_r Alias Pine.4 īˆ  īˆ īˆŽī‹’ī‹Žī‹–ī‹Œī‰ēīŠģī‰ Shift_l Alias Pine.5 Rotat_r Alias Pine.6 Rotat_l Alias Pine.7 Config Portd = Output Leds Alias Portd Portd = &B00000001 '--------------------- Do Debounce Shift_r , 0 , Sr , Sub Debounce Shift_l , 0 , Sl , Sub Debounce Rotat_r , 0 , Rr , Sub īˆ  īˆ īˆŽī‰œī‹Žī‰ī‰‚īŠ°īŠī‰īˆ ī‹’īŠģī‰‚ī‰™īˆ ī‰ˇī‰šīŠ¯īˆ ī‰‚ī‹ˆī‹ŽīŠ¯īˆ ī‹ī‰Žī‹īˆ ī‹ī‰Žī‹Žī‹–ī‰ĒīŠģī‰īˆ ī‰—īŠŋī‰‚ī‹ƒīˆ•īŠģī‰īˆ ī‹’īŠ´īŠŧī‰™ Debounce Rotat_l , 0 , Rl , Sub Loop End '--------------------- Sr: If Leds > 1 Then Shift Leds , Right , 1 Return '--------------------- Sl: If Leds < 128 Then Shift Leds , Left , 1 Return '--------------------- īˆ  īˆ īˆŽī‹’ī‹ŽīŠ§ī‰ĒīŠ°īŠģī‰īˆ ī‰—īŠŋī‰īˆ•īŠģī‰ Rr: Rotate Leds , Right , 1 Return '--------------------- Rl: Rotate Leds , Left , 1 Return '--------------------- Faculty of Electrical and Electronic Eng. 73 Automatic Control & Automation Dept.
  • 4. ī‹‘ī‰ĒīŠŦī‰ļīŠī‰īˆ ī‰ī‰‚ī‹€īŠ¸ī‰šī‰ŽīŠī‰īˆ ī‹’īŠ‰ī‰Ēī‰‰ īˆ  īˆ  ī‹’īŠ¨ī‰‰ī‰ī‰ĒīŠģī‰īˆ ī‹’ī‰ŽīŠŧīŠ†ī‰ Exp.11: Get RC Value īˆ  īˆ īŠąī‰’īŠ¸īŠŋīˆ ī‹‹ī‰ƒīˆ ī‹’īŠŋī‹‹ī‰‚īŠ´īŠŋīˆ ī‹’ī‹€ī‹ŽīŠŗīˆ ī‹‘ī‹•ī‰ī‰ĒīŠŗīˆ īˆēī‹‘ī‰Ēī‰˛īŠ§īˆ ī‹’ī‹ī‰Ĩī‰‚īŠ‡ī‰īˆ ī‹’ī‰‰ī‰Ēī‰–ī‰ŽīŠģī‰ īˆ  īˆ īˆēī‹’ī‰‰ī‰Ēī‰–ī‰ŽīŠģī‰īˆ ī‹…īŠŋīˆ ī‹’ī‹ī‰‚īŠŦīŠģī‰ īˆ  īˆ īˆŽī‹ĩī‰‚īŠ¨īŠŋīˆ īŠąī‰’īŠ¸īŠī‰ī‹‹īˆ ī‹’īŠŋī‹‹ī‰‚īŠ´īŠī‰īˆ ī‹…ī‰šī‰˛īŠģīˆ īˆŸīŠŋī‰ŦīŠģī‰īˆ ī‰ī‰‰ī‰‚ī‰’īŠģī‰īˆ īˆ—īŠŦī‰īˆ ī‹’ī‹€ī‹ŽīŠŗīˆ ī‹‘ī‹•ī‰ī‰ĒīŠŗ īˆ  īˆ īˆēīŠŊī‹Žī‰ĩī‹Œī‰ŽīŠģī‰īˆ īŠĄī‹ąīŠ‹ īˆ  īˆ  īˆ  īˆ īˆēī‹‘ī‰Šī‰ī‰ĻīŠģī‰īˆ īŠŊī‹€īŠ§īˆ ī‰ ī‰Ēī‰ą īˆ ī‰ī‰‰ī‰‚ī‰’īŠģī‰īˆ  īˆ—īŠŦī‰īˆ  ī‹’ī‹€ī‹ŽīŠŗīˆ  ī‹‘ī‹•ī‰ī‰ĒīŠŗī‹‹īˆ  ī‰ĒīŠŦī‰ļīŠī‰īˆ  ī‹īŠ¸ī‰šī‰ŽīŠī‰īˆ  ī‰Œī‰‚ī‹ąīŠŗī‰ƒīˆ  ī‰Ļī‰™ī‰ƒīˆ  īŠŠīŠŋīˆ  īˆ—īŠŦī‰ŽīŠŋīˆ  īŠąī‰’īŠ¸īŠŋī‹‹īˆ  ī‹‘īˆ—īŠŦī‰ŽīŠŋīˆ  ī‹’īŠŋī‹‹ī‰‚īŠ´īŠŋīˆ  īŠŊī‹Žī‰ĩī‹Œī‰Žī‰‰īˆ  ī‹‚ī‹ŒīŠ´ī‹ƒīˆ  īŠ˛ī‹Œī‰­ īˆ  īˆ īˆŽGetrcīˆ ī‹’ī‹€ī‹ŽīŠŧīŠ¨ī‰ŽīŠģī‰īˆ ī‹‚ī‰ī‰Ļī‰ĸī‰Žī‰­ī‰‚ī‰‰īˆ ī‹ĩī‰‚īŠ¨īŠŋīˆ īŠąī‰’īŠ¸īŠī‰ī‹‹īˆ ī‹’īŠŋī‹‹ī‰‚īŠ´īŠī‰īˆ ī‹…ī‰šī‰˛īŠģīˆ īˆŸīŠŋī‰ŦīŠģī‰ īˆ  īˆ  īˆ  īˆ īˆēīŠŊī‹Žī‰ĩī‹Œī‰ŽīŠģī‰īˆ ī‰ī‰‚ī‰ŠīŠŧī‹ąī‰ŽīŠŋ īˆ  īˆ īˆŽī‰Šī‰‚ī‹ˆīŠŖī‹ĸī‰īˆ ī‹’ī‰ąī‰‚ī‰ąīˆ īŠŊī‹ŽīŠŦī‰˛ī‰ŽīŠģīˆ SW2īˆ ī‰ ī‰‚ī‰ŽīŠ°īŠī‰īˆ īŠļī‹īŠĢī‰‡īˆ īŠšīŠģī‰¨īŠˇī‹‹īˆ .Jumperīˆ ī‹‚ī‰ī‰Ļī‰ĸī‰Žī‰­ī‰‚ī‰‰ JP14īˆ īŠŊī‰ĩī‹ŒīŠģī‰īˆ ī‹’ī‹ąīŠ´ī‹ƒīˆ īŠļī‹īŠĢī‰‡īˆ ī‰‹īŠ īˆ  īˆ  ī‹’ī‰ŽīŠ—ī‹žī‰ī‹‹īˆ ī‹īŠģī‹ ī‰īˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‹’ī‰­ī‰Ļī‹„ī‹‡īˆ ī‹ī‰ŽīŠŗ 74 ī‹’ī‹Žī‹ƒī‹‹īˆ–īŠ¸īŠģī‹ĸī‰ī‹‹īˆ ī‹’ī‹Žī‹–ī‰‚ī‰‰ī‰Ēī‹ˆīŠ¸īŠģī‰īˆ ī‹’ī‰­ī‰Ļī‹„īˆšī‰īˆ ī‹’ī‹ŽīŠŧīŠˇ
  • 5. Practical Class 4 Programming Microcontrollers īˆ  īˆ īˆēī‹‘ī‰Ļī‹ī‰ĻīŠ†ī‰īˆ ī‰ī‰‚ī‹€ī‹ŽīŠŧīŠ¨ī‰ŽīŠģī‰ īˆ  īˆ  ī‹’ī‹ŽīŠ‰īˆ•īŠģī‰īˆ ī‹’ī‹€ī‹ŽīŠŧīŠ¨ī‰ŽīŠģī‰ īˆ  īˆ  ī‹’ī‹€ī‹ŽīŠŧīŠ¨ī‰ŽīŠģī‰īˆ ī‰ ī‰Ēī‰ą īˆ ī‰‹ī‹ąīŠ´īŠģī‰īˆ ī‹“īŠŧīŠ§īˆ īŠžī‹Œī‰ĩī‹ŒīŠŋīˆ īŠąī‰’īŠ¸īŠŋīˆ ī‹…ī‰šī‰˛ī‰‰īˆ ī‹’ī‹€ī‹ŽīŠŧīŠ¨ī‰ŽīŠģī‰īˆ ī‹Šī‰¨ī‹‡īˆ ī‹‚ī‹ŒīŠ´ī‰ īˆ īˆŸīŠŋī‰Ģīˆ  ī‰īŠŗī‹›īŠŋīˆ  īŠŊī‹ŽīŠŦī‰˛ī‰Žī‰‰īˆ  ī‹‚ī‹ŒīŠ´ī‰īˆ  ī‹ī‰‘īˆ  pinxīˆ  ī‹’ī‰‰ī‰ī‹Œī‰ŠīŠģī‰īˆ  ī‹…īŠŋīˆ  y īˆ  īˆ var = Getrc(pinx , y) īˆ īŠĩīŠŧīŠ¨ī‰Žī‰īˆ īˆŸīŠŋī‰Ģīˆ ī‰ī‰‰ī‰‚ī‰‘īˆ ī‹Œī‹‡īˆ ī‰—ī‰ī‰‚ī‹„īŠģī‰ī‹‹īˆ īŠąī‰’īŠ¸īŠī‰īˆ īŠ­ī‹ī‰ĒīŠ°ī‰īˆ ī‹…īŠŋī‰Ģīˆ ī‰°ī‰‚ī‹ŽīŠŗī‹‹ īˆ  īˆ īˆĄī‹ĩī‰‚īŠ¨īŠŋīˆ īŠąī‰’īŠ¸īŠī‰ī‹‹īˆ ī‹’īŠŋī‹‹ī‰‚īŠ´īŠī‰īˆ ī‹’ī‹€ī‹ŽīŠ´ī‰‰īˆ ī‹‰ī‰Žī‹€ī‹ŽīŠŗ īˆ  īˆ  īˆ  īˆ īˆēī‹‘ī‰Šī‰ī‰ĻīŠģī‰īˆ īŠŊī‹ŽīŠŦī‰˛ī‰īˆ ī‰—īŠŋī‰‚ī‹ƒī‰Ēī‰‰ $regfile = "m128def.dat" $crystal = 8000000 īˆ  īˆ īˆŽī‰ī‰‚ī‹ˆī‹Žī‰•ī‹Œī‰ŽīŠģī‰ '---------------------- Config Lcdpin = Pin , Db4 = Portc.4 , Db5 = Portc.5 , Db6 = Portc.6 , Db7 = īˆ ī‰Šī‰‚ī‹ˆīŠŖī‹ĸī‰īˆ ī‹’ī‰ąī‰‚ī‰ąīˆ ī‰‚ī‹ˆīŠ¨īŠŋīˆ ī‹’īŠŧī‰ĩī‹ŒīŠī‰īˆ ī‹’ī‰‰ī‰ī‹Œī‰ŠīŠģī‰īˆ īŠąī‹ī‰ĒīŠ¨ī‰ Portc.7 , E = Portc.2 , Rs = Portc.3 īˆ  īˆ īˆŽī‹’ī‹ŽīŠģī‰‚ī‰Žī‰Žī‹ī‰ĒīŠ¸īŠģī‰ Config Lcd = 20 * 4 '---------------------- Dim Rc_var As Word īˆ  īˆ ī‰ī‹œī‹Œī‰šī‰ŽīŠī‰īˆ īŠąī‹ī‰ĒīŠ¨ī‰ '---------------------- Cls : Cursor Off Lcd "RC Val= " Do Rc_var = Getrc(ping , 2) Locate 1 , 9 īˆ  īˆ īˆŽī‹ī‰Žī‹Žī‹–ī‰ĒīŠģī‰īˆ ī‰—īŠŋī‰‚ī‹ƒīˆ•īŠģī‰īˆ ī‹’īŠ´īŠŧī‰™ Lcd Rc_var īˆ  īˆ  Waitms 1000 Locate 1 , 8 : Lcd Spc(7) Loop End īˆ  īˆ  Faculty of Electrical and Electronic Eng. 75 Automatic Control & Automation Dept.
  • 6. ī‹‘ī‰ĒīŠŦī‰ļīŠī‰īˆ ī‰ī‰‚ī‹€īŠ¸ī‰šī‰ŽīŠī‰īˆ ī‹’īŠ‰ī‰Ēī‰‰ īˆ  īˆ  ī‹’īŠ¨ī‰‰ī‰ī‰ĒīŠģī‰īˆ ī‹’ī‰ŽīŠŧīŠ†ī‰ Exp.12: IR receiver, RC5-code īˆ  īˆ īˆ RC5īˆ ī‰Šī‰‚ī‹ŽīŠ¨īŠī‰īˆ īŠĩīŠ¯ī‹‹īˆ IR īˆ īŠžī‰‚ī‰ŠīŠ´ī‰Žī‰­ī‰īˆ ī‹‘ī‰Šī‰ī‰Ĩīˆ īˆēī‹‘ī‰Ēī‰˛īŠ§īˆ ī‹’ī‹Žī‹ƒī‰‚ī‰’īŠģī‰īˆ ī‹’ī‰‰ī‰Ēī‰–ī‰ŽīŠģī‰ īˆ  īˆ īˆēī‹’ī‰‰ī‰Ēī‰–ī‰ŽīŠģī‰īˆ ī‹…īŠŋīˆ ī‹’ī‹ī‰‚īŠŦīŠģī‰ .RC5, RC5-Extendedīˆ ī‰ī‹œī‹ŒīŠˇī‹Œī‰ī‹‹īˆ•īŠģī‰īˆ īŠĩīŠ¯ī‹‹īˆ īˆ¨CLRM-2038SīˆŠīˆ ī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ ī‰īŠ„īˆ ī‹’īŠ¨ī‰ąī‰ƒīˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠŋīˆ ī‹’īŠ‰ī‰Ēī‰‰īˆ ī‹‹īˆ īŠŊī‹Žī‰ĩī‹Œī‰ īˆ  īˆ īˆēīŠŊī‹Žī‰ĩī‹Œī‰ŽīŠģī‰īˆ īŠĄī‹ąīŠ‹ īˆ  īˆ  īˆ  īˆ īˆēī‹‘ī‰Šī‰ī‰ĻīŠģī‰īˆ īŠŊī‹€īŠ§īˆ ī‰ ī‰Ēī‰ą īˆ īŠŊī‹€īŠ¨ī‰īˆ  īˆžīŠģī‰īˆ  ī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ  ī‰īŠ„īˆ  ī‹’īŠ¨ī‰ąī‹žī‰‚ī‰‰īˆ  ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ  ī‹‘ī‰Ŧī‹ˆī‰•ī‰ƒīˆ  ī‹…īŠŋīˆ  ī‹’īŠŧī‰­ī‰ĒīŠŋīˆ  ī‰ĒīŠŋī‰ī‹‹ī‰ƒīˆ  īŠžī‰‚ī‰ŠīŠ´ī‰Žī‰­ī‰īˆ  ī‹‘ī‰Šī‰ī‰ĻīŠģīˆ  ī‰—īŠŋī‰‚ī‹ƒī‰Ēī‰‰īˆ  ī‹’ī‰‰ī‰‚ī‰ŽīŠ¸ī‰‰īˆ  ī‹‚ī‹ŒīŠ´ī‹ƒīˆ  īŠ˛ī‹Œī‰­ .RC5īˆ īŠžī‹ŒīŠˇī‹Œī‰ī‹‹īˆ•īŠģī‰īˆ ī‰īŠ´īŠ¯ī‹‹ īˆ  īˆ īˆēīŠŊī‹Žī‰ĩī‹Œī‰ŽīŠģī‰īˆ ī‰ī‰‚ī‰ŠīŠŧī‹ąī‰ŽīŠŋ īˆ  īˆ īˆŽī‰Šī‰‚ī‹ˆīŠŖī‹ĸī‰īˆ ī‹’ī‰ąī‰‚ī‰ąīˆ īŠŊī‹ŽīŠŦī‰˛ī‰ŽīŠģīˆ SW2īˆ ī‰ ī‰‚ī‰ŽīŠ°īŠī‰īˆ īŠļī‹īŠĢī‰‡īˆ īŠšīŠģī‰¨īŠˇī‹‹īˆ .Jumperīˆ ī‹‚ī‰ī‰Ļī‰ĸī‰Žī‰­ī‰‚ī‰‰ JP18īˆ īŠŊī‰ĩī‹ŒīŠģī‰īˆ ī‹’ī‹ąīŠ´ī‹ƒīˆ īŠļī‹īŠĢī‰‡īˆ ī‰‹īŠ īˆ  īˆ īˆēī‹‘ī‰Ļī‹ī‰ĻīŠ†ī‰īˆ ī‰ī‰‚ī‹€ī‹ŽīŠŧīŠ¨ī‰ŽīŠģī‰ ī‹’ī‰ŽīŠ—ī‹žī‰ī‹‹īˆ ī‹īŠģī‹ ī‰īˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‹’ī‰­ī‰Ļī‹„ī‹‡īˆ ī‹ī‰ŽīŠŗ 76 ī‹’ī‹Žī‹ƒī‹‹īˆ–īŠ¸īŠģī‹ĸī‰ī‹‹īˆ ī‹’ī‹Žī‹–ī‰‚ī‰‰ī‰Ēī‹ˆīŠ¸īŠģī‰īˆ ī‹’ī‰­ī‰Ļī‹„īˆšī‰īˆ ī‹’ī‹ŽīŠŧīŠˇ
  • 7. Practical Class 4 Programming Microcontrollers īˆ  īˆ  ī‹’ī‹ŽīŠ‰īˆ•īŠģī‰īˆ ī‹’ī‹€ī‹ŽīŠŧīŠ¨ī‰ŽīŠģī‰ īˆ  īˆ  ī‹’ī‹€ī‹ŽīŠŧīŠ¨ī‰ŽīŠģī‰īˆ ī‰ ī‰Ēī‰ą īˆ  īˆ Config Rc5 = Pinb.7 IRīˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠŋīˆ ī‰˜ī‰Ēī‰Ąīˆ īŠŠīŠŋīˆ īŠžī‹Œī‰ĩī‹ŒīŠī‰īˆ ī‰‹ī‹ąīŠ´īŠģī‰īˆ īŠąī‹ī‰ĒīŠ¨ī‰ Getrc5(address , Command) īˆ  īˆ īŠŊī‰­ī‰ĒīŠī‰īˆ ī‰Ģī‰‚ī‹ˆīŠ†ī‰īˆ ī‹…īŠŋīˆ ī‰ĒīŠŋī‹žī‰ī‹‹īˆ ī‹†ī‰ī‹Œī‹„īŠ¨īŠģī‰īˆ ī‰ˇī‰šīŠ¯ īˆ  īˆ īˆēī‹‘ī‰Šī‰ī‰ĻīŠģī‰īˆ īŠŊī‹ŽīŠŦī‰˛ī‰īˆ ī‰—īŠŋī‰‚ī‹ƒī‰Ēī‰‰ $regfile = "m128def.dat" $crystal = 8000000 īˆ  īˆ īˆŽī‰ī‰‚ī‹ˆī‹Žī‰•ī‹Œī‰ŽīŠģī‰ '--------------------- Config Lcdpin = Pin , Db4 = Portc.4 , Db5 = Portc.5 , Db6 = Portc.6 , Db7 = īˆ ī‰Šī‰‚ī‹ˆīŠŖī‹ĸī‰īˆ ī‹’ī‰ąī‰‚ī‰ąīˆ ī‰‚ī‹ˆīŠ¨īŠŋīˆ īŠŊī‰ĩī‹ŒīŠī‰īˆ ī‹’ī‰‰ī‰ī‹Œī‰ŠīŠģī‰īˆ īŠąī‹ī‰ĒīŠ¨ī‰ Portc.7 , E = Portc.2 , Rs = Portc.3 īˆ  īˆ īˆŽī‹’ī‹ŽīŠģī‰‚ī‰Žī‰Žī‹ī‰ĒīŠ¸īŠģī‰ Config Lcd = 20 * 4 '--------------------- Config Rc5 = Pinb.7 īˆ  īˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠī‰īˆ ī‰˜ī‰Ēī‰Ąīˆ ī‹‰īŠ¨īŠŋīˆ īŠŊī‰ĩī‹ŒīŠī‰īˆ ī‰‹ī‹ąīŠ´īŠģī‰īˆ īŠąī‹ī‰ĒīŠ¨ī‰ '--------------------- īˆ  īˆ ī‰ī‹œī‹Œī‰šī‰ŽīŠī‰īˆ īŠąī‹ī‰ĒīŠ¨ī‰ Dim Address As Byte , Command As Byte Enable Interrupts īˆ  īˆ ī‹’īŠŋī‰‚īŠ¨īŠģī‰īˆ ī‹’īŠ¨ī‰ŋī‰‚īŠ´īŠī‰īˆ ī‹īŠŧīŠ§īˆ īŠŊī‹ŽīŠ¨īŠ°ī‰ '--------------------- Cls Do īˆ ī‰—īŠŋī‰‚ī‹ƒīˆ•īŠģī‰īˆ ī‹•ī‰‚īŠ§ī‰Ļī‰Žī‰­ī‰īˆ ī‰‚ī‹ˆī‹ŽīŠ¯īˆ ī‹ī‰Žī‹īˆ ī‹ī‰Žī‹Žī‹–ī‰ĒīŠģī‰īˆ ī‰—īŠŋī‰‚ī‹ƒīˆ•īŠģī‰īˆ ī‹’īŠ´īŠŧī‰™ Gosub Remote_control īˆ  īˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‰Ģī‰‚ī‹ˆī‰•īˆ īŠŸīˆ īŠĸī‹ŒīŠŦī‰ēīŠī‰īˆ ī‰ ī‰‚ī‰ŽīŠ°īŠī‰īˆ ī‹’īŠģī‰‚ī‰™īˆ ī‹‘ī‹•ī‰ī‰ĒīŠ´īŠģīˆ ī‹īŠ§ī‰ĒīŠ°īŠģī‰ Loop '--------------------- Remote_control: Getrc5(address , Command) If Address = 0 Then īˆ  īˆ īˆēī‹īŠ§ī‰ĒīŠ°īŠģīˆ ī‰—īŠŋī‰‚ī‹ƒīˆ•īŠģī‰ Command = Command And &B01111111 īˆ  īˆ TVīˆ ī‰Ģī‰‚ī‹ˆī‰•īˆ ī‹†ī‰ī‹Œī‹„īŠ§īˆ ī‹Œī‹‡īˆ ī‹†ī‰‚īŠˇīˆ ī‰‚īŠŋīˆ ī‰ī‰§ī‰‡īˆ ī‹†ī‰ī‹Œī‹„īŠ¨īŠģī‰īˆ ī‰ˇī‰šīŠ¯ Cls Lcd "Command is: " ; Command īˆ ī‰Ģī‰‚ī‹ˆī‰•īˆ īŠŸīˆ īŠĸī‹ŒīŠŦī‰ēīŠī‰īˆ ī‰ ī‰‚ī‰ŽīŠ°īŠī‰‚ī‰‰īˆ īŠąī‹ī‰ĒīŠ¨ī‰īˆ ī‹’īŠ§ī‰‚ī‰Šī‰ŋī‹‹īˆ ī‰ˇī‰šīŠ¯ Waitms 50 īˆ  īˆ īˆŽī‹ī‰Žī‹Žī‹–ī‰ĒīŠģī‰īˆ ī‰—īŠŋī‰‚ī‹ƒīˆ•īŠģī‰īˆ īŠ•ī‰‡īˆ ī‹‘ī‰Ĩī‹ŒīŠ¨īŠģī‰īˆ ī‹ī‰‘īˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰ End If Return '--------------------- īˆ  īˆ  Faculty of Electrical and Electronic Eng. 77 Automatic Control & Automation Dept.
  • 8. ī‹‘ī‰ĒīŠŦī‰ļīŠī‰īˆ ī‰ī‰‚ī‹€īŠ¸ī‰šī‰ŽīŠī‰īˆ ī‹’īŠ‰ī‰Ēī‰‰ īˆ  īˆ  ī‹’īŠ¨ī‰‰ī‰ī‰ĒīŠģī‰īˆ ī‹’ī‰ŽīŠŧīŠ†ī‰ Exp.13: IR transmi er, RC5-code īˆ  īˆ RC5īˆ ī‰Šī‰‚ī‹ŽīŠ¨īŠī‰īˆ īŠĩīŠ¯ī‹‹īˆ IR īˆ īˆ īŠžī‰‚ī‰­ī‰Šī‰‡īˆ ī‹‘ī‰Šī‰ī‰Ĩīˆ īˆēī‰Ēī‰˛īŠ§īˆ ī‹’ī‰’īŠģī‰‚ī‰’īŠģī‰īˆ ī‹’ī‰‰ī‰Ēī‰–ī‰ŽīŠģī‰ īˆ  īˆ īˆēī‹’ī‰‰ī‰Ēī‰–ī‰ŽīŠģī‰īˆ ī‹…īŠŋīˆ ī‹’ī‹ī‰‚īŠŦīŠģī‰ īˆ  īˆ īˆŽRC5īˆ ī‰Šī‰‚ī‹ŽīŠ¨īŠī‰īˆ īŠĩīŠ¯ī‹‹īˆ ī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ ī‰īŠ„īˆ ī‹’īŠ¨ī‰ąī‰ƒīˆ īŠžī‰‚ī‰­ī‰Šī‰‡īˆ ī‹‘ī‰Šī‰ī‰Ĩīˆ ī‹•ī‰‚ī‹„ī‰‰ī‹‹īˆ īŠŊī‹Žī‰ĩī‹Œī‰ īˆ  īˆ īˆēīŠŊī‹Žī‰ĩī‹Œī‰ŽīŠģī‰īˆ īŠĄī‹ąīŠ‹ īˆ  īˆ  īˆ  īˆ īˆēī‹‘ī‰Šī‰ī‰ĻīŠģī‰īˆ īŠŊī‹€īŠ§īˆ ī‰ ī‰Ēī‰ą RC5, ī‰ī‹œī‹ŒīŠˇī‹Œī‰ī‹‹īˆ•īŠģī‰īˆ  īŠĩīŠ¯ī‹‹īˆ  ī‰ĻīŠ¨ī‰‰īˆ  ī‹…īŠ§īˆ  ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ  ī‰žī‰ī‰ĒīŠĢī‹žīˆ  ī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ  ī‰īŠ„īˆ  ī‹’īŠ¨ī‰ąī‰ƒīˆ  īŠŊī‰­ī‰ĒīŠŋīˆ  ī‹’īŠ‰ī‰Ēī‰‰ī‹‹īˆ  īŠŊī‹Žī‰ĩī‹Œī‰Žī‰‰īˆ  ī‹‚ī‹ŒīŠ´ī‹ƒīˆ  īŠ˛ī‹Œī‰­ īˆ  īˆ īˆŽī‰¸ī‰‚ī‰Ąīˆ ī‹īŠ¸īŠ„īˆ ī‰Ģī‰‚ī‹ˆī‰•īˆ ī‹ī‹€ī‰ļī‹ƒīˆ ī‹†ī‰ƒīˆ ī‹…īŠ¸īŠ™īˆ ī‹’ī‹ī‰‚ī‹ˆī‹„īŠģī‰īˆ īŠŸīˆ ī‰‚ī‹„ī‹ƒī‰ƒīˆ ī‹ī‰ƒīˆ īˆŽRC5-Extended īˆ  īˆ īˆēīŠŊī‹Žī‰ĩī‹Œī‰ŽīŠģī‰īˆ ī‰ī‰‚ī‰ŠīŠŧī‹ąī‰ŽīŠŋ īˆŽī‰Šī‰‚ī‹ˆīŠŖī‹ĸī‰īˆ ī‹’ī‰ąī‰‚ī‰ąīˆ īŠŊī‹ŽīŠŦī‰˛ī‰ŽīŠģīˆ SW2īˆ ī‰ ī‰‚ī‰ŽīŠ°īŠī‰īˆ īŠļī‹īŠĢī‰‡īˆ īŠšīŠģī‰¨īŠˇī‹‹īˆ .Jumperīˆ ī‹‚ī‰ī‰Ļī‰ĸī‰Žī‰­ī‰‚ī‰‰ JP17īˆ īŠŊī‰ĩī‹ŒīŠģī‰īˆ ī‹’ī‹ąīŠ´ī‹ƒīˆ īŠļī‹īŠĢī‰‡īˆ ī‰‹īŠ īˆ  īˆ īˆēī‹‘ī‰Ļī‹ī‰ĻīŠ†ī‰īˆ ī‰ī‰‚ī‹€ī‹ŽīŠŧīŠ¨ī‰ŽīŠģī‰ īˆ  īˆ īˆēīŠ”ī‰Žī‹Žī‰­ī‰‚ī‰­ī‰ƒīˆ īŠ”ī‰Žī‹Žī‹€ī‹ŽīŠŧīŠ¨ī‰īˆ īŠ•ī‰‡īˆ ī‰˜ī‰‚ī‰ŽīŠīˆ ī‰‚ī‹„ī‹ƒī‰ˆīŠ¯īˆ ī‹’ī‹ī‰Ēī‰˛īŠ§īˆ ī‰ī‰­īˆ ī‰œī‹Žī‰ī‰‚īŠ°īŠŋīˆ ī‹’ī‰™ī‹ŒīŠģīˆ ī‹‘ī‹•ī‰ī‰ĒīŠŗīˆ īŠŊī‰•ī‰ƒīˆ ī‹…īŠŋ īˆ  īˆ  ī‹’ī‹ŽīŠ‰īˆ•īŠģī‰īˆ ī‹’ī‹€ī‹ŽīŠŧīŠ¨ī‰ŽīŠģī‰ īˆ  īˆ  ī‹’ī‹€ī‹ŽīŠŧīŠ¨ī‰ŽīŠģī‰īˆ ī‰ ī‰Ēī‰ą īˆ ī‰‹ī‹ąīŠ´īŠģī‰īˆ  ī‹“īŠŧīŠ§īˆ  ī‰ĒīŠŋī‹žī‰ī‹‹īˆ  ī‹†ī‰ī‹Œī‹„īŠ¨īŠģī‰ī‹‹īˆ  ī‹’īŠģī‰‚īŠ‡ī‰īˆ  ī‰ī‰‰īˆ  īŠžī‰‚ī‰­ī‰Šī‰‡īˆ  ī‹’ī‹€ī‹ŽīŠŧīŠ¨ī‰ īˆ  īˆ Rc5send Togbit , Address , Command RC5īˆ īŠžī‹ŒīŠˇī‹Œī‰ī‹‹īˆ•īŠģī‰īˆ īŠĩīŠ¯ī‹‹īˆ OC1A ī‹’ī‰ŽīŠ—ī‹žī‰ī‹‹īˆ ī‹īŠģī‹ ī‰īˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‹’ī‰­ī‰Ļī‹„ī‹‡īˆ ī‹ī‰ŽīŠŗ 78 ī‹’ī‹Žī‹ƒī‹‹īˆ–īŠ¸īŠģī‹ĸī‰ī‹‹īˆ ī‹’ī‹Žī‹–ī‰‚ī‰‰ī‰Ēī‹ˆīŠ¸īŠģī‰īˆ ī‹’ī‰­ī‰Ļī‹„īˆšī‰īˆ ī‹’ī‹ŽīŠŧīŠˇ
  • 9. Practical Class 4 Programming Microcontrollers īˆ  īˆ īˆēī‹‘ī‰Šī‰ī‰ĻīŠģī‰īˆ īŠŊī‹ŽīŠŦī‰˛ī‰īˆ ī‰—īŠŋī‰‚ī‹ƒī‰Ēī‰‰ $regfile = "m128def.dat" $crystal = 8000000 īˆ  īˆ īˆŽī‰ī‰‚ī‹ˆī‹Žī‰•ī‹Œī‰ŽīŠģī‰ '--------------------- Config Debounce = 200 īˆ  īˆ īˆŽīŠžī‰‚ī‰­ī‰Šī‹ĸī‰īˆ ī‰ ī‰‚ī‰ŽīŠ°īŠŋīˆ īŠŠīŠŋīˆ īŠŊī‰ĩī‹ŒīŠī‰īˆ ī‰‹ī‹ąīŠ´īŠģī‰īˆ īŠąī‹ī‰ĒīŠ¨ī‰ Config Pine.4 = Input Porte.4 = 1 '--------------------- Dim Togbit As Byte , Command As Byte , Address As Byte īˆ  īˆ ī‰ī‹œī‹Œī‰šī‰ŽīŠī‰īˆ īŠąī‹ī‰ĒīŠ¨ī‰ Command = 12 īˆ  īˆ ī‰ī‹œī‹Œī‰šī‰Žī‹€īŠŧīŠģīˆ ī‹ī‹ŽīŠ´īŠģī‰īˆ ī‰Ĩī‰‚ī‹„ī‰­ī‰‡ Togbit = 0 Address = 0 '--------------------- Do īˆ ī‹“īŠŧīŠ§īˆ ī‰ĒīŠŋī‹žī‰īˆ īŠžī‰‚ī‰­ī‰Šī‰‡īˆ ī‰‚ī‹ˆī‹ŽīŠ¯īˆ ī‹ī‰Žī‹īˆ ī‹ī‰Žī‹Žī‹–ī‰ĒīŠģī‰īˆ ī‰—īŠŋī‰‚ī‹ƒīˆ•īŠģī‰īˆ ī‹’īŠ´īŠŧī‰™ Debounce Pine.4 , 0 , Pwr_cmd , Sub Loop īˆ  īˆ īˆŽī‰ ī‰‚ī‰ŽīŠ°īŠī‰īˆ īŠĄīŠŦī‰šīˆ īˆƒīˆ ī‰‚ī‹€īŠŧīŠˇ OC1A pin īˆ ī‰‹ī‹ąīŠ´īŠģī‰ īˆ  īˆ  End '--------------------- Pwr_cmd: Rc5send Togbit , Address , Command īˆ ī‹‘ī‰Ĩī‹ŒīŠ¨īŠģī‰īˆ ī‹ī‰‘īˆ ī‹†ī‰ī‹Œī‹„īŠ¨īŠģī‰ī‹‹īˆ ī‰ĒīŠŋī‹žī‰īˆ īŠžī‰‚ī‰­ī‰Šī‰‡īˆ ī‹‰ī‹ŽīŠ¯īˆ ī‹ī‰Žī‹īˆ ī‹īŠ§ī‰ĒīŠ°īŠģīˆ ī‰—īŠŋī‰‚ī‹ƒīˆ•īŠģī‰ Waitms 200 Return īˆ  īˆ īˆŽī‹ī‰Žī‹Žī‹–ī‰ĒīŠģī‰īˆ ī‰—īŠŋī‰‚ī‹ƒīˆ•īŠģī‰īˆ īŠ•ī‰‡ '------------- īˆ  īˆ  īˆ  īˆ  Faculty of Electrical and Electronic Eng. 79 Automatic Control & Automation Dept.
  • 10. ī‹‘ī‰ĒīŠŦī‰ļīŠī‰īˆ ī‰ī‰‚ī‹€īŠ¸ī‰šī‰ŽīŠī‰īˆ ī‹’īŠ‰ī‰Ēī‰‰ īˆ  īˆ  ī‹’īŠ¨ī‰‰ī‰ī‰ĒīŠģī‰īˆ ī‹’ī‰ŽīŠŧīŠ†ī‰ Appendix: Exp.12 and Exp.13 īˆ  īˆ īˆ īˆēī‹‘ī‰Ēī‰˛īŠ§īˆ ī‹’ī‰’īŠģī‰‚ī‰’īŠģī‰ī‹‹īˆ ī‹’ī‹Žī‹ƒī‰‚ī‰’īŠģī‰īˆ ī‹’ī‰‰ī‰Ēī‰–ī‰ŽīŠŧīŠģīˆ īŠĩī‰šīŠŧīŠŋ RC5-codeīˆ ī‰Šī‰‚ī‹ŽīŠ¨īŠī‰ī‹‹īˆ ī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ ī‰īŠ„īˆ ī‹’īŠ¨ī‰ąī‹žī‰‚ī‰‰īˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‰Ģī‰‚ī‹ˆī‰•īˆ ī‹…īŠ§īˆ īŠŊī‰ļīŠ°īŠŋīˆ ī‰ ī‰Ēī‰ą Detailed Article about Remote Control and IR Module What is infrared? īˆ  īˆ īˆŋī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ ī‰īŠ„īˆ ī‹’īŠ¨ī‰ąī‹žī‰īˆ ī‹ī‹‡īˆ ī‰‚īŠŋ īˆ ī‰īŠ„īˆ ī‹’īŠ¨ī‰ąī‹žī‰īˆ ī‹†ī‰‡īˆ ī‹’īŠ´ī‹ŽīŠ´īŠ‡ī‰īˆ īŠŸīˆ īˆŽī‰‚ī‹„ī‹Žī‹ŽīŠ§ī‹žīˆ ī‹’ī‹Žī‹–ī‰ĒīŠī‰īˆ ī‰ī‰ī‰Ĩī‰Ĩīˆ–īŠģī‰īˆ ī‹’īŠŋī‰Ŧī‰™īˆ ī‰īŠ„īˆ īŠŠīŠ´ī‹īˆ ī‹ī‹–ī‰ĒīŠŋīˆ īˆ—īŠĢīˆ ī‹ī‹–ī‹Œī‰šīˆ īŠĒī‰‚īŠ¨ī‰ąī‰‡īˆ ī‹’īŠŗī‰‚ī‰ŋīˆ ī‹…īŠ§īˆ ī‹‘ī‰Šī‰‚ī‰ŠīŠ§īˆ ī‹ī‹‡ īˆ ī‹†ī‰ƒīˆ īŠ”īŠ¨īŠŧīŠģīˆ ī‹…īŠ¸īŠ™īˆ ī‹œīˆ ī‰ī‰¨īˆšīˆ ī‹ĩī‰ī‰Ļī‰•īˆ ī‹‘īˆ—ī‰ļīŠŗīˆ ī‹’ī‰•ī‹ŒīŠŋīˆ ī‹ī‹‡ī‹‹īˆ  950nmīˆ ī‹’īŠ¨ī‰ąī‹žī‰īˆ ī‹Šī‰¨īˆšīˆ ī‹‰ī‰•ī‹ŒīŠī‰īˆ īŠžī‹Œī‰ŋīˆ īŠ­īŠŧī‰Šī‹īˆ ī‹īŠ¨ī‹Žī‰Šī‰ŋīˆ ī‹•ī‹Œī‰šīˆ ī‹ī‹‡īˆ ī‹•ī‰ī‰Ēī‹€īŠ‡ī‰ īˆ  īˆ īˆŽī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ ī‰īŠ„īˆ ī‹’īŠ¨ī‰ąī‹žī‰īˆ īŠŊī‰­ī‰ĒīŠŋīˆ ī‹…īŠŋīˆ ī‰“īŠ¨ī‰Šī‹„īŠī‰īˆ ī‹•ī‹Œī‰ēīŠģī‰īˆ ī‹”ī‰Ēī‰ īˆ  īˆ  īˆ īˆŦī‹ī‹–ī‰ĒīŠŋīˆ  īŠžī‰‚īŠ‰īˆ  ī‹…ī‹€ī‰šīˆ  īŠšīŠģī‰§ī‹‹īˆ  ī‹‘ī‰Ŧī‹ˆī‰•ī‹žī‰‚ī‰‰īˆ  ī‰ĻīŠ¨ī‰‰īˆ  ī‹…īŠ§īˆ  ī‹īŠ¸ī‰šī‰ŽīŠŧīŠģīˆ  ī‰‚ī‹ˆīŠŧī‹ˆī‰­ī‰ƒī‹‹īˆ  īŠļī‰Ēī‹ąīŠģī‰īˆ  ī‰ˇī‰Ąī‰Šī‰ƒīˆ  ī‹…īŠŋīˆ  ī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ  ī‰īŠ„īˆ  ī‹’īŠ¨ī‰ąī‹žī‰īˆ  īˆ•ī‰ŽīŠ¨ī‰ īˆ ī‹’īŠģī‹Œī‹ˆī‰­īˆ īŠ•ī‰‡īˆ ī‹’īŠ¯ī‰‚ī‰šī‹ĸī‰‚ī‰‰īˆ īˆŽī‹ī‹–ī‰ĒīŠī‰īˆ ī‰žī‰ĒīŠ¨īŠģī‰ī‹‹īˆ ī‹ī‹€īŠŗī‰ĒīŠģī‰īˆ īŠŊī‹Žī‰–ī‰Žī‰ŽīŠģī‰īˆ ī‹‘ī‰Ŧī‹ˆī‰•ī‰ƒī‹‹īˆ ī‹’ī‹ŽīŠģī‰Ŧī‹„īŠī‰īˆ ī‹’ī‹Žī‹–ī‰‚ī‰‰ī‰Ēī‹ˆīŠ¸īŠģī‰īˆ ī‹‘ī‰Ŧī‹ˆī‰•ī‹žī‰īˆ īŠŸīˆ ī‹‘ī‰Ēī‰’īŠ¸ī‰‰īˆ ī‹‚ī‰Ļī‰ĸī‰Žī‰Žī‰ī‹‹ īˆ īŠŠīŠŋīˆ  ī‹‚ī‰Ĩī‰‚ī‰ļī‰Žī‰īˆ  ī‹†ī‰ƒīˆ  ī‹…īŠ¸īŠ™īˆ  ī‰īŠŗī‹ŒīŠģī‰īˆ  ī‰¯īŠ°ī‹ƒīˆ  īŠŸīˆ  ī‰‚ī‹ˆī‹„īŠ¸īŠģī‹‹īˆ  īˆŦī‹ī‰Žī‹Žī‰ŋī‰‚ī‹„īŠŦīŠŋī‹‹ī‰Ēī‹ˆīŠ¸īŠģī‰īˆ  īŠŊī‰Ąī‰Ļī‰ŽīŠģī‰īˆ  ī‹…īŠŋīˆ  ī‹ī‹ƒī‰‚īŠ¨ī‰īˆ  ī‹œīˆ  ī‰‚ī‹ˆī‹ƒī‰ƒīˆ  ī‰‚ī‹€īŠˇīˆ  īˆŦī‰‚ī‹‡ī‰Ļī‹ŽīŠģī‹Œī‰ īˆ ī‰‚ī‹ˆī‹„īŠŋīˆ  īˆžīŠģī‰īˆ  ī‰ī‰‚īŠ§ī‰‚īŠ¨ī‰ąī‹ĸī‰īˆ  ī‹…īŠŋīˆ  ī‰ŧī‹ī‰ĒīŠ§īˆ  īŠąī‹Žī‰ŋīˆ  īŠžī‰‚īŠ‰īˆ  ī‹“īŠŧīŠ§īˆ  ī‹ī‹ŒīŠ„īˆ  ī‹ĩī‹ī‰’īŠŋīˆ  ī‰¯ī‹€ī‰˛īŠģī‰īˆ  ī‹’īŠ¨ī‰ąī‰„īŠˇīˆ  ī‹”ī‰Ēī‰Ąī‰ƒīˆ  ī‹•ī‰ī‰ĒīŠ›īˆ  ī‰īŠ„īˆ  ī‰ī‰‚īŠ§ī‰‚īŠ¨ī‰ąī‰‡ īˆ  īˆ īˆŽīŠžī‰‚ī‰­ī‰Šī‹ĸī‰īˆ ī‹’ī‹ŽīŠģī‰‚īŠ¨īŠ¯īˆ ī‹“īŠŧīŠ§īˆ ī‹Šī‰Šī‹‹ī‰Ļī‰‰īˆ ī‰Ēī‰‘ī‹›ī‹Žī‰­īˆ ī‰ī‰¨ī‹‡ī‹‹īˆ īˆŦī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ ī‰īŠ„īˆ ī‹’īŠ¨ī‰ąī‹žī‰ īˆ īˆēī‹ĩī‹ī‰’īŠŋīˆ ī‰‚ī‹ƒī‰Ĩī‰‚ī‰Žī‰•ī‰„īŠˇīˆ ī‹‘ī‰Šī‰ī‰Ēī‰™īˆ ī‰Šī‰Ļī‰ļī‰īˆ īˆžīŠģī‰īˆ ī‹‚ī‰‚ī‰Žī‰•ī‹žī‰īˆ ī‹ĩī‰‚ī‰ĩī‹Œī‰Ąī‹‹īˆ īˆŦī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ ī‰īŠ„īˆ ī‹’īŠ¨ī‰ąī‹žī‰īˆ ī‰ĻīŠģī‹Œī‰īˆ ī‹†ī‰ƒīˆ ī‹…īŠ¸īŠ™īˆ ī‹•ī‰‚ī‹Žī‰ąī‹žī‰īˆ ī‹…īŠŋīˆ īˆ—ī‰’īŠˇīˆ ī‹†ī‰‡ īˆ ī‹’īŠ°ī‹ī‰ŦīŠī‰īˆ  ī‹’īŠ¨ī‰ąī‹žī‰īˆ  ī‹ī‰Ĩī‰‚īŠ°ī‰ŽīŠģīˆ  īŠŊī‰­ī‰ĒīŠī‰īˆ  ī‰Ģī‰‚ī‹ˆī‰–īŠŧīŠģīˆ  ī‹†ī‰ī‹Œī‹„īŠ§īˆ  ī‹‹ī‰ƒīˆ  ī‰ ī‰‚ī‰ŽīŠ°īŠŋīˆ  ī‹‚ī‰ī‰Ļī‰ĸī‰Žī‰­ī‰īˆ  ī‰‹īŠīˆ  īŠšīŠģī‰¨īŠģīˆ  īˆŦī‰Šī‰‚īŠ‡ī‰īˆ  ī‹•ī‰‚īŠī‰īˆ  īˆŦī‹†ī‰ī‰ĒīŠ¯ī‹žī‰īˆ  īˆŦī‰œī‹Žī‰‰ī‰‚ī‰ļīŠī‰ īˆ ī‰‚īˆšīˆ ī‰‹ī‹Žī‰–ī‰Žī‰Žī‹īˆ ī‹†ī‰ƒīˆ ī‰‹īŠīˆ īˆžīŠģī‰īˆ ī‹’ī‹ŽīŠ´ī‹ŽīŠ´īŠ‡ī‰īˆ ī‰ī‰‚ī‹ƒī‰‚ī‹Žī‰ŠīŠģī‰īˆ ī‹…īŠ§īˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠī‰īˆ īˆ•ī‰ĸī‹ŽīŠģī‹‹īˆ ī‹ī‰Šī‰ī‰Ēī‰™īˆ ī‰Šī‰ī‰Ļī‰ĩī‰‡īˆ ī‰‚īˆšīˆ īˆžīŠģī‰īˆ ī‹‚ī‰‚ī‰Žī‰•ī‹žī‰īˆ ī‹…īŠ§īˆ ī‹‘ī‰Šī‰Ĩī‰‚ī‰ļīŠģī‰ īˆ  īˆ īˆŽīˆ¨AddressīˆŠīˆ ī‹†ī‰ī‹Œī‹„īŠ¨īŠģī‰īˆ ī‰Ÿī‰‰īˆ ī‹‰ī‹„īŠ§īˆ īˆ•īŠ¨ī‹ī‹‹īˆ ī‹ĩī‰‚īŠ´ī‰™ī‹œīˆ ī‹‰ī‰šī‰šī‹Œī‹ƒīˆ īŠ˛ī‹Œī‰­īˆ ī‰‚īŠŋīˆ ī‰ī‰¨ī‹‡ī‹‹īˆ īˆŦī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‹‚ī‰‚īŠ¤ī‹ƒ īˆ 36KHZīˆ ī‹…ī‹€ī‰šīˆ ī‹Œī‹‡īˆ īŠŊī‰ēīŠ¯ī‹žī‰īˆ ī‹’īŠ¨ī‰ąī‹žī‰īˆ īŠžī‰‚īŠ‰ī‹‹īˆ  30KHZ – 60KHZīˆ īŠ”ī‰‰īˆ ī‰ ī‹‹ī‰īˆ–ī‰īˆ ī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ ī‰īŠ„īˆ ī‹’īŠ¨ī‰ąī‹žī‰īˆ ī‰ī‰ī‰Ĩī‰Ĩī‰Ēī‰īˆ ī‹’īŠŋī‰Ŧī‰™īˆ ī‹†ī‰‡ īˆ 36KHZ, 38KHZīˆ īŠ”ī‰ŽīŠŋī‰ŦīŠ‡ī‰īˆ ī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ ī‰īŠ„īˆ ī‹’īŠ¨ī‰ąī‹žī‰‚ī‰‰īˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‹‘ī‰Ŧī‹ˆī‰•ī‰ƒīˆ ī‹‚ī‰Ļī‰ĸī‰Žī‰Žī‰īˆ īŠšīŠģī‰¨īŠģīˆ īˆŽīˆ¨38KHZīˆŠīˆ ī‹‰īŠģī‹Œī‰™īˆ īˆžīŠģī‰īˆ ī‹‚ī‰ŦīŠ‡ī‰ī‹‹ īˆ ī‰Šī‹‹ī‰Ĩīˆ īŠžī‹ī‰Ąīˆ ī‹‘ī‰ĒīŠŋīˆ īŠąīŠģī‰ƒīˆ  36~38īˆ ī‰Œī‰¨ī‰‰ī‰¨ī‰Žī‹īˆ īŠ˛ī‹Œī‰­īˆ ī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ ī‰īŠ„īˆ ī‹’īŠ¨ī‰ąī‹ŸīŠģīˆ īŠŊī‰­ī‰ĒīŠī‰īˆ ī‹ī‹–ī‰‚ī‹„ī‰’īŠģī‰īˆ ī‹†ī‰ƒīˆ īˆŸīŠ¨ī‹īˆ ī‰ī‰¨ī‹‡ī‹‹īˆ ī‰ī‰‚īŠŋī‹ŒīŠŧīŠ¨īŠī‰īˆ īŠžī‰‚ī‰­ī‰Šī‹ĸ īˆ  īˆ īˆŽī‹īŠ´ī‹ąī‹„īŠŋīˆ ī‰ĒīŠ°ī‰ĩīˆ ī‹’ī‹€ī‹ŽīŠŗīˆ īŠŊī‰•ī‰ƒīˆ ī‹…īŠŋīˆ ī‹…īŠˇī‰‚ī‰­īˆ ī‹†ī‹ŒīŠ¸ī‹Žī‰­ī‹‹īˆ īˆŦī‹īŠ´ī‹ąī‹„īŠŋīˆ ī‰Ļī‰™ī‰ī‹‹īˆ ī‹’ī‹€ī‹ŽīŠ´īŠģī‰īˆ īŠŊī‰•ī‰ƒīˆ ī‹…īŠŋīˆ ī‹’ī‹Žī‹ƒī‰‚ī‰‘īˆ ī‰Ļī‰™ī‰ī‹‹īˆ ī‹Šī‰Šī‰ĻīŠŗ īˆ ī‰ī‰ī‰Ĩī‰Ĩīˆ–īŠģī‰īˆ  ī‹Šī‰¨ī‹‡īˆ  īŠžī‰‚ī‰ŠīŠ´ī‰Žī‰­ī‰īˆ  īŠŸīˆ  ī‹…ī‹€īŠ¸ī‰īˆ  ī‹’ī‰‰ī‹ŒīŠ¨ī‰ļīŠģī‰īˆ  ī‹…īŠ¸īŠģīˆ  īˆŦī‹’īŠŧī‹ˆī‰­īˆ  ī‹’īŠģī‰„ī‰ŽīŠŋīˆ  ī‹ī‹‡īˆ  36KHZ, 38KHZīˆ  ī‰Ĩī‰Ĩī‰Ēī‰īˆ  īŠžī‰‚ī‰­ī‰Šī‰‡īˆ  ī‹’īŠģī‰„ī‰ŽīŠŋīˆ  ī‹†ī‰‡ īˆ ī‰ŧīŠ¨ī‰‰īˆ ī‹‚ī‹ŒīŠ´ī‰īˆ ī‰‹ī‰Šī‰ŽīŠģī‰īˆ ī‰ī‰¨īˆšīˆ īˆŦīŠĄī‹Žīˆī‰īˆ ī‰—ī‹Žī‰–ī‰ēīŠģī‰īˆ ī‰ī‰ī‰Ĩī‰Ĩī‰Ēī‰īˆ ī‰‚ī‹ˆīŠ¨īŠŋīˆ ī‰ī‰ŠīŠˇī‰ī‰Ēī‰ī‹‹īˆ ī‹•ī‰ī‹Œīˆšī‰īˆ īˆ•īŠ§īˆ ī‰īŠŧīŠ´ī‰Žī‹ƒī‰īˆ ī‰ī‰ī‰Ĩī‰Ĩīˆ–īŠģī‰īˆ ī‹Šī‰¨ī‹‡īˆ ī‹†ī‰ƒīˆ ī‹ĩī‰‚ī‰ĩī‹Œī‰ļī‰Ąī‹‹ īˆ īŠšīŠ¯īˆ  ī‰ī‰ī‰Šī‰ī‰Ĩī‹‹īˆ  ī‹’īŠŋī‰ŦīŠ‡ī‰īˆ  ī‰ī‰‚ī‰šī‰ąī‰ĒīŠŋīˆ  ī‹“īŠŧīŠ§īˆ  ī‰‚ī‹ˆī‰Žī‹Žī‹„ī‰‰īˆ  īŠŸīˆ  ī‹ī‹ŒīŠ„īˆ  īˆžīŠģī‰īˆ  ī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ  ī‰īŠ„īˆ  ī‹’īŠ¨ī‰ąī‹žī‰īˆ  ī‰ī‹ī‰ŠīŠ´ī‰Žī‰ŽīŠŋīˆ  ī‰˜ī‰‚ī‰Žī‹ƒī‰ˆī‰‰īˆ  ī‰ī‰‚īŠˇī‰Ēī‰˛īŠģī‰ ī‹’ī‰ŽīŠ—ī‹žī‰ī‹‹īˆ ī‹īŠģī‹ ī‰īˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‹’ī‰­ī‰Ļī‹„ī‹‡īˆ ī‹ī‰ŽīŠŗ 80 ī‹’ī‹Žī‹ƒī‹‹īˆ–īŠ¸īŠģī‹ĸī‰ī‹‹īˆ ī‹’ī‹Žī‹–ī‰‚ī‰‰ī‰Ēī‹ˆīŠ¸īŠģī‰īˆ ī‹’ī‰­ī‰Ļī‹„īˆšī‰īˆ ī‹’ī‹ŽīŠŧīŠˇ
  • 11. Practical Class 4 Programming Microcontrollers īˆ īŠŊīŠ¸ī‰˛īŠģī‰īˆ  īˆ  īˆŽī‹’ī‹ŽīŠ´ī‹ŽīŠ´īŠ‡ī‰īˆ  ī‹‘ī‰Šī‰‚ī‰ąī‹ĸī‰īˆ  ī‰¸ī‹ī‰ĸī‰Žī‰­ī‰īˆ  ī‹“īŠŧīŠ§īˆ  ī‰ĻīŠ§ī‰‚ī‰Žī‹īˆ  ī‹Šī‰Šī‹‹ī‰Ļī‰‰īˆ  ī‰ī‰¨ī‹‡ī‹‹īˆ  īˆŦī‹’ī‰‰ī‹ŒīŠĢī‰ĒīŠŋīˆ  īˆ—īŠŦīŠģī‰īˆ  ī‹‚ī‰Ŧī‰šīŠŧīŠģīˆ  ī‰ˇīŠ´īŠģī‰īˆ  ī‰ī‰ī‰Šī‰ī‰Ĩī‹‹īˆ  īˆ—īŠ°ī‰˛ī‰ŽīŠģī‰ īˆ ī‹‘ī‰ĻīŠ§ī‰‚īŠŗīˆ  ī‹“īŠŧīŠ§īˆ  27uSīˆ  ī‹’īŠ¨ī‰‰ī‰ĒīŠŋīˆ  ī‹‘ī‰Šī‰‚ī‰ąī‰‡īˆ  īŠĩī‹Žī‰Šī‹ąī‰Žī‰‰īˆ  īŠšīŠģī‰§ī‹‹īˆ  īˆŦ36KHZīˆ  ī‰Ĩī‰Ĩī‰Ēī‰īˆ  īŠžī‰‚ī‰­ī‰Šī‰‡īˆ  īŠŊī‰•ī‰ƒīˆ  ī‹…īŠŋīˆ  ī‹’ī‹ąī‹Žī‰Žī‰‰īˆ  īŠžī‰‚ī‰­ī‰Šī‰‡īˆ  ī‹‘ī‰Šī‰ī‰Ĩīˆ  īŠ”ī‰Šī‹īˆ  ī‹īŠģī‰‚ī‰ŽīŠģī‰ īˆ  īˆ īˆŽ2īˆ īŠŊīŠ¸ī‰˛īŠģī‰īˆ īŠŸīˆ ī‰‚ī‹€īŠˇīˆ ī‰‚ī‹ˆīŠŧī‹ī‰ĻīŠ¨ī‰ī‹‹īˆ ī‹’īŠŧī‰­ī‰ĒīŠī‰īˆ ī‹‘ī‰Šī‰‚ī‰ąī‹ĸī‰īˆ ī‹‚ī‹ī‰Žī‰­ī‰‚ī‰‰īˆ ī‹‚ī‹ŒīŠ´ī‹Žī‰­īˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠī‰īˆ ī‹†ī‰‡īˆ īˆŽ1īˆ īŠŊīŠ¸ī‰˛īŠģī‰īˆ ī‰Šī‹Œī‰Žī‰­ī‰Ŧī‹ƒī‰īˆ–īŠģī‰ īˆ  īˆ  īˆ  īˆ  īˆ  īˆ 1īˆ īŠŊīŠ¸ī‰˛īŠģī‰ īˆ  īˆ 2īˆ īŠŊīŠ¸ī‰˛īŠģī‰ īˆ  īˆ īˆŽī‹‘ī‰Šī‰‚ī‰ąī‹ŖīŠģīˆ ī‹īŠ´ī‹ąī‹„īŠī‰īˆ ī‹”ī‹Œī‰Žī‰ŽīŠī‰īˆ ī‰ī‰ŽīŠ¸īŠ§īˆ ī‰ĻīŠŗīˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠī‰īˆ īŠŊī‰Ąī‰ī‰Ĩīˆ ī‹‘ī‰Ĩī‹Œī‰•ī‹ŒīŠī‰īˆ īŠŊī‹ī‰ĻīŠ¨ī‰ŽīŠģī‰īˆ ī‹‘ī‰Šī‰ī‰Ĩīˆ ī‹†ī‰ƒīˆ īŠĨī‰™ī‹ī‹ƒ What is IR Transmiting pr ot ocol s? t īˆ  īˆ  īˆŋī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ ī‰īŠ„īˆ ī‹’īŠ¨ī‰ąī‹žī‰īˆ ī‹‚ī‰ī‰Ļī‰ĸī‰Žī‰­ī‰‚ī‰‰īˆ īŠžī‰‚ī‰­ī‰Šī‹ĸī‰īˆ īˆ—ī‹ī‰‚īŠ¨īŠŋīˆ ī‹ī‹‡ī‰‚īŠŋ īˆ īˆŦRC5īˆ  īˆŦSIRCSīˆ  īˆŦNECīˆ īˆēī‰‚ī‹ˆī‹„īŠŋīˆ  īˆŦī‰ī‹ī‰ŠīŠ´ī‰Žī‰ŽīŠī‰īˆ  ī‰‚ī‹ˆī‹ŽīŠŧīŠ§īˆ  īŠŊī‹€īŠ¨ī‰īˆ  īˆžīŠģī‰īˆ  īˆ¨ī‰ī‹œī‹ŒīŠˇī‹Œī‰ī‹‹ī‰Ēī‰‰īˆŠīˆ  īŠžī‰‚ī‰­ī‰Šī‹ĸī‰īˆ  īˆ—ī‹ī‰‚īŠ¨īŠŋīˆ  ī‹…īŠŋīˆ  īˆ—ī‰’īŠ¸īŠģī‰īˆ  īŠēī‰‚ī‹„ī‹‡ īˆ ī‰‚ī‹ˆī‰Žī‹Žī‹„ī‰‰ī‹‹īˆ  īŠžī‰‚ī‰­ī‰Šī‹ĸī‰īˆ  ī‹’ī‰•ī‹ŒīŠŋīˆ  īŠŊīŠ¸ī‰ąīˆ  īŠŸīˆ  ī‰‚ī‹ˆī‰ēīŠ¨ī‰‰īˆ  ī‹…īŠ§īˆ  ī‰ī‹œī‹ŒīŠˇī‹Œī‰ī‹‹īˆ•īŠģī‰īˆ  ī‹Šī‰¨ī‹‡īˆ  īŠąīŠŧī‰ŽīŠ…ī‹‹īˆ  īˆŽSonyīˆ  īˆŦSAMSUNGīˆ  īˆŦJAPAN īˆ  īˆ īˆ īˆŽīˆ¨WaveformsīˆŠ RC5 Transmi ing protocols? RC5īˆ īŠžī‰‚ī‰­ī‰Šī‹ĸī‰īˆ ī‰Šī‰‚ī‹ŽīŠ¨īŠŋ īˆ 14īˆ  ī‹…īŠŋīˆ  ī‰Šī‰‚ī‹ąīŠŗīˆ  īŠžī‰‚ī‰­ī‰Šī‰ˆī‰‰īˆ  ī‰ˇī‰ĸīŠŧī‰Žī‹ī‹‹īˆ  ī‰¯ī‰ŠīŠŧī‹ŽīŠ¯īˆ ī‹’īŠˇī‰Ēī‰ąīˆ ī‹‰ī‰ī‰Šī‹Œī‰ŋīˆ  ī‹ī‰¨īŠģī‰īˆ  RC5īˆ ī‰Šī‰‚ī‹ŽīŠ¨īŠŋīˆ  ī‹“īŠŧīŠ§īˆ  ī‹īŠŧīŠˇīˆ  īŠŊīŠ¸ī‰˛ī‰‰īˆ  ī‰‹ī‰ļī‹„ī‹īˆ  ī‰‚ī‹„īŠŋī‰‚ī‹€ī‰Žī‹‡ī‰īˆ  ī‹†ī‰‡ īˆ ī‹…īŠŋīˆ ī‰Šī‰‚ī‹ąīŠ´īŠģī‰īˆ ī‰ī‰¨ī‹‡ī‹‹īˆ īˆŦī‹’ī‰ēī‰Šī‹ƒīˆ īŠŊīŠ¸īŠģīˆ 1.728mSīˆ ī‹…īŠŋī‰Ŧī‰‰ī‹‹īˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‰Ģī‰‚ī‹ˆī‰•īˆ ī‰Šī‰ī‰Šī‰Ģī‰ƒīˆ ī‰Ļī‰™ī‰ƒīˆ ī‹“īŠŧīŠ§īˆ īŠĄīŠŦī‰ēīŠģī‰īˆ ī‰‚ī‹ˆī‹ŽīŠ¯īˆ ī‹ī‰Žī‹īˆ ī‹‘ī‰ĒīŠŋīˆ īŠŊīŠˇīˆ īŠŸīˆ ī‹’ī‰ēī‰Šī‹ƒ īˆ  īˆ īˆŽī‹ĩī‰‚ī‰ŋī‹ŒīŠŦī‰ēīŠŋīˆ ī‰ ī‰‚ī‰ŽīŠ°īŠī‰īˆ ī‰ī‹ŽīŠ´ī‰‰ī‰ƒīˆ ī‰ī‰§ī‰‡īˆ 130mSīˆ īŠŊīŠˇīˆ ī‰Šī‰ĒīŠ¸ī‰Žī‹īˆ ī‰ī‰‚ī‰ēī‰Šī‹„īŠģī‰ īˆ  īˆ īˆēī‹’ī‹ŽīŠģī‰‚ī‰ŽīŠģī‰īˆ ī‰ī‰īˆ–īŠŋī‰ī‰Šī‰‚ī‰ŠīŠģī‰īˆ īŠ•ī‰‡īˆ īŠ˛ī‰ĒīŠ¨ī‰ŽīŠģī‰īˆ ī‰‹īŠīˆ īŠžī‹ŒīŠˇī‹Œī‰ī‹‹īˆ•īŠģī‰īˆ ī‰ī‰¨ī‹‡īˆ īŠŊī‹€īŠ§īˆ ī‰ƒī‰Ļī‰ŠīŠŋīˆ ī‹ī‹ˆīŠ°īŠģī‹‹ īˆŽīˆ¨Address LengthīˆŠīˆ ī‹†ī‰ī‹Œī‹„īŠ¨īŠģī‰īˆ īŠžī‹Œī‰ŋ - īˆŽīˆ¨Command LengthīˆŠīˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‰ĒīŠŋī‰ƒīˆ īŠžī‹Œī‰ŋ - īˆŽīˆ¨Carrier Frequency īˆŠīˆ īŠŊīŠŗī‰‚ī‹„īŠģī‰īˆ ī‰Ĩī‰Ĩī‰Ēī‰ - īˆŽīˆ¨Start BitīˆŠīˆ īŠžī‰‚ī‰­ī‰Šī‹ĸī‰īˆ ī‹’ī‹ī‰ī‰Ļī‰‰īˆ ī‹’ī‰ēī‰Šī‹ƒīˆ ī‹…īŠŋī‰Ģ - īˆŽīˆ¨High-Bit-TimeīˆŠīˆ "1"īˆ ī‹īŠ´ī‹ąī‹„īŠī‰īˆ ī‹”ī‹Œī‰Žī‰Žī‹€īŠŧīŠģīˆ īŠžī‰‚ī‰­ī‰Šī‹ĸī‰īˆ ī‹’ī‰ēī‰Šī‹ƒīˆ ī‹…īŠŋī‰Ģ - īˆŽīˆ¨Low-Bit-TimeīˆŠīˆ "0"īˆ ī‹īŠ´ī‹ąī‹„īŠī‰īˆ ī‹”ī‹Œī‰Žī‰Žī‹€īŠŧīŠģīˆ īŠžī‰‚ī‰­ī‰Šī‹ĸī‰īˆ ī‹’ī‰ēī‰Šī‹ƒīˆ ī‹…īŠŋī‰Ģ - īˆŽīŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠī‰īˆ īŠĒī‹Œī‹ƒīˆ ī‰‹ī‰Žī‰™īˆ īŠąīŠŧī‰ŽīŠ…īˆ ī‰ī‰īˆ–īŠŋī‰ī‰Šī‰‚ī‰ŠīŠģī‰īˆ ī‹Šī‰¨ī‹‡īˆ ī‹†ī‰‡ īˆ ī‰‚ī‹€ī‹ˆī‹„īŠŋīˆ īŠŊīŠ¸īŠģī‹‹īˆ īˆŦī‹ī‰Šī‰‚ī‰Žī‹īˆ īŠąī‰ļī‹ƒī‹‹īˆ īˆŸī‹ŽīŠ™īˆ īŠąī‰ļī‹ƒīˆ ī‹‰īŠģīˆ īˆēīŠ”ī‹€ī‰ŽīŠŗīˆ īŠ•ī‰‡īˆ ī‹ī‰ŽīŠ´ī‹„īŠŋīˆ ī‰Ļī‰™ī‰ī‹‹īˆ ī‰ī‰‰īˆ ī‹ī‹‡īˆ ī‰ī‰‚ī‰ēī‰Šī‹„īŠģī‰īˆ ī‰Šī‰‚ī‹ąīŠŗīˆ ī‹…īŠŋīˆ ī‹’ī‰ēī‰Šī‹ƒīˆ īŠŊīŠˇīˆ ī‹†ī‰‡ īˆ ī‹ī‰ŽīŠ´īŠģī‰īˆ ī‹†ī‰ˆīŠ¯īˆ īˆŦī‹īŠ´ī‹ąī‹„īŠŋīˆ ī‰Ļī‰™ī‰ī‹‹īˆ ī‹Œī‹‡īˆ īŠžī‰‚ī‰­ī‰Šī‹ĸī‰īˆ īŠ˛ī‰Ēī‰ŋīˆ ī‹…īŠŋīˆ īŠŊī‰­ī‰ĒīŠī‰īˆ ī‰ī‰ŠīŠģī‰īˆ ī‹†ī‰‚īŠˇīˆ ī‰ī‰§ī‰ˆīŠ¯īˆ īˆŽī‹ĩī‰‚ī‹€ī‹–ī‰ī‰Ĩīˆ ī‰Ēī‰Ąī‹ĄīŠģīˆ ī‰¯īŠˇī‰‚īŠ¨īŠŋīˆ ī‹īŠ´ī‹ąī‹„īŠŋīˆ ī‹”ī‹Œī‰Žī‰ŽīŠŋ Faculty of Electrical and Electronic Eng. 81 Automatic Control & Automation Dept.
  • 12. ī‹‘ī‰ĒīŠŦī‰ļīŠī‰īˆ ī‰ī‰‚ī‹€īŠ¸ī‰šī‰ŽīŠī‰īˆ ī‹’īŠ‰ī‰Ēī‰‰ īˆ  īˆ  ī‹’īŠ¨ī‰‰ī‰ī‰ĒīŠģī‰īˆ ī‹’ī‰ŽīŠŧīŠ†ī‰ īˆ īŠŊī‰­ī‰ĒīŠī‰īˆ ī‰ī‰ŠīŠģī‰īˆ ī‹†ī‰‚īŠˇīˆ ī‰ī‰§ī‰‡ī‹‹īˆ īˆŦī‹īŠ´ī‹ąī‹„īŠŋīˆ ī‰ĒīŠ°ī‰ĩīˆ ī‹†ī‹ŒīŠ¸ī‹Žī‰­īˆ ī‹ī‰Šī‰‚ī‰Žī‹ŽīŠģī‰īˆ ī‹ī‰ŽīŠ´īŠģī‰īˆ ī‰‚ī‹€ī‹„ī‹Žī‰‰īˆ īˆŦī‹īŠ´ī‹ąī‹„īŠŋīˆ ī‰Ļī‰™ī‰ī‹‹īˆ ī‹†ī‹ŒīŠ¸ī‹Žī‰­īˆ ī‰ī‰ŠīŠģī‰īˆ ī‹…īŠŋīˆ īˆŸī‹Žī‹€ī‹ŽīŠģī‰ īˆ  īˆ īˆŽī‹ĩī‰‚īŠŋī‰‚īŠ—īˆ ī‹’īŠ´ī‰‰ī‰‚ī‰ŽīŠģī‰īˆ ī‹’īŠģī‰‚īŠ‡ī‰īˆ ī‰¯īŠ¸īŠ§īˆ ī‹†ī‹ŒīŠ¸ī‰Žī‰ŽīŠ¯īˆ īˆŦī‹īŠ´ī‹ąī‹„īŠŋīˆ ī‰ĒīŠ°ī‰ĩīˆ ī‹Œī‹‡ īˆ  īˆ ī‹‰īŠŧī‰ŠīŠ´ī‰Žī‰Žī‰īˆ īŠ˛ī‹Œī‰­īˆ ī‹ī‰¨īŠģī‰īˆ ī‹īŠ´ī‹ŽīŠ´īŠ‡ī‰īˆ īŠĩī‹ąī‹„īŠī‰īˆ īŠ”ī‰Šī‹īˆ īŠŊīŠ¸ī‰˛īŠģī‰ īˆ ī‰ī‰ŠīŠŧīŠģīˆ ī‹īŠ´ī‹ąī‹„īŠī‰īˆ ī‹”ī‹Œī‰Žī‰ŽīŠī‰īˆ ī‰¯īŠ°ī‹ƒīˆ ī‹‰īŠģīˆ ī‹†ī‹ŒīŠ¸ī‹Žī‰­īˆ īˆŦīŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠī‰īˆ ī‰ī‰ŠīŠģī‰īˆ ī‹…īŠŋīˆ īˆŸī‹Žī‹€ī‹ŽīŠģī‰īˆ ī‹ī‰ŽīŠ´īŠģī‰īˆ ī‹†ī‰ƒīˆ ī‰—ī‰Žī‹„ī‰Žī‰Žī‰īˆ ī‹†ī‰ƒīˆ īŠšī‹„īŠ¸īŠ™īˆ īˆŦī‰Ēī‰Ąī‰…īˆ ī‹“ī‹„īŠ¨īŠ– īˆ ī‰Ļī‰™ī‰ī‹‹īˆ ī‹Œī‹‡īˆ īŠŊī‰­ī‰ĒīŠī‰īˆ ī‰ī‰ŠīŠģī‰īˆ ī‹†ī‰ƒīˆ īˆŸīŠ¨ī‹īˆ ī‰ī‰¨ī‹‡ī‹‹īˆ īˆŦī‹īŠ´ī‹ąī‹„īŠŋīˆ ī‰Ļī‰™ī‰ī‹‹īˆ ī‹”ī‹Œī‰Žī‰ŽīŠŋīˆ ī‰‚īˆšīˆ ī‹•ī‰‚īŠŗī‰Šī‰ŦīŠģī‰īˆ ī‹’ī‰ēī‰Šī‹„īŠģī‰īˆ ī‰ĻīŠƒīˆ īŠĩī‰‰ī‰‚ī‰ŽīŠģī‰īˆ īŠŊīŠ¸ī‰˛īŠģī‰īˆ ī‹…īŠŋīˆ īˆŦīŠŊī‰­ī‰ĒīŠī‰ īˆ  īˆ īˆŽī‹‰ī‰ŽīŠ¸īŠ§īˆ ī‹†ī‹ŒīŠ¸ī‹Žī‰­īˆ ī‹ī‰Šī‰‚ī‰Žī‹ŽīŠģī‰īˆ ī‹ī‰ŽīŠ´īŠģī‰īˆ ī‹…īŠ¸īŠģī‹‹īˆ īˆŦī‰‚ī‰ēī‹ī‰ƒīˆ ī‹īŠ´ī‹ąī‹„īŠŋ īˆ īˆ—īŠ°ī‰˛ī‰ŽīŠģī‰īˆ īŠēī‰‚īŠ¯īˆ ī‹‘ī‰Šī‰ī‰Ĩīˆ īŠ•ī‰‡īˆ īŠŊī‰ļī‰īˆ ī‹†ī‰ƒīˆ ī‰‹īŠīˆ  27Âĩsīˆ ī‰‚ī‹ˆī‹„īŠŋīˆ īŠŊīŠˇīˆ ī‰Šī‹‹ī‰Ĩīˆ īˆžīŠģī‰īˆ ī‰ī‰‚ī‰ēī‰Šī‹„īŠģī‰īˆ ī‹…īŠŋīˆ ī‰Ĩī‰ĻīŠŠīˆ ī‰Ĩī‰ĻīŠ§īˆ īŠēī‰‚ī‹„ī‹‡īˆ īŠžī‹ŒīŠˇī‹Œī‰ī‹‹īˆ•īŠģī‰īˆ ī‰ī‰¨ī‹‡īˆ īŠŸ īˆ ī‰ī‰¨ī‹‡īˆ īˆŦī‰˜ī‰ĒīŠˆī‰īˆ īŠ•ī‰‡īˆ ī‹‰īŠŧīŠ´ī‹ƒīˆ ī‹ī‰‘īˆ ī‹…īŠŋī‹‹īˆ ī‰œī‹Žī‰šī‰ļīŠģī‰īˆ ī‰Ĩī‰Ĩīˆ–īŠģī‰īˆ ī‹Œī‹‡īˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠī‰īˆ ī‰Ĩī‰Ĩīˆ–īŠģī‰īˆ ī‹†ī‰ƒīˆ ī‹ī‹ˆīŠ°ī‹ŽīŠģīˆ īˆ¨demodulatorīˆŠīˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠī‰īˆ īŠŊī‰Ąī‰ī‰Ĩīˆ ī‹‘ī‰Ĩī‹Œī‰•ī‹ŒīŠī‰ īˆ 64īˆ ī‹īŠģī‰‚ī‰ŽīŠģī‰‚ī‰‰ī‹‹īˆ īˆŦīŠžī‰‚ī‰­ī‰Šī‹ĸī‰īˆ ī‰ī‰‚ī‰Žī‰‰īˆ ī‹…īŠŋīˆ ī‰ī‰‰īˆ īŠŊīŠˇīˆ ī‹…īŠŋīˆ ī‹ī‰ŽīŠŗīˆ īŠŊīŠ¸īŠģīˆ ī‹’ī‰ēī‰Šī‹ƒīˆ 32īˆ ī‹Œī‹‡īˆ ī‰¯ī‰ŠīŠŧī‹ŽīŠ¯īˆ ī‹’īŠˇī‰Ēī‰ąīˆ ī‰ī‹ī‰ŠīŠ´ī‰Žī‰ŽīŠīˆ ī‰ī‰‚ī‰ēī‰Šī‹„īŠģī‰īˆ ī‹…īŠŋīˆ ī‰Ĩī‰ĻīŠ¨īŠģī‰ īˆ 32īˆ īŠŊī‹ī‰ĻīŠ¨ī‰ŽīŠģī‰īˆ īŠšīŠ¯īˆ ī‹’īŠŧī‰™ī‰ĒīŠŋīˆ īŠŸīˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠī‰īˆ īŠ˛ī‰Ēī‰ŋīˆ īŠŸīˆ ī‰‚ī‹„ī‹ī‰ĻīŠģīˆ ī‹†ī‹ŒīŠ¸ī‹Žī‰­īˆ ī‹‰ī‹ƒī‰ˆīŠ¯īˆ  "0"īˆ īŠžī‰‚ī‰­ī‰Šī‰‡īˆ īŠŊī‰•ī‰ƒīˆ ī‹…īŠŋīˆ ī‹‰ī‹ƒī‰ˆīŠ¯īˆ ī‹‰ī‹ŽīŠŧīŠ§ī‹‹īˆ īˆŽī‰ī‰‰īˆ īŠŊīŠ¸īŠģīˆ ī‹’ī‰ēī‰Šī‹ƒ īˆ  īˆ īˆŽ32 x 27Âĩs of silenceīˆ ī‰‚ī‹ˆī‹ŽīŠŧī‹īˆ ī‹ī‰‘īˆ 27Âĩsīˆ ī‰‚ī‹ˆī‹„īŠŋīˆ īŠŊīŠˇīˆ ī‰Šī‹‹ī‰Ĩīˆ ī‹’īŠ¨ī‰‰ī‰ĒīŠŋīˆ ī‹’ī‰ēī‰Šī‹ƒ īˆ ī‹’īŠ¨ī‰‰ī‰ĒīŠŋīˆ ī‹’ī‰ēī‰Šī‹ƒīˆ  32īˆ ī‰‚ī‹ˆī‹ŽīŠŧī‹īˆ ī‹ī‰‘īˆ  32 x 27Âĩs of silenceīˆ īˆŦī‹ĩī‰‚īŠŋī‰‚īŠ—īˆ ī‹’ī‰ŽīŠˇī‰‚īŠ¨īŠī‰īˆ ī‹’īŠģī‰‚īŠ‡ī‰īˆ ī‰‚ī‹„ī‹ī‰ĻīŠģīˆ ī‹†ī‹ŒīŠ¸ī‹Žī‰­īˆ īˆ  "1"īˆ īŠžī‰‚ī‰­ī‰Šī‰‡īˆ īŠŊī‰•ī‰ƒīˆ ī‹…īŠŋīˆ ī‰‚ī‹€ī‹„ī‹Žī‰‰ īˆ  īˆ īˆŽ27Âĩsīˆ ī‰‚ī‹ˆī‹„īŠŋīˆ īŠŊīŠˇīˆ ī‰Šī‹‹ī‰Ĩ īˆ  īˆ  | +---| |---+ | | | | | | | | | | | | | |---+ | | +---| <-----> <-----> 1.7778ms 1.7778ms Logic 1 Logic 0 īˆ  īˆ  īˆ  īˆ  īˆ  īˆ RC5īˆ ī‰ŸīŠģīˆ īŠžī‰‚ī‰­ī‰Šī‹ĸī‰īˆ īŠžī‹ŒīŠˇī‹Œī‰ī‹‹ī‰Ēī‰‰īˆ īŠ”ī‰Šī‹īˆ īŠŊīŠ¸ī‰˛īŠģī‰ ī‹’ī‰ŽīŠ—ī‹žī‰ī‹‹īˆ ī‹īŠģī‹ ī‰īˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‹’ī‰­ī‰Ļī‹„ī‹‡īˆ ī‹ī‰ŽīŠŗ 82 ī‹’ī‹Žī‹ƒī‹‹īˆ–īŠ¸īŠģī‹ĸī‰ī‹‹īˆ ī‹’ī‹Žī‹–ī‰‚ī‰‰ī‰Ēī‹ˆīŠ¸īŠģī‰īˆ ī‹’ī‰­ī‰Ļī‹„īˆšī‰īˆ ī‹’ī‹ŽīŠŧīŠˇ
  • 13. Practical Class 4 Programming Microcontrollers īˆ  īˆ īˆēī‹īŠģī‰‚ī‰ŽīŠģī‰īˆ īŠŊīŠ¸ī‰˛īŠģī‰īˆ ī‹“īŠŧīŠ§īˆ ī‹ī‹–ī‰‚ī‹„ī‰‘īˆ 14Bitsīˆ ī‹…īŠŋīˆ RC5īˆ īŠžī‹ŒīŠˇī‹Œī‰ī‹‹ī‰Ēī‰‰īˆ ī‹†ī‹ŒīŠ¸ī‰Žī‹ īˆ  īˆ  Bit1 īˆ  īˆ  Bit2 Bit3 Bit4 Bit5 Bit6 Bit7 Bit8 Bit9 Bit10 Bit11 Bit12 Bit13 Bit14 īˆ  īˆ  start bits īˆ  īˆ  control īˆ  īˆ  Address īˆ  īˆ  Command īˆ īŠšīŠŧīŠ—īˆ ī‹ĩī‰‚ī‹€ī‹–ī‰ī‰Ĩīˆ ī‹ī‹‡ī‹‹īˆ īˆ¨Start Bits or AGC "Automatic Gain ControlīˆĸīˆŠīˆ īŠžī‰‚ī‰­ī‰Šī‹ĸī‰īˆ ī‹’ī‹ī‰ī‰Ļī‰‰īˆ ī‰ī‰‚ī‰Žī‰‰īˆ ī‹ī‹‡īˆ  īˆēBits1-2 - īˆŽī‹’īŠ¨ī‰ąī‹žī‰īˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠŋīˆ ī‰œī‰‰ī‰Ēī‰‰īˆ ī‹īŠģī‹ ī‰īˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‹‘ī‰Ēī‹ī‰‚īŠ¨īŠŋīˆ īŠŸīˆ ī‰ĻīŠ§ī‰‚ī‰Žī‰īˆ ī‹ī‹‡ī‹‹īˆ īˆŽ"1"īˆ ī‹’ī‹€ī‹ŽīŠ´īŠģī‰ īˆ ī‰ĒīŠ°ī‰ļīŠģī‰īˆ īŠ”ī‰‰īˆ ī‹‰ī‰Žī‹€ī‹ŽīŠŗīˆ īˆ—īŠŦī‰Žī‰īˆ ī‰ī‰ŠīŠģī‰īˆ ī‰ī‰¨ī‹‡īˆ īˆŦīˆ¨Control Bit or Toggle BitīˆŠīˆ  CHECK bitīˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‰ī‰‰īˆ ī‹Œī‹‡īˆ īˆēBit3 - īˆ ī‰ī‰§ī‰‡īˆ ī‹ī‹ˆīŠ°ī‹ŽīŠģīˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‰Ģī‰‚ī‹ˆī‰•īˆ ī‰Ļī‹ŽīŠ°ī‹īˆ ī‰ī‰¨ī‹‡īˆ īˆŽī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‰Šī‰ī‰Šī‰Ģī‰ƒīˆ ī‰Ļī‰™ī‰ƒīˆ īŠĄīŠŦī‰šīˆ ī‰‚ī‹ˆī‹ŽīŠ¯īˆ ī‹ī‰Žī‹īˆ ī‹‘ī‰ĒīŠŋīˆ īŠŊīŠˇīˆ īŠŸīˆ ī‹īŠ´ī‹ąī‹„īŠŋīˆ ī‰Ļī‰™ī‰ī‹ŒīŠģī‰ī‹‹ īˆ īˆŦīŠĄīŠŦī‰ēīŠģī‰‚ī‰‰īˆ ī‰Ēī‹€ī‰Žī‰Žī‰ī‹‹īˆ ī‰Ļī‰™ī‰ī‹‹īˆ ī‹īŠŗī‰ĒīŠģī‰īˆ īŠĄīŠŦī‰ēī‰īˆ īŠšī‹ƒī‰īˆ ī‰Šī‹Œī‰ļī‰īˆ â€“īˆ ī‰ĒīŠŋī‹žī‰īˆ ī‰Šī‰ĒīŠ¸ī‰Žī‹ī‹‹īˆ ī‰Šī‰ī‰Šī‰Ģī‹žī‰īˆ ī‰Ļī‰™ī‰ƒīˆ ī‹“īŠŧīŠ§īˆ īŠĄīŠŦī‰ēī‰īˆ ī‰īŠģī‰Ģī‰‚īŠŋ īˆ ī‹…ī‹ī‰Šī‰‚ī‹ąīŠŗīˆ īŠŊī‰­īˆ—ī‰­īˆ ī‹‰ī‹ƒī‹žīˆ ī‰Ļī‰™ī‰ī‹‹īˆ ī‹‘ī‰‚ī‹„īŠ´īŠģī‰īˆ ī‹…īŠŋīˆ ī‹ĩī‹œī‰Ļī‰‰īˆ 11īˆ ī‹‘ī‰‚ī‹„īŠ´īŠģī‰īˆ ī‰Šī‰‚ī‹Žī‰Žī‰Ąī‰īˆ ī‰Ļī‹ī‰Ēī‰īˆ īŠšī‹ƒī‰īˆ ī‹ī‹ˆīŠ°ī‹Žī‰­īˆ ī‰Ģī‰‚ī‹ˆīŠ†ī‰īˆ ī‹†ī‰ˆīŠ¯īˆ ī‰ī‰ŠīŠģī‰īˆ ī‰ī‰¨ī‹‡īˆ ī‹œī‹ŒīŠŧīŠ¯ īˆŽī‰‚ī‹ˆī‰ŽīŠ°ī‹ƒīˆ ī‹’ī‹€ī‹ŽīŠ´īŠģī‰īˆ ī‰‚ī‹€īˆšīˆ ī‰ī‰‚ī‰ēī‰Šī‹„īŠģī‰īˆ ī‹…īŠŋ īˆ ī‰‹ī‹Žī‰–ī‰Žī‰Žī‹īˆ ī‹†ī‰ƒīˆ ī‰‹īŠīˆ ī‹ī‰¨īŠģī‰īˆ ī‰Ģī‰‚ī‹ˆīŠ†ī‰īˆ īŠĒī‹Œī‹ƒīˆ ī‰Šī‰‚ī‹Žī‰Žī‰Ąī‰‚ī‰‰īˆ ī‹īŠģīˆ ī‰œī‹€ī‰Žī‰īˆ ī‹’ī‰Žī‹€īŠˆī‰īˆ ī‰ī‰‚ī‰Žī‰ŠīŠģī‰īˆ ī‹Šī‰¨ī‹‡īˆ īˆŦī‹†ī‰ī‹Œī‹„īŠ¨īŠģī‰īˆ ī‰ī‰‚ī‰Žī‰‰īˆ ī‹ī‹‡īˆ īˆēBits4-8 - īˆēī‹īŠģī‰‚ī‰ŽīŠģī‰īˆ īŠŊīŠ¸ī‰˛īŠģī‰īˆ ī‹“īŠŧīŠ§īˆ ī‹ī‹‡ī‹‹īˆ īˆ¨2^5=32īˆŠīˆ ī‰Ģī‰‚ī‹ˆī‰•īˆ 32īˆ ī‰ŸīŠģīˆ ī‹’ī‹ƒī‹Œī‹„īŠ§īˆ ī‹īŠģīˆ īŠĩīŠ´īŠ„īˆ ī‹ī‹‡ī‹‹īˆ īˆŦī‰ĒīŠŋī‰ī‹‹ī‹ŸīŠģ SYSTEM ADDRESS EQUIPMENT 0 TV SET 1 1 TV SET 2 2 VIDEOTEXT 3 EXPANSION FOR TV 1 AND 2 4 LASER VIDEO PLAYER 5 VIDEO RECORDER 1 (VCR 1) 6 VIDEO RECORDER 2 (VCR 2) 7 RESERVED 8 SAT 1 9 EXPANSION FOR VCR 1 OR 2 10 SAT 2 11 RESERVED 12 CD VIDEO 13 RESERVED 14 CD PHOTO 15 RESERVED 16 AUDIO PREAMPLIFIER 1 17 RECEIVER / TUNER 18 TAPE / CASSETE RECORDER 19 AUDIO PREAMPLIFIER 2 20 CD 21 AUDIO RACK 22 AUDIO SAT RECEIVER 23 DCC RECORDER 24 RESERVED 25 RESERVED 26 WRITABLE CD 26-31 RESERVED Faculty of Electrical and Electronic Eng. 83 Automatic Control & Automation Dept.
  • 14. ī‹‘ī‰ĒīŠŦī‰ļīŠī‰īˆ ī‰ī‰‚ī‹€īŠ¸ī‰šī‰ŽīŠī‰īˆ ī‹’īŠ‰ī‰Ēī‰‰ īˆ  īˆ  ī‹’īŠ¨ī‰‰ī‰ī‰ĒīŠģī‰īˆ ī‹’ī‰ŽīŠŧīŠ†ī‰ īˆ ī‹ĩī‰‚īŠ¨ī‰Šī‰īˆ īŠŊī‰­ī‰ĒīŠī‰īˆ ī‰ĒīŠŋī‹žī‰īˆ ī‹†ī‰ī‹Œī‹„īŠ§īˆ ī‹…īŠ§īˆ ī‹ī‹Œī‰ŽīŠ„īˆ ī‹’ī‰Žī‰ŽīŠģī‰īˆ ī‰ī‰‚ī‰Žī‰ŠīŠģī‰īˆ ī‹Šī‰¨ī‹‡īˆ īˆŦī‹’ī‹ŽīŠ°ī‹ŽīŠŖī‹ŒīŠģī‰īˆ ī‰ĒīŠŋī‰ī‹‹ī‹žī‰īˆ ī‰ī‰‚ī‰Žī‰‰īˆ ī‹ī‹‡īˆ  īˆēBits9-14 - īˆ ī‹ī‹‡ī‹‹īˆ  īˆ¨2^6=64īˆŠīˆ  ī‹īŠ°ī‹ŽīŠŖī‹‹īˆ ī‰ ī‰‚ī‰ŽīŠ°īŠŋīˆ  64īˆ ī‹‚ī‰ī‰Ļī‰ĸī‰Žī‰­ī‰īˆ ī‹īŠģīˆ īŠĩīŠ´īŠ„īˆ ī‹ī‹‡ī‹‹īˆ īˆŦī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‰Ģī‰‚ī‹ˆī‰•īˆ ī‹“īŠŧīŠ§īˆ ī‰Ĩī‹Œī‰•ī‹ŒīŠī‰īˆ ī‰Šī‰ŦīŠŧīŠģ īˆēī‹īŠģī‰‚ī‰ŽīŠģī‰īˆ īŠŊīŠ¸ī‰˛īŠģī‰īˆ ī‹“īŠŧīŠ§īˆ ī‹’ī‹Žī‰­ī‰‚ī‹ŽīŠ´īŠģī‰īˆ ī‹‘ī‰Ŧī‹ˆī‰•ī‹ŸīŠģīˆ ī‹’ī‰Šī‰Žī‹„īŠģī‰‚ī‰‰ COMMAND (in decimal) DESCRIPTION of FUNCTION 0-9 NUMERIC KEYS 0 - 9 12 STANDBY 13 MUTE 14 PRESETS 16 VOLUME UP 17 VOLUME DOWN 18 BRIGHTNESS + 19 BRIGHTNESS - 20 COLOR SATURATION + 21 COLOR SATURATION - 22 BASS UP 23 BASS DOWN 24 TREBLE + 25 TREBLE - 26 BALANCE RIGHT 27 BALANCE LEFT 48 PAUSE 50 FAST REVERSE 52 FAST FORWARD- 53 PLAY 54 STOP 55 RECORD 63 SYSTEM SELECT 71 DIM LOCAL DISPLAY 77 LINEAR FUNCTION (+) 78 LINEAR FUNCTION (-) 80 STEP UP 81 STEP DOWN 82 MENU ON 83 MENU OFF 84 DISPLAY A/V SYS STATUS 85 STEP LEFT 86 STEP RIGHT 87 ACKNOWLEDGE 88 PIP ON/OFF 89 PIP SHIFT 90 PIP MAIN SWAP 91 STROBE ON/OFF 92 MULTI STROBE 93 MAIN FROZEN 94 3/9 MULTI SCAN 95 PIP SELECT 96 MOSAIC MULTI PIP 97 PICTURE DNR 98 MAIN STORED 99 PIP STROBE 100 RECALL MAIN PICTURE 101 PIP FREEZE 102 PIP STEP UP 103 PIP STEP DOWN 118 SUB MODE 119 OPTIONS BUS MODE 123 CONNECT 124 DISCONNECT ī‹’ī‰ŽīŠ—ī‹žī‰ī‹‹īˆ ī‹īŠģī‹ ī‰īˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‹’ī‰­ī‰Ļī‹„ī‹‡īˆ ī‹ī‰ŽīŠŗ 84 ī‹’ī‹Žī‹ƒī‹‹īˆ–īŠ¸īŠģī‹ĸī‰ī‹‹īˆ ī‹’ī‹Žī‹–ī‰‚ī‰‰ī‰Ēī‹ˆīŠ¸īŠģī‰īˆ ī‹’ī‰­ī‰Ļī‹„īˆšī‰īˆ ī‹’ī‹ŽīŠŧīŠˇ
  • 15. Practical Class 4 Programming Microcontrollers Interfacing IR Receiver to uC. ī‰ĒīŠŦī‰ļīŠŋīˆ īˆ’ī‰‚īŠ¨īŠŋīˆ īŠ•ī‰‡īˆ IR īˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠŋīˆ īŠĄī‰‰ī‰Š īˆ  īˆ īˆŽuPīˆ ī‹‹ī‰ƒīˆ uCīˆ īŠŠīŠŋīˆ ī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ ī‰īŠ„īˆ ī‰īŠ¨ī‰ąī‰ƒīˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠŋīˆ īŠŊī‰ĩī‹‹īˆ ī‰Ļī‹„īŠ§īˆ ī‰‚ī‹ˆī‰ī‰‚īŠ§ī‰ī‰ĒīŠŋīˆ ī‰‹īŠīˆ īˆžīŠģī‰īˆ ī‰Šī‹ŒīŠŋī‹žī‰īˆ ī‰ŧīŠ¨ī‰‰īˆ ī‹‘ī‰ĒīŠ´īŠ°īŠģī‰īˆ ī‹Šī‰¨ī‹‡īˆ ī‰œī‰šī‹Œī‰ īˆŽ"0"=On | "1" = oīŦ€īˆ â€“īˆ ī‰ī‰‚ī‰ēī‰Šī‹„īŠŧīŠģīˆ ī‹īŠ´ī‹ąī‹„īŠī‰īˆ ī‹”ī‹Œī‰Žī‰ŽīŠī‰īˆ ī‰¯īŠ¸īŠ¨ī‹īˆ īŠ˛ī‹Œī‰­īˆ ī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ ī‰īŠ„īˆ ī‹’īŠ¨ī‰ąī‹žī‰īˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠŋīˆ ī‹†ī‰ƒīˆ ī‹‰ī‰Šī‰Žī‹ƒī‰ īˆ  īˆ­1 īˆŽ"1"īˆ ī‹”ī‹Œī‰Žī‰ŽīŠī‰īˆ ī‹“īŠŧīŠ§īˆ ī‹†ī‹ŒīŠ¸ī‹Žī‰­īˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠī‰īˆ ī‰˜ī‰Ēī‰Ąīˆ ī‹†ī‰ˆīŠ¯īˆ īˆ¨inactivityīˆŠīˆ īŠžī‰‚ī‰­ī‰Šī‹ĸī‰īˆ ī‹‚ī‰ĻīŠ§īˆ īŠžī‰‚ī‰™īˆ īŠŸ īˆ  īˆ­2 īˆ ī‹’īŠģī‰‚ī‰™īˆ ī‹’ī‰ŠīŠŗī‰ī‰ĒīŠŋī‹‹īˆ ī‹’ī‹Žī‰•ī‰Šī‰‚ī‰Ąīˆ ī‹’īŠ¨ī‰ŋī‰‚īŠ´īŠŋīˆ ī‰‹ī‹ąīŠŗīˆ īŠ•ī‰‡īˆ ī‹‹ī‰ƒīˆ ī‹‹ī‰ĒīŠ¸ī‹ī‰‚īŠī‰īˆ ī‰Œī‰‚ī‹ąīŠŗī‰ƒīˆ ī‹…īŠŋīˆ ī‰‹ī‹ąīŠŗīˆ ī‹ī‰ƒīˆ īŠ•ī‰‡īˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠī‰īˆ ī‰˜ī‰Ēī‰Ąīˆ īŠĄī‰‰ī‰Šīˆ ī‹…īŠ¸īŠ™ īˆ  īˆ­3 īˆ īŠžī‰‚ī‰ŠīŠ´ī‰Žī‰­ī‰‚ī‰‰īˆ  ī‰ƒī‰Ļī‰Šī‰īˆ  ī‰‚ī‹ˆī‹„ī‹Žī‰™īˆ  īˆŦīŠžī‰‚ī‰­ī‰Šī‰‡īˆ  ī‹’īŠģī‰‚ī‰™īˆ  ī‰Ĩī‹Œī‰•ī‹‹īˆ  ī‹“īŠŧīŠ§īˆ  ī‹ĩī‹’īŠģī‹œī‰Ĩīˆ  ī‰ŧīŠ°ī‰ĸī‹„īŠī‰īˆ  ī‹”ī‹Œī‰Žī‰ŽīŠī‰īˆ  īŠ•ī‰‡īˆ  ī‹‰ī‰ŽīŠģī‰‚ī‰™īˆ  īˆ—īŠŦī‰Žī‰īˆ  ī‹“ī‰Žī‰™īˆ  ī‰‹ī‹ąīŠ´īŠģī‰ īˆŽī‰ī‰‰īˆ 14īˆ ī‹…īŠŋīˆ ī‹’īŠ°īŠģī‹›īŠī‰īˆ ī‹‘ī‰ĒīŠ°ī‹Žī‰˛īŠģī‰ īˆ ī‹œīˆ īŠšīŠģī‰¨īŠģīˆ īŠšīŠģī‰§īˆ ī‰ĻīŠ¨ī‰‰īˆ ī‹’ī‹€ī‹ˆīŠŋīˆ īˆ—īŠĢīˆ ī‰‚ī‹ˆī‹„īŠ¸īŠģī‹‹īˆ īˆŦīŠžī‰‚ī‰­ī‰Šī‹ĸī‰īˆ ī‹’ī‹ŽīŠŧī‹€īŠ§īˆ ī‹•ī‰Ļī‰Šī‰‰īˆ īŠšīŠŋī‹īŠ§ī‹ĸīˆ īŠĄīŠ´īŠ¯īˆ ī‹’ī‹€ī‹ˆīŠŋīˆ īŠ•ī‹‹ī‹žī‰īˆ ī‹’ī‰‘ī‹ī‰’īŠģī‰īˆ ī‰ī‰‚ī‰Žī‰ŠīŠģī‰īˆ ī‹†ī‰‡ īˆ  īˆ­4 īˆ ī‰Ģī‰‚ī‹ˆīŠ†ī‰īˆ ī‹†ī‰ī‹Œī‹„īŠ§īˆ ī‹“īŠŧīŠ§īˆ ī‹ī‹ŒīŠ„īˆ īˆžīŠģī‰īˆ ī‹’ī‹ŽīŠģī‰‚ī‰ŽīŠģī‰īˆ ī‰Ēī‰˛īŠ§īˆ ī‰Ļī‰™ī‹žī‰īˆ ī‰ī‰‚ī‰Žī‰ŠīŠģī‰īˆ īŠŊī‰ŠīŠ´ī‰Žī‰­ī‰īˆ īŠĄīŠ´īŠ¯īˆ īˆŦī‰‚ī‹ˆīŠŧī‹ŽīŠŧīŠ„ī‹‹īˆ ī‰‚ī‹ˆīŠ¸īŠ°ī‰‰īˆ ī‹‚ī‹ŒīŠ´ī‰ī‹‹īˆ ī‰‚ī‹ˆīŠŧī‰ŠīŠ´ī‰Žī‰Žī‰ īˆ īŠšī‹„īŠ¸īŠ™īˆ ī‰‚ī‹‡ī‰ĻīŠ¨ī‰‰īˆ 4.752mSīˆ ī‹Šī‰Šī‰ĻīŠŗīˆ ī‹…īŠŋī‰Ģīˆ ī‰Šī‰‚īŠ¤ī‰Žī‹ƒī‰‚ī‰‰īˆ īŠšīŠģī‰§īˆ ī‹†ī‹ŒīŠ¸ī‹ī‹‹īˆ īˆŦī‰Ģī‰‚ī‹ˆīŠ†ī‰īˆ ī‹“īŠŧīŠ§īˆ īŠĸī‹ŒīŠŦī‰ēīŠī‰īˆ ī‰Šī‰ŦīŠŧīŠģīˆ ī‹ĩī‰‚īŠ¨ī‰Šī‰īˆ ī‰Œī‹ŒīŠŧī‹ąīŠī‰īˆ ī‰ĒīŠŋī‹žī‰ī‹‹ īˆ īˆŽ1.728mSīˆ ī‹ī‹‡īˆ ī‰Ēī‰Ąī‰…ī‹‹īˆ ī‰ī‰‰īˆ īŠŊīŠˇīˆ īŠ”ī‰‰īˆ ī‹’ī‹Žī‹„īŠŋī‰ŦīŠģī‰īˆ īŠŊī‰ĩī‰ī‹ŒīŠ°īŠģī‰īˆ ī‹†ī‰ƒīˆ ī‹‘ī‰‚īŠ§ī‰ī‰ĒīŠŋīˆ īŠŠīŠŋīˆ ī‰Ēī‰˛īŠ§īˆ ī‰Ļī‰™ī‹žī‰īˆ ī‰ī‰‚ī‰Žī‰ŠīŠŧīŠģīˆ ī‹‘ī‹•ī‰ī‰ĒīŠ´īŠģī‰īˆ ī‹’ī‹ŽīŠŧī‹€īŠ§īˆ ī‰ƒī‰Ļī‰Šī‰īˆ ī‹†ī‰ƒ īˆŽī‰Ļī‹„ī‰ŠīŠģī‰īˆ ī‰ī‰¨ī‹‡īˆ ī‰œī‰šī‹Œī‹īˆ ī‹īŠģī‰‚ī‰ŽīŠģī‰īˆ īŠŊīŠ¸ī‰˛īŠģī‰ īˆ  īˆ  CLRM-2038S IR Module CLRM-2038Sīˆ ī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ ī‰īŠ„īˆ ī‹’īŠ¨ī‰ąī‹žī‰īˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠŋ īˆ  īˆ īˆēī‹’ī‹ŽīŠģī‰‚ī‰ŽīŠģī‰īˆ ī‹’ī‹Žī‰­ī‰‚ī‰­ī‹žī‰īˆ ī‰ī‰‚īŠ°ī‰ĩī‰ī‹ŒīŠī‰īˆ ī‹‰īŠģī‹‹īˆ CLRM-2038Sīˆ ī‰˜ī‰§ī‹Œī‹€ī‹„īŠģī‰īˆ ī‹…īŠŋīˆ ī‹Œī‹‡īˆ ī‰‚ī‹„īŠ§ī‹‹ī‰Ēī‰˛īŠŋīˆ īŠŸīˆ ī‹‚ī‰Ļī‰ĸī‰Žī‰ŽīŠī‰īˆ ī‹’īŠ¨ī‰ąī‹žī‰īˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠŋīˆ ī‹†ī‰‡ īˆŽī‰īŠŗī‹ŒīŠģī‰īˆ ī‰¯īŠ°ī‹ƒīˆ īŠŸīˆ ī‹‘ī‰Šī‰‚ī‰ąī‰‡īˆ ī‹ī‰ĸī‰ēīŠŋī‹‹īˆ ī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ ī‰īŠ„īˆ ī‹’īŠ¨ī‰ąī‰ƒīˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠŋ īˆ  īˆ­1 īˆŽPCMīˆ ī‰ī‰ī‰Ĩī‰Ĩī‰Ēī‰īˆ īŠŊī‰•ī‰ƒīˆ ī‹…īŠŋīˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠī‰īˆ īŠ˛ī‹īŠĢīˆ īŠŊī‰Ąī‰ī‰Ĩīˆ ī‰Ēī‹ī‰ĒīŠ—īˆ ī‰œī‰ąī‰ĒīŠŋ īˆ  īˆ­2 īˆŽī‹’ī‹ąī‹Žīˆī‰īˆ ī‹•ī‰ī‹Œī‰šī‹žī‰‚ī‰‰īˆ ī‰Ēī‰‘ī‰„ī‰ŽīŠģī‰īˆ ī‰Ļī‰šīˆ ī‹’ī‹ŽīŠģī‰‚īŠ§īˆ ī‹’īŠ§ī‰‚ī‹„īŠŋ īˆ  īˆ­3 īˆŽī‹ī‹–ī‰‚ī‰‰ī‰Ēī‹ˆīŠ¸īŠģī‰īˆ īŠŊīŠ´īŠ‡ī‰īˆ ī‰ī‰‚ī‰‰ī‰ī‰Ēī‹ąī‰šī‰īˆ ī‰Ļī‰šīˆ ī‹’īŠ§ī‰‚ī‹„ī‹€īŠŧīŠģīˆ ī‰Šī‹Œī‹ąīŠŋīˆ īŠĒī‰Šī‰Ĩ īˆ  īˆ­4 īˆŽ2.7V~5.5Vīˆ īŠŊī‹€īŠ¨īŠģī‰īˆ īŠžī‰‚īŠ‰īˆ ī‹…ī‹€ī‰šīˆ ī‰ŧīŠ°ī‰ĸī‹„īŠŋīˆ ī‹’īŠŗī‰‚ī‰ŋīˆ īŠēī‹ī‹ˆī‰Žī‰­ī‰ īˆ  īˆ­5 īˆŽTTL, CMOSīˆ ī‹īŠ´ī‹ąī‹„īŠī‰īˆ ī‹”ī‹Œī‰Žī‰ŽīŠī‰īˆ ī‰ī‰‚ī‰ŠīŠŧī‹ąī‰ŽīŠŋīˆ īŠŠīŠŋīˆ īŠĩīŠ¯ī‰ī‹Œī‰ŽīŠŋ īˆ  īˆ­6 īˆŽNEC code,RC5 codeīˆ īˆ—ī‹ī‰‚īŠ¨īŠŋīˆ īŠŠīŠŋīˆ īŠĩīŠ¯ī‰ī‹Œī‰ŽīŠŋ īˆ  īˆ­7 īˆŽ38KHZīˆ īŠŊīŠŋī‰‚īŠ‡ī‰īˆ ī‰Ĩī‰Ĩī‰Ēī‰ īˆ  īˆ­8 Faculty of Electrical and Electronic Eng. 85 Automatic Control & Automation Dept.
  • 16. ī‹‘ī‰ĒīŠŦī‰ļīŠī‰īˆ ī‰ī‰‚ī‹€īŠ¸ī‰šī‰ŽīŠī‰īˆ ī‹’īŠ‰ī‰Ēī‰‰ īˆ  īˆ  ī‹’īŠ¨ī‰‰ī‰ī‰ĒīŠģī‰īˆ ī‹’ī‰ŽīŠŧīŠ†ī‰ īˆŽ12mīˆ ī‹“ī‰Žī‰™īˆ īŠžī‰‚ī‰ŠīŠ´ī‰Žī‰­ī‹œī‰īˆ ī‹’īŠ¯ī‰‚ī‰ŽīŠŋ īˆ  īˆ­9 īˆēī‹’ī‹ŽīŠģī‰‚ī‰ŽīŠģī‰īˆ ī‰ī‰‚īŠ´ī‹Žī‰Šī‹ąī‰ŽīŠģī‰īˆ īŠŊī‰•ī‰ƒīˆ ī‹…īŠŋīˆ ī‹‰īŠŋī‰ī‰Ļī‰ĸī‰Žī‰­ī‰īˆ ī‹…īŠ¸īŠ™ īˆ  īˆ­10 īˆŽīˆ¨Optical switchīˆŠīˆ ī‹ī‹–ī‹Œī‰šīˆ ī‰ ī‰‚ī‰ŽīŠ°īŠŋ ¡ īˆŽAudio, TV, VCR, CD, MD, DVD, etcīˆ īˆēīŠŊī‰’īŠŋīˆ ī‹‘ī‰Ŧī‹ˆī‰•ī‹žī‰‚ī‰‰īˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‰ī‰‚īŠ´ī‹Žī‰Šī‹ąī‰ ¡ Air-conditioner, Fan, CATV, etcīˆ īˆēīŠŊī‰’īŠŋīˆ ī‹’ī‹ŽīŠģī‰Ŧī‹„īŠī‰īˆ ī‹‘ī‰Ŧī‹ˆī‰•ī‹žī‰‚ī‰‰īˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰ ¡ Pins Confg. & Int ernal D agram i i īˆ  īˆ  CLRM-2038Sīˆ ī‰ŸīŠģīˆ ī‹’ī‹ŽīŠŧī‰Ąī‰ī‰ĻīŠģī‰īˆ ī‹’ī‹Žī‹„ī‰ŠīŠģī‰ī‹‹īˆ ī‰Œī‰‚ī‹ąīŠŗī‹žī‰īˆ īŠĒī‰Ģī‹Œī‰ īˆŽCLRM-2038Sīˆ īŠŊī‰ŠīŠ´ī‰Žī‰Žī‹€īŠŧīŠģīˆ ī‹’ī‹ŽīŠŧī‰Ąī‰ī‰ĻīŠģī‰īˆ ī‹’ī‹Žī‹„ī‰ŠīŠģī‰īˆ ī‰œī‰šī‹Œī‹īˆ ī‹īŠģī‰‚ī‰ŽīŠģī‰īˆ īŠŊīŠ¸ī‰˛īŠģī‰ īˆ  īˆ  īˆ  īˆ  īˆ  īˆ īˆŽCLRM-2038Sīˆ īŠŊī‰ŠīŠ´ī‰Žī‰Žī‹€īŠŧīŠģīˆ ī‰Œī‰‚ī‹ąīŠŗī‹žī‰īˆ īŠĒī‰Ģī‹Œī‰ī‹‹īˆ ī‹īŠ´ī‹ŽīŠ´īŠ‡ī‰īˆ īŠŊīŠ¸ī‰˛īŠģī‰īˆ ī‰œī‰šī‹Œī‰īˆ ī‹’ī‹ŽīŠģī‰‚ī‰ŽīŠģī‰īˆ īŠžī‰‚īŠ¸ī‰ąī‹žī‰ īˆ  īˆ  īˆ  īˆ  īˆ  īˆ  īˆ  ī‹’ī‰ŽīŠ—ī‹žī‰ī‹‹īˆ ī‹īŠģī‹ ī‰īˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‹’ī‰­ī‰Ļī‹„ī‹‡īˆ ī‹ī‰ŽīŠŗ 86 ī‹’ī‹Žī‹ƒī‹‹īˆ–īŠ¸īŠģī‹ĸī‰ī‹‹īˆ ī‹’ī‹Žī‹–ī‰‚ī‰‰ī‰Ēī‹ˆīŠ¸īŠģī‰īˆ ī‹’ī‰­ī‰Ļī‹„īˆšī‰īˆ ī‹’ī‹ŽīŠŧīŠˇ
  • 17. Practical Class 4 Programming Microcontrollers Rc5 receiver interface īˆ ī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ ī‰īŠ„īˆ ī‹’īŠ¨ī‰ąī‹žī‰īˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠīˆ ī‹’ī‹€ī‹–ī‹īŠī‰īˆ ī‹‘ī‰Šī‰ī‰Ĩ īˆ ī‹’ī‹ī‰¨īŠŦī‰ŽīŠģī‰īˆ ī‰Œī‰‚ī‹ąīŠŗī‰ƒīˆ īŠŠīŠŋīˆ ī‹ī‰Ģī‰ī‹Œī‰ŽīŠģī‰īˆ ī‹“īŠŧīŠ§īˆ 4.7uFīˆ īŠąī‰’īŠ¸īŠŋīˆ īŠŠī‰šī‹‹īˆ ī‰‹īŠīˆ ī‹‰ī‹ƒī‰ˆīŠ¯īˆ īˆŦīˆ’ī‰‚īŠ¨īŠŋīˆ īŠŠīŠŋīˆ ī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ ī‰īŠ„īˆ ī‹’īŠ¨ī‰ąī‰ƒīˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠŋīˆ īŠĄī‰‰ī‰Šīˆ ī‰Ļī‹„īŠ§ īˆ ī‰ī‰¨īˆšīˆ ī‹’ī‹€ī‹–ī‹īŠī‰īˆ ī‹‘ī‰Šī‰ī‰Ĩīˆ ī‰œī‰šī‹Œī‹īˆ ī‹īŠģī‰‚ī‰ŽīŠģī‰īˆ īŠŊīŠ¸ī‰˛īŠģī‰īˆ īˆŽī‰‹īŠģī‰‚īŠŦīŠģī‰īˆ īŠŸīˆ īŠŊī‹€īŠ¨ī‹īˆ ī‹…īŠģīˆ ī‹œī‰‡ī‹‹īˆ īˆŦī‰Œī‰‚ī‹ąīŠŗī‹žī‰īˆ īŠšīŠŧī‰īˆ īŠ•ī‰‡īˆ ī‹…īŠ¸īŠ™īˆ ī‰‚īŠŋīˆ ī‰Œī‰ĒīŠŗī‰ƒī‹‹īˆ īŠŊī‰ŠīŠ´ī‰Žī‰Žī‹€īŠŧīŠģ īˆ  īˆ īˆŽīŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠī‰ īˆ  īˆ  īˆ  īˆ  īˆ  īˆ  IRSAT Remote Control īˆ  īˆ  IRSATīˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‰Ģī‰‚ī‹ˆī‰• īˆēī‰Ģī‰‚ī‹ˆīŠ†ī‰īˆ ī‰ī‰‚īŠ°ī‰ĩī‰ī‹ŒīŠŋ īˆ  īˆ IRSAT RC5 TV Remote Control with 33 Keysīˆ īˆēī‰˜ī‰§ī‹Œī‹€ī‹„īŠģī‰ ¡ īˆ  īˆ  China (mainland) īˆēī‰„ī‰˛ī‹„īŠī‰īˆ ī‰ĻīŠŧī‰‰ ¡ AA x 2īˆ īˆēī‰ī‰‚ī‹ī‰Šī‰‚ī‹ąī‰ŠīŠģī‰īˆ īŠĒī‹Œī‹ƒ ¡ 10 metersīˆ īˆēīŠžī‰‚ī‰­ī‰Šī‹ĸī‰īˆ īŠžī‰‚īŠ‰ ¡ īˆŽ3Îŧ Aīˆ īˆēStandby current ¡ 17x4.7x2.5cmīˆ īˆēī‰Ĩī‰‚īŠ¨ī‰‰ī‹žī‰ ¡ īˆ  īˆ  IRSAT Remote Control Key Commands īˆ  īˆ  IRSATīˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‰Ģī‰‚ī‹ˆīŠ†īˆ ī‰œī‹Žī‰ī‰‚īŠ°īŠī‰īˆ ī‹…ī‹ī‹‹ī‰‚ī‹„īŠ§ īˆ ī‹’ī‹Žī‹ƒī‹‹īˆ–īŠ¸īŠģī‹ĸī‰īˆ ī‹’ī‰­ī‰Ļī‹„ī‹ˆīŠŧīŠģīˆ īŠŊī‹–ī‰ī‹‹ī‹žī‰īˆ ī‹’īŠˇī‰Ēī‰˛īŠģīˆ ī‹ĩī‰‚ī‰ļī‹Žī‰ļī‰Ąīˆ īŠŠī‹„ī‰ļīŠŋīˆ ī‹‰ī‹ƒī‰ˆīŠ¯īˆ  ī‹Šī‰‚ī‹ƒī‰Ĩī‰ƒīˆ īŠŊīŠ¸ī‰˛īŠģī‰īˆ ī‹“īŠŧīŠ§īˆ ī‰œī‰šī‹ŒīŠī‰īˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‰Ģī‰‚ī‹ˆīŠ†īˆ ī‹’ī‰Šī‰Žī‹„īŠģī‰‚ī‰‰ īˆēī‹īŠŧī‹īˆ ī‰‚ī‹€ī‹ŽīŠ¯īˆ ī‰˜ī‰Šī‰ĻīŠī‰īˆ īŠžī‹‹ī‰ĻīŠ†ī‰īˆ īŠŸīˆ ī‹’ī‰šī‰šī‹ŒīŠŋī‹‹īˆ ī‹’ī‰ĩī‰‚ī‰Ąīˆ ī‹’ī‹ŽīŠ°ī‹ŽīŠŖī‹‹īˆ īŠŊī‹–ī‹œī‰Ĩīˆ īŠĩīŠ¯ī‹‹ Faculty of Electrical and Electronic Eng. 87 Automatic Control & Automation Dept.
  • 18. ī‹‘ī‰ĒīŠŦī‰ļīŠī‰īˆ ī‰ī‰‚ī‹€īŠ¸ī‰šī‰ŽīŠī‰īˆ ī‹’īŠ‰ī‰Ēī‰‰ īˆ  īˆ  ī‹’īŠ¨ī‰‰ī‰ī‰ĒīŠģī‰īˆ ī‹’ī‰ŽīŠŧīŠ†ī‰ COMMAND (in Hex) DESCRIPTION of FUNCTION 0-9 NUMERIC KEYS 0 - 9 12 13 14 16 VOLUME UP 17 VOLUME DOWN 18 19 20 21 22 BASS UP 23 BASS DOWN 24 25 26 27 48 50 52 F1 53 F2 54 F3 55 F4 63 71 RC5 Sender īˆ  īˆ  īˆ RC5īˆ īŠžī‹ŒīŠˇī‹Œī‰ī‹‹ī‰Ēī‰‰īˆ īŠžī‰‚ī‰­ī‰Šī‰‡īˆ ī‹‘ī‰Šī‰ī‰Ĩ īˆ  īˆ īˆēī‹īŠģī‰‚ī‰ŽīŠģī‰īˆ īŠŊīŠ¸ī‰˛īŠģī‰īˆ ī‹‘ī‰‚īŠ§ī‰ī‰ĒīŠŋīˆ īŠŠīŠŋīˆ OC1(A)īˆ ī‰‹ī‹ąīŠ´īŠģī‰īˆ īŠ•ī‰‡īˆ ī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ ī‰īŠ„īˆ ī‹’īŠ¨ī‰ąī‰ƒīˆ īŠŊī‰­ī‰ĒīŠŋīˆ īŠŊī‹Žī‰ĩī‹Œī‰Žī‰‰īˆ ī‹īŠŗīˆ īˆ īˆēī‹‘ī‰Šī‰ī‰ĻīŠŧīŠģīˆ ī‹ī‰ĒīŠ¤ī‹„īŠģī‰īˆ īŠĄī‹ąī‰ĸīŠī‰ īˆ  īˆ  ī‹’ī‰ŽīŠ—ī‹žī‰ī‹‹īˆ ī‹īŠģī‹ ī‰īˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‹’ī‰­ī‰Ļī‹„ī‹‡īˆ ī‹ī‰ŽīŠŗ 88 ī‹’ī‹Žī‹ƒī‹‹īˆ–īŠ¸īŠģī‹ĸī‰ī‹‹īˆ ī‹’ī‹Žī‹–ī‰‚ī‰‰ī‰Ēī‹ˆīŠ¸īŠģī‰īˆ ī‹’ī‰­ī‰Ļī‹„īˆšī‰īˆ ī‹’ī‹ŽīŠŧīŠˇ
  • 19. Practical Class 4 Programming Microcontrollers īˆ  īˆ īˆēBascom-AVRīˆ ī‹’ī‹—ī‹Žī‰‰īˆ ī‹‚ī‰ī‰Ļī‰ĸī‰Žī‰­ī‰‚ī‰‰īˆ ī‰—īŠŋī‰‚ī‹ƒīˆ•īŠģī‰ īˆ īŠžī‹ŒīŠˇī‹Œī‰ī‹‹ī‰Ēī‰‰īˆ  ī‹“īŠŧīŠ§īˆ  ī‹ī‹ŒīŠ„īˆ  īˆžīŠģī‰ī‹‹īˆ  ī‹’ī‹ŽīŠ‰īˆ•īŠģī‰īˆ  ī‹’ī‹—ī‹Žī‰ŠīŠģī‰īˆ  īŠŸīˆ  ī‹‘ī‰Ĩī‹Œī‰•ī‹ŒīŠī‰īˆ  RC5īˆ  ī‹’ī‰Šī‰ŽīŠ¸īŠŋīˆ  ī‹•ī‰‚īŠ§ī‰Ļī‰Žī‰­ī‰‚ī‰‰īˆ  ī‹īŠģī‰‚ī‰ŽīŠģī‰īˆ  ī‰—īŠŋī‰‚ī‹ƒīˆ•īŠģī‰īˆ  ī‹‚ī‹ŒīŠ´ī‹īˆ  īŠ˛ī‹Œī‰­ īˆ  īˆ īˆŽīŠžī‰‚ī‰­ī‰Šī‹ĸī‰ īˆ ī‹…īŠŋī‰Ģīˆ  ī‰Œī‰‚ī‰ŽīŠ‡īˆ  Timer1īˆ  ī‰īŠŗī‹›īŠī‰īˆ  īŠŊī‹ŽīŠŦī‰˛ī‰Žī‰‰īˆ  ī‹‚ī‹ŒīŠ´ī‰īˆ  īˆžīŠģī‰ī‹‹īˆ  RC5SENDīˆ  ī‹’ī‹€ī‹ŽīŠŧīŠ¨ī‰ŽīŠģī‰īˆ  ī‹‚ī‰ī‰Ļī‰ĸī‰Žī‰­ī‰‚ī‰‰īˆ  īŠžī‹ŒīŠˇī‹Œī‰ī‹‹īˆ•īŠģī‰īˆ  īŠžī‰‚ī‰­ī‰Šī‰‡īˆ  ī‹ī‰Žī‹ īˆ  īˆ īˆŽī‹īŠģī‰…īˆ īŠŊīŠ¸ī‰˛ī‰‰īˆ ī‰ī‰‚ī‰ēī‰Šī‹„īŠģī‰ $regfile = "m8def.dat" ' specify the used micro $crystal = 4000000 ' used crystal frequency Dim Togbit As Byte , Command As Byte , Address As Byte Command = 12 ' power on off Togbit = 0 ' make it 0 or 32 to set the toggle bit Address = 0 Do Waitms 200 Rc5send Togbit , Address , Command Loop End RC5 Receiver īˆ  īˆ  RC5īˆ īŠžī‹ŒīŠˇī‹Œī‰ī‹‹ī‰Ēī‰‰īˆ īŠžī‰‚ī‰ŠīŠ´ī‰Žī‰­ī‰īˆ ī‹‘ī‰Šī‰ī‰Ĩ īˆ  īˆ īˆ īˆēī‹‘ī‰Šī‰ī‰ĻīŠŧīŠģīˆ ī‹ī‰ĒīŠ¤ī‹„īŠģī‰īˆ īŠĄī‹ąī‰ĸīŠī‰ īˆ  īˆ īˆēī‹īŠģī‰‚ī‰ŽīŠģī‰īˆ īŠŊīŠ¸ī‰˛īŠģī‰īˆ ī‹‘ī‰‚īŠ§ī‰ī‰ĒīŠŋīˆ īŠŠīŠŋīˆ ī‹‹ī‰ĒīŠ¸ī‹ī‰‚īŠī‰īˆ ī‰Œī‰‚ī‹ąīŠŗī‰ƒīˆ ī‰Ļī‰™ī‰ƒīˆ īŠ•ī‰‡īˆ ī‹•ī‰ī‰Ēī‹€īŠ‡ī‰īˆ ī‰īŠ„īˆ ī‹’īŠ¨ī‰ąī‹žī‰īˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠŋīˆ ī‰˜ī‰Ēī‰Ąīˆ īŠŊī‹Žī‰ĩī‹Œī‰Žī‰‰īˆ ī‹īŠŗ īˆ  īˆ  īˆ  īˆ  īˆ  īˆ īˆŽBascom-AVRīˆ ī‹’ī‹—ī‹Žī‰‰īˆ ī‹‚ī‰ī‰Ļī‰ĸī‰Žī‰­ī‰‚ī‰‰īˆ ī‰—īŠŋī‰‚ī‹ƒīˆ•īŠģī‰ īˆ īŠžī‹ŒīŠˇī‹Œī‰ī‹‹ī‰Ēī‰‰īˆ  ī‹“īŠŧīŠ§īˆ  ī‹ī‹ŒīŠ„īˆ  īˆžīŠģī‰ī‹‹īˆ  ī‹’ī‹ŽīŠ‰īˆ•īŠģī‰īˆ  ī‹’ī‹—ī‹Žī‰ŠīŠģī‰īˆ  īŠŸīˆ  ī‹‘ī‰Ĩī‹Œī‰•ī‹ŒīŠī‰īˆ  RC5īˆ  ī‹’ī‰Šī‰ŽīŠ¸īŠŋīˆ  ī‹•ī‰‚īŠ§ī‰Ļī‰Žī‰­ī‰‚ī‰‰īˆ  ī‹īŠģī‰‚ī‰ŽīŠģī‰īˆ  ī‰—īŠŋī‰‚ī‹ƒīˆ•īŠģī‰īˆ  ī‹‚ī‹ŒīŠ´ī‹īˆ  īŠ˛ī‹Œī‰­ īˆ  īˆ īˆŽīŠžī‰‚ī‰ŠīŠ´ī‰Žī‰­ī‹œī‰ īˆ īŠŊīŠ¸ī‰˛ī‰‰īˆ ī‰ī‰‚ī‰ēī‰Šī‹„īŠģī‰īˆ ī‰ĻīŠ¨īŠģīˆ  Timer0īˆ ī‰īŠŗī‹›īŠī‰īˆ īŠŊī‹ŽīŠŦī‰˛ī‰Žī‰‰īˆ ī‹‚ī‹ŒīŠ´ī‰īˆ īˆžīŠģī‰ī‹‹īˆ  getrc5īˆ ī‹’ī‹€ī‹ŽīŠŧīŠ¨ī‰ŽīŠģī‰īˆ ī‹‚ī‰ī‰Ļī‰ĸī‰Žī‰­ī‰‚ī‰‰īˆ īŠŊī‰ŠīŠ´ī‰Žī‰ŽīŠī‰īˆ ī‹’īŠģī‰‚ī‰™īˆ ī‰ˇī‰šīŠ¯īˆ ī‹ī‰Žī‹ īˆ  īˆ īˆŽī‹īŠģī‰… īˆ  īˆ  Faculty of Electrical and Electronic Eng. 89 Automatic Control & Automation Dept.
  • 20. ī‹‘ī‰ĒīŠŦī‰ļīŠī‰īˆ ī‰ī‰‚ī‹€īŠ¸ī‰šī‰ŽīŠī‰īˆ ī‹’īŠ‰ī‰Ēī‰‰ īˆ  īˆ  ī‹’īŠ¨ī‰‰ī‰ī‰ĒīŠģī‰īˆ ī‹’ī‰ŽīŠŧīŠ†ī‰ $regfile = "m8def.dat" ' specify the used micro $crystal = 4000000 ' used crystal frequency $baud = 19200 ' use baud rate $lib "mcsbyte.lbx" Config Rc5 = Pind.2 ' pin we want to use for the receiver input Enable Interrupts ' enable the interrupts Dim Address As Byte , Command As Byte 'reserve space for variables Print "Waiting for RC5..." Do Getrc5(address , Command) ' check if a key on the remote is pressed If Address = 0 Then 'we check for the TV address and that is Command = Command And &B01111111 'clear the toggle bit (bit7) Print Address ; " " ; Command End If Loop End Red: AGC pulses (ON) Blue: Check bit (flipping) White: Address (00) Green: Command ī‹’ī‰ŽīŠ—ī‹žī‰ī‹‹īˆ ī‹īŠģī‹ ī‰īˆ ī‹īŠ¸ī‰šī‰ŽīŠģī‰īˆ ī‹’ī‰­ī‰Ļī‹„ī‹‡īˆ ī‹ī‰ŽīŠŗ 90 ī‹’ī‹Žī‹ƒī‹‹īˆ–īŠ¸īŠģī‹ĸī‰ī‹‹īˆ ī‹’ī‹Žī‹–ī‰‚ī‰‰ī‰Ēī‹ˆīŠ¸īŠģī‰īˆ ī‹’ī‰­ī‰Ļī‹„īˆšī‰īˆ ī‹’ī‹ŽīŠŧīŠˇ