Download presentation
Presentation is loading. Please wait.
1
Intro to Micro Controllers
AVR Butterfly
2
Overview For this section of the course, we are going to turn to our good friend Smiley (smileymicros.com) to teach us the fundamentals of Micro Controllers. We are going to start by working through the PDF entitled Smiley’s AVR Butterfly Introduction Step 1 is to simply read over the entire file to get an idea of the end goal. In the next slides we will highlight important sections and the actual labs we will perform
3
Step 1 First we need to get our Butterfly to talk to our computer
To create a serial cable to hook up our Butterfly follow the instructions here: The video assumes you have a stock DB9 serial cable with a female end Once you have identified the wires for the rx, tx, and ground lines, solder wires to the ends as shown here:
4
Step 2 Now we need to prepare the actual Butterfly by adding headers so we can attach the serial, power, and output wires. Follow the video here: Once your headers are installed, attach your serial cable to the Butterfly as depicted in Smiley page 18. Power your Butterfly using the 5v and gnd lines from your Arduino as shown on Smiley 19 (the LED indicator is not necessary)
5
Step 3 Before trying to control an LED, it is necessary to ensure that we have communication between the AVR Butterfly and our computer. It is necessary to use serial port for communication. If your computer does not have one, it is also possible to use a USB to RS232 adapter, depicted on the next slide
6
USB – RS232 Adapters
7
Step 4 After plugging your adapter into your computer and installing the drivers, setup may continue as if your computer has an internal serial port. Follow the directions in Smiley’s Butterfly FAQ document starting on page 8 to set the com port number of your serial port to a value between 1 and 4 Remember this number!
8
Step 5 Download the putty terminal program from Course Site
Launch it and configure it as follows: Select Serial for connection type For Serial line replace COM1 with your COM port from step 4 (type the phrase COM#) Set the speed to 19200 Click open and a terminal window will appear
9
Step 6 You should have the female end of your modified serial cable attached to the male end of the serial port on your computer The loose wires attached to RX, TX, and GND should be attached to the Butterfly as specified in step 2 Follow the directions half way down on page 20 of Smiley’s Butterfly intro to test your connection. It is imperative that you see the question marks upon boot-up of the Butterfly in order for later steps to work To reset your Butterfly simply pull out the 5v line and plug it back in
10
Step 7 Once we know our Butterfly can talk to our computer we need to install the development environment so we can write code Download AVR Tools and AVR Studio from Course Site Follow the instructions starting on page 21 of Smiley’s intro to install the tool chain and studio (the order is important)
11
Step 8 Now it is time to write our first program – to blink a LED
Follow the directions starting on page 22 of the intro, but instead name your project Blink At page 25 of the document we will supplement the code on the next slide rather than the supplied code (since we are writing Blink.c not CyclonicEyes.c)
12
Code for Blink.c // Blink.c #include <avr/io.h>
#define F_CPU UL #include <util/delay.h> int main (void) { // set PORTD for output DDRD = 0xFF; while(1) { PORTD = 2; _delay_loop_2(30000); PORTD = 0; } return 1;
13
Step 9 It is necessary to compile and upload Blink.c to the AVR Butterfly Follow pages 26 and 27 of Smiley’s intro to complete this. Once you have uploaded the code (AVR Program says successful) then power cycle your Butterfly and turn it on by pressing the joystick up a few times If you did everything correctly you should see a gibberish character displayed on the LCD
14
Step 10 The hardware needed to blink the LED is quite simple
Wire a LED as shown in lesson 1 Rather than attaching the anode to a 5 volt source attach it to port D1 on your Butterfly (a pin out is available in the Smiley intro on page 28) Your LED should be Blinking! A picture showing the actual circuit is on the next slide Again remember that the Arduino is being used simply as a power supply
15
Blinking LED Circuit
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.