EE192: Mechatronics Design Lab Spring 2014Checkpoint 1IntroductionThis lab is designed to introduce you to the Freescale Kinetis L Freedom development board (KL25Z). Useful documentation and pinout information can be found here: Checkoff Requirements
Version Control with GitIt's good to get into the habit of working with version control. This will pay dividends in the near future. Version control will let you easily save – and if necessary, roll back to – a version of code that works. It also enables multiple team members to work on code and merge changes. To get a private repository for your group, please send the TA an email with your GitHub usernames. The starter code can be found on GitHub. Keil uVision and Serial CommunicationLet's write the classic “Hello World” program. The code to do this is straightforward and is provided in the starter code. This section will focus on Keil uVision and serial communication. Download the starter code linked above and open ee192-sp14.uvproj in uVision. Buildling: Go to Project > Build Target (or press F7). Downloading Option 1: Attach the KL25Z to your computer via USB (shown below). It should show up as an external storage device. Copy/paste the file build/ee192-sp14_KL25Z.bin into that external storage device. Finally, press the reset button on the KL25Z.
Downloading Option 2: Attach the KL25Z to your computer via USB (shown above).
Serial communication using PuTTY: Select Connection type: Serial and ensure the correct COM port is selected. To check the COM port, open the Windows Device Manager, expand “Ports,” and look for “mbed Serial Port.” Once you're connected, press the reset button on the KL25Z, and you should see it print “Hello World!” LED BlinkThe next task is to make an LED blink at 1Hz, 75% duty cycle. This means that the LED is on 75% of the time and off 25% of the time.
Extra: Fading LED using PWMDue to properties of LEDs, they are normally either on or off. However, we can get them to fade using PWM, or Pulse Width Modulation. PWM allows for a digital approximation of an analog value by turning on and off the output very fast. It's a good idea to get familiarized with PWM, as you will be using it for controlling your servo and motors later on. Learn about the mbed PwmOut interface here. |