Skip to content
Snippets Groups Projects
week_08.html 24.63 KiB
<!DOCTYPE html>
<html lang="en">
  <head>
    <!-- Basic Page Needs
    ================================================== -->
    <meta charset="utf-8">
    <!--[if IE]><meta http-equiv="x-ua-compatible" content="IE=9" /><![endif]-->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>week_08 Embeded Programming</title>
    <meta name="description" content="Your Description Here">
		<meta name="keywords" content="FabLab Taipei,FabLab,Zihao Lin,FabLab SCU">
    <meta name="author" content="Lin Zihao">

    <!-- Favicons
    ================================================== -->
    <link rel="shortcut icon" href="img/favicon.ico" type="image/x-icon">
    <link rel="apple-touch-icon" href="img/apple-touch-icon.png">
    <link rel="apple-touch-icon" sizes="72x72" href="img/apple-touch-icon-72x72.png">
    <link rel="apple-touch-icon" sizes="114x114" href="img/apple-touch-icon-114x114.png">

    <!-- Bootstrap -->
    <link rel="stylesheet" type="text/css"  href="css/bootstrap.css">
    <link rel="stylesheet" type="text/css" href="fonts/font-awesome/css/font-awesome.css">

    <!-- Slider
    ================================================== -->
    <link href="css/owl.carousel.css" rel="stylesheet" media="screen">
    <link href="css/owl.theme.css" rel="stylesheet" media="screen">

    <!-- Stylesheet
    ================================================== -->
    <link rel="stylesheet" type="text/css"  href="css/style.css">
    <link rel="stylesheet" type="text/css" href="css/responsive.css">


    <script type="text/javascript" src="js/modernizr.custom.js"></script>

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  <body>
    <!-- Navigation
    ==========================================-->
    <nav id="tf-menu" class="navbar navbar-default navbar-fixed-top">
      <div class="container">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="index.html">Lin Zihao</a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
          <ul class="nav navbar-nav navbar-right">
            <li><a href="index.html" class="page-scroll">Home</a></li>
            <li><a href="Final Project.html" class="page-scroll">Final Project</a></li>
            <li><a href="#tf-testimonials" class="page-scroll">Contact</a></li>
          </ul>
        </div><!-- /.navbar-collapse -->
      </div><!-- /.container-fluid -->
    </nav>

    <!-- Home Page
    ==========================================-->
    <div id="tf-home" class="text-center">
        <div class="overlay">
            <div class="content">
                <h1><strong><span class="color">week_08</span></strong></h1>
                <p class="lead"><strong>Embeded Programming</strong></p>
                <a href="#tf-services" class="fa fa-angle-down page-scroll"></a>
            </div>
        </div>
    </div>

    <!-- Services Section
    ==========================================-->
    <div id="tf-services">
        <div class="container">
            <div class="text-center">
              <div class="section-title center" >
                <h2><strong>Objectives</strong></h2>
                <div class="line">
                    <hr>
                </div>
              </div>
            </div>
                <ul class="about-list" class="pull-left">
                    <li>
                        <span class="fa fa-dot-circle-o"></span>
                        <strong>1)</strong> - <em>Understand the fundamentals of embedded development.</em>
                    </li>
                    <li>
                        <span class="fa fa-dot-circle-o"></span>
                        <strong>2)</strong> - <em>Realize the communication between control board and computer.</em>
                    </li>
                </ul>
                      <br />
            <div class="text-center">
              <div class="section-title center" >
                      <h2><strong>Assignments</strong></h2>
                      <div class="line">
                          <hr>
                      </div>
                    </div>
                  </div>
                      <ul class="about-list">
                          <li>
                              <span class="fa fa-dot-circle-o"></span>
                              <strong>1)</strong> - <em>Group assignment: Compare the performance and development workflows for other architectures.</em>
                          </li>
                          <li>
                              <span class="fa fa-dot-circle-o"></span>
                              <strong>2)</strong> - <em> Individual assignment: Read a microcontroller data sheet. Program your board to do something, with as many different programming languages and programming environments as possible.</em>
                          </li>
                      </ul>
                            <br />
                <div class="text-center">
                   <div class="section-title center" >
                      <h2><strong>Individual assignment</strong></h2>
                        <div class="line">
                          <hr>
                        </div>
                    </div>
                  </div>
                <div class="text-center">
                   <div class="section-title center" >
                      <h4><strong>Research</strong></h4>
                        <div class="line">
                          <hr>
                        </div>
                    </div>
                </div>
                <p>
                  I have downloaded 8-bit AVR Microcontroller with 2/4/8K Bytes In-System Programmable Flash manual for ATtiny 24, 44 and 84 in <a href="http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-7701_Automotive-Microcontrollers-ATtiny24-44-84_Datasheet.pdf"> this Website</a>.<br/>
                  From this Data-sheet I have understood better how ATtiny44 pins are configured, what can I connect to each type of pin, and that there is a lot of technical information for my next exercises where I am going to use this Micro-controller.
                </p>
                <p style="text-align:center"><img src="img/week_08/Picture01.jpg" class="img-responsive" alt="..."></p><br/>
                <p style="text-align:center"><img src="img/week_08/Picture02.jpg" class="img-responsive" alt="..."></p><br/>
                <p>
                  But for my final project, I will need a stronger micro-processor. So I researched a microcontroller, in this case the ATmega32U4 Which the microcontroller, you can download the datasheet in <a href="http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-7766-8-bit-AVR-ATmega16U4-32U4_Datasheet.pdf">this Website</a>. It was 438pages long. So, I have picked out some of the research that I think is important.</br>
                  ⑴ Overview<br/>
                  <ul class="about-list" class="pull-left">
                      <li>
                          <span class="fa fa-dot-circle-o"></span>
                          <strong>Component Features)</strong> - <em>which are usually located in the first few pages of a datasheet. These features can be considered like a summary which can help you identify if the component is right for your application.</em>
                      </li>
                      <li>
                          <span class="fa fa-dot-circle-o"></span>
                          <strong>Component Block Diagram</strong> - <em>which explains how the different internal systems inside the component work.</em>
                      </li>
                      <li>
                          <span class="fa fa-dot-circle-o"></span>
                          <strong>The Pinout</strong> - <em>schematic which helps in identifying the functions of the different pins and where they're located.</em>
                      </li>
                      <li>
                          <span class="fa fa-dot-circle-o"></span>
                          <strong>Absolute Maximum Ratings</strong> - <em>which are part of the electrical characteristics that contain the values of the maximum ratings such as voltage a component can withstand before it gets damaged.</em>
                      </li>
                  </ul>
                  ⑵ Pin Configurations<br/>
                  The pinout of this microcontroller is presented in the next Figure.<br/>
                  <p style="text-align:center"><img src="img/week_08/Picture03.jpg" class="img-responsive" alt="..."></p>
                  <p>
                    At a certain point, I realized I was quickly going to have more screen captures than I knew what to do with because of just how much information is in the data sheet. But I can't read it all, so is there anything I don't understand about microcontrollers that I need to check the datasheet. And also, I'll read it part by part, to be prepared for the day of making my own Final Project PCB with it.
                  </p>
                <div class="text-center">
                  <div class="section-title center" >
                    <h4><strong>Programming</strong></h4>
                  </div>
                </div>
                    <p>
                      As I am more familiar with Arduino programming language, so I began with it. The Arduino Integrated Development Environment (IDE) is a cross-platform application (for Windows, macOS, Linux) that is written in functions from C and C++. It is used to write and upload programs to Arduino compatible boards, but also, with the help of 3rd party cores, other vendor development boards.<br/>
                      The Arduino IDE supplies a software library from the Wiring project, which provides many common input and output procedures. User-written code only requires two basic functions, for starting the sketch and the main program loop, that are compiled and linked with a program stub main () into an executable cyclic executive program with the GNU toolchain, also included with the IDE distribution. The Arduino IDE employs the program avrdude to convert the executable code into a text file in hexadecimal encoding that is loaded into the Arduino board by a loader program in the board's firmware. By default, avrdude is used as the uploading tool to flash the user code onto official Arduino boards.<br/>
                      Here ATtiny Using Arduino FabAcademy tutorial for this week.<br/>
                      After reading the datasheet, I wanted to start programming my board. This week's individual assignment is based on programming the hello-board manufactured in the electronic design assignment. <br/>
                      So, in this week, the first thing that I did is install arduion IDE. You can download arudino IDE from <a href="https://www.arduino.cc/en/Main/Software#.UyAdLo3diHA">this Website</a>.
                    </p>
                    <p style="text-align:center"><img src="img/week_08/Picture04.jpg" class="img-responsive" alt="..."></p>
                    <p>The first thing is I need to setting the Arduino IDE like is.</p>
                    <p style="text-align:center"><img src="img/week_08/Picture05.jpg" class="img-responsive" alt="..."></p>
                    <p>The next step is to add Attiny library and set the Arduino board. For that we need to go tools -> board -> board manager and then choose the Atiny24/44/84 as the board -> Attiny44 as the processor -> Extremal 20MHz as clock.</p>
                    <p style="text-align:center"><img src="img/week_08/Picture06.jpg" class="img-responsive" alt="..."></p>
                    <p style="text-align:center"><img src="img/week_08/Picture07.jpg" class="img-responsive" alt="..."></p>
                    <p>After doing the preparatory work, I began to program formally. And I also see the ATtiny scheme below to know each connection pin number in Arduino language. My scheme says that my INPUT (Button) is pin 2 and OUTPUT (Led) is pin 3.</p>
                    <p style="text-align:center"><img src="img/week_08/Picture08.jpg" class="img-responsive" alt="..."></p>
                    <p>
                      ⑴ Boton_Led_Flicker<br/>
                      I writhed the program taking in account these pins.
                    </p>
                    <p style="text-align:center"><img src="img/week_08/Picture09.jpg" class="img-responsive" alt="..."></p>
                    <p>Then I used usbtiny to connect to my PCB board and compiled and download the program in Arduino to the PCB board.</p>
                    <p style="text-align:center"><img src="img/week_08/Picture10.jpg" class="img-responsive" alt="..."></p>
                    <p>
                      Then I test my PCB board. So, I push the button in the board, and The LED lights start flashing.<br/>
                      <iframe width="1280" height="720" src="https://www.youtube.com/embed/M50AsVBxWmU" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe><br/>
                      ⑵ Led_SOS<br/>
                      ① Generality<br/>
                      SOS is a Morse code distress signal (▄  ▄  ▄  ▄ ▄ ▄ ▄  ▄ ▄ ▄  ▄ ▄ ▄  ▄  ▄  ▄), used internationally, that was originally established for maritime use.
                    </p>
                    <p style="text-align:center"><img src="img/week_08/Picture11.jpg" class="img-responsive" alt="..."></p>
                    <p>
                      ②Program<br/>
                      I writhed the program code like this, three for loops are used to represent S, O, S.
                    </p>
                    <p style="text-align:center"><img src="img/week_08/Picture12.jpg" class="img-responsive" alt="..."></p>
                    <p>
                      ③ Testing<br/>
                      I used usbtiny to connect to my PCB board and compiled and download the program in Arduino to the PCB board.<br/>
                      <iframe width="1280" height="720" src="https://www.youtube.com/embed/HvyNp6es8Pc" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe><br/>
                      ⑶ Boton_Led_SOS<br/>
                      On top of the previous program, I added a button. So, I writhed the program code like this:
                    </p>
                    <p style="text-align:center"><img src="img/week_08/Picture13.jpg" class="img-responsive" alt="..."></p>
                    <p>
                      I also used usbtiny to connect to my PCB board and compiled and download the program in Arduino to the PCB board. You can see how it worked in follow movie.<br/>
                      <iframe width="1280" height="720" src="https://www.youtube.com/embed/pxom3b6uD0w" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe><br/>
                    </p>
                <div class="text-center">
                    <div class="section-title center" >
                      <h2><strong>Group assignment</strong></h2>
                        <div class="line">
                          <hr>
                        </div>
                   </div>
                </div>
                    <p>
                      Following are a few different microcontroller architectures available in the market.<br/>
                      1) 8051<br/>
                      The Intel MCS-51 (also known as 8051) is a CISC architecture. These are available in 8-bit, 16-bit and 32-bit microcontrollers. 8051 silicon IP cores are typically smaller size, lower power compared to ARM Cortex-M and MIPS processors. <br/>
                      <p style="text-align:center"><img src="img/week_08/Picture14.jpg" class="img-responsive" alt="..."></p><br/>
                      2) ARM<br/>
                      The ARM stands for Advanced RISC machine and it is 32-bit reduced instructions set computer (RISC) microcontroller. It was first introduced by the Acron computers’ organization in 1987. The ARM is a family of the microcontroller developed by the different manufacturers such as ST microelectronics, Motorola and so on. <br/>
                      <p style="text-align:center"><img src="img/week_08/Picture15.jpg" class="img-responsive" alt="..."></p><br/>
                      3) AVR<br/>
                      AVR is a family of microcontrollers developed by Atmel that use the RISC processors. AVR are most commonly used in the Arduino line of open source board designs. These are available in 8-bit tinyAVR, megaAVR and XMEGA. <br/>
                      <p style="text-align:center"><img src="img/week_08/Picture16.jpg" class="img-responsive" alt="..."></p><br/>
                      4) PIC<br/>
                      PIC stands for Peripheral Interface Controller. It is a family of microcontrollers developed by Microchip with a wide variety of options available. They are not strictly RISC processors as they differ very slightly in their operation. <br/>
                      <p style="text-align:center"><img src="img/week_08/Picture17.jpg" class="img-responsive" alt="..."></p><br/>
                    </p>
                <div class="text-center">
                  <div class="section-title center" >
                    <h4><strong>4WD MINIQ</strong></h4>
                  </div>
                </div>
                    <p>Then I have selected a board called 4WD MINIQ. This car board can be programmed by Arduino. This card contains: ATmega32U4 microcontroller、 Infrared receiving tube、RGB lamp、buzzer、key and so on.</p>
                    <p style="text-align:center"><img src="img/week_08/Picture18.jpg" class="img-responsive" alt="..."></p><br/>
                    <p>Then I made a first test program by myself to use the buzzer which can play two different sounds.</p>
                    <p style="text-align:center"><img src="img/week_08/Picture19.jpg" class="img-responsive" alt="..."></p><br/>
                    <p>
                      When I finish the program, I connected the board to the computer, and turned on the power. Then I clicked the download button on the Arduino IDE.<br/>
                      <iframe width="900" height="506" src="https://www.youtube.com/embed/WYtIG-GmSLI" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
                    </p>
                <div class="text-center">
                  <div class="section-title center" >
                    <h4><strong>HC6800-MS ----51</strong></h4>
                  </div>
                </div>
                    <p>Next, I have selected a board called HC6800-MS. This car board can be programmed by Keil uVision5. This card contains as follow future.</p>
                      <p style="text-align:center"><img src="img/week_08/Picture20.jpg" class="img-responsive" alt="..."></p><br/>
                      <p>Then I made a test program by myself to use the LED. The LED are on from right to left. Here is the program.</p>
                      <p style="text-align:center"><img src="img/week_08/Picture21.jpg" class="img-responsive" alt="..."></p><br/>
                      <p>Then I generated the type of file which is .HEX.</p>
                      <p style="text-align:center"><img src="img/week_08/Picture22.jpg" class="img-responsive" alt="..."></p><br/>
                      <p>
                        The program is then downloaded to the board for verification.<br/>
                        <iframe width="900" height="506" src="https://www.youtube.com/embed/OKmPvuV6oHw" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe><br/>
                      </p>
                    <div class="text-center">
                       <div class="section-title center" >
                          <h2><strong>File Download</strong></h2>
                            <div class="line">
                              <hr>
                            </div>
                        </div>
                      </div>
                        <p> <a href="Files/week_08/Boton_Led_Flicker.rar">Boton_Led_Flicker</a> </p>
                        <p> <a href="Files/week_08/Boton_Led_SOS.rar">Boton_Led_SOS</a> </p>
                        <p> <a href="Files/week_08/Led_SOS.rar">Led_SOS</a> </p>
                        <p> <a href="Files/week_08/4WD MINIQ_Buzzer.rar">4WD MINIQ_Buzzer</a> </p>
                        <p> <a href="Files/week_08/HC6800-MS_Keil.rar">HC6800-MS_Keil</a> </p>
        </div>
    </div>
  <!-- Testimonials Section
    ==========================================-->
    <div id="tf-testimonials" class="text-center">
        <div class="overlay">
            <div class="container">
                <div class="section-title center">
                  <div class="section-title center">
                      <h2><strong>contact Me</strong></h2>
                      <div class="line">
                          <hr>
                      </div>
                      <div class="clearfix"></div>
                      <small><em>
                        Address: No.10, Kehua street, Wuhou District, Chengdu, Sichuan Province, China<br />
                        TEL: (028) 85406538    (+86)18981085882<br />
                        E-mail: linzihao@scuspark.com<br />
                        QQ: 386866966
                      </em></small>
                  </div>

                  <form>
                      <div class="row">
                          <div class="col-md-6">
                              <div class="form-group">
                                  <label for="exampleInputEmail1">Email address</label>
                                  <input type="email" class="form-control" id="exampleInputEmail1" placeholder="Enter email">
                              </div>
                          </div>
                          <div class="col-md-6">
                              <div class="form-group">
                                  <label for="exampleInputPassword1">Password</label>
                                  <input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password">
                              </div>
                          </div>
                      </div>
                      <div class="form-group">
                          <label for="exampleInputEmail1">Message</label>
                          <textarea class="form-control" rows="3"></textarea>
                      </div>

                      <button type="submit" class="btn tf-btn btn-default">Submit</button>
                  </form>
                </div>
            </div>
        </div>
    </div>

    <nav id="footer">
        <div class="container">
            <div class="pull-left fnav">
                <p>Science Park of Sichuan University Co.Ltd. All rights reserved. © 2020. Designed by Lin Zihao</p>
            </div>
            <div class="pull-right fnav">
                <ul class="footer-social">
                    <li><a href="https://www.facebook.com/zihao.lin.7399"><i class="fa fa-facebook"></i></a></li>
                    <li><a href="#"><i class="fa fa-dribbble"></i></a></li>
                    <li><a href="#"><i class="fa fa-google-plus"></i></a></li>
                    <li><a href="#"><i class="fa fa-twitter"></i></a></li>
                </ul>
            </div>
        </div>
    </nav>


    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <script type="text/javascript" src="js/jquery.1.11.1.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script type="text/javascript" src="js/bootstrap.js"></script>
    <script type="text/javascript" src="js/SmoothScroll.js"></script>
    <script type="text/javascript" src="js/jquery.isotope.js"></script>

    <script src="js/owl.carousel.js"></script>

    <!-- Javascripts
    ================================================== -->
    <script type="text/javascript" src="js/main.js"></script>

  </body>
</html>