devloper board

111
ATMEL INTEGRATED DEVELOPEMENT BOARD Introduction This project describes a prototype board for the Atmel Mega32 or other Atmel Series (PDIP) MCU. It includes a power supply, crystal clock and generous bypass capacitors. A six-pin header allows flash memory programming from an STK200/300 or Atmel Dragon. All port pins are brought out to a single row of vias on 0.1 inch centers. A single 36 connection SIP machine-pin plug could be used to attach this row to another board or to a solder less breadboard. All 32 port pins, plus Vcc, Aref and ground, are available. It include DB9 and DB 25 connector which is use to program the Microcontroller with the interfacing circuit (M74HC244 and Ponyprog2000) to protect the microcontroller, push buttons for inverting and non- inverting application, LED panel to check the output of the Microcontroller, to provide external input to the Microcontroller connectors are provided. The two seven segment display are also shown on the board as shown in the figure under the heading Atmel development board, L298 motor driving circuit for driving stepper motor The board layout is shown below. The Express PCB design file for v8/2009 is here and requires a DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL Page 1

Upload: pukhraj-titre

Post on 26-Aug-2014

127 views

Category:

Documents


1 download

TRANSCRIPT

ATMEL INTEGRATED DEVELOPEMENT BOARD

IntroductionThis project describes a prototype board for the Atmel Mega32 or other Atmel Series (PDIP) MCU. It includes a power supply, crystal clock and generous bypass capacitors. A six-pin header allows flash memory programming from an STK200/300 or Atmel Dragon. All port pins are brought out to a single row of vias on 0.1 inch centers. A single 36 connection SIP machine-pin plug could be used to attach this row to another board or to a solder less breadboard. All 32 port pins, plus Vcc, Aref and ground, are available. It include DB9 and DB 25 connector which is use to program the Microcontroller with the interfacing circuit (M74HC244 and Ponyprog2000) to protect the microcontroller, push buttons for inverting and non-inverting application, LED panel to check the output of the Microcontroller, to provide external input to the Microcontroller connectors are provided. The two seven segment display are also shown on the board as shown in the figure under the heading Atmel development board, L298 motor driving circuit for driving stepper motor

The board layout is shown below. The Express PCB design file for v8/2009 is here and requires a free software download to modify or to order directly from express PCB. The Express PCB schematic file is here. Minor changes from last year include bigger diameter header vias, 1N4001 diode on power input, and Vcc-to-Vtarget jumper support for the dragon programmer. Tentative serial design for next year is here. Tentative USB design is here.

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 1

ATMEL INTEGRATED DEVELOPEMENT BOARD

High Level Design Rationale and Sources Logical Structure Hardware and Software Tradeoffs

Rationale and SourcesThe rationale behind this project was to demonstrate an idea by creating a working prototype of a development board to enable the testing of the different and multiple application based on Atmel series or projects based on Atmega32 We also thought that the idea of integrating all of the different hardware to actuate feedback that was very interesting. Putting all of this in a single board package was no easy task but it was a great learning experience. The source of the idea behind our project was from major training done by us at the Center Research and Industrial Staff Performance (CRISP), BHOPAL. They trained us on Philips and Motorola development board was linked to the a PC. This idea spurred our interest in using a development board feedback system to allow the user to test the projects at greater possibility.

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 2

ATMEL INTEGRATED DEVELOPEMENT BOARD

Logical StructureThe basic logical structure of our project involves the input from the Atmel programmer tool AVR Studio, Code Vision PonyPrgo2000 through computer to the microcontroller to run the different devices. The microcontroller enables the six major components to communicate effectively with programmer through serial and parallel Ports. Before burn the program in microcontroller we test the program in Simulator and different simulator devices.

Logical Structure of Integrated Development Board

A 9 volt power supply is applied to the board where LM7805 voltage regulator convert it to 5 volt supply. This voltage is use by the microcontroller to drive the following circuits describe below: L298 Stepper Motor Controller Two 7segement display External Input/output LED panelDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 3

ATMEL INTEGRATED DEVELOPEMENT BOARD Push Switch

Hardware and Software TradeoffsAnything that we determined could be easily implemented in hardware or software we opted to do in software because our processor was not very taxed for computing power, to begin with. The original idea was to use a L298 Stepper Motor Controller to control the bipolar stepper motor step sequences, but we decided that this was much easier done with the microcontroller because it required less connections and we could control better the number of steps, the reversal of direction and the speed of rotation of the motor. Also, it was a better idea for us to offload the hardware onto the software because we had extra processing power and the circuitry required for this project was already significant. The separate jumpers were easier to check the inverting and non-inverting modes of LED panel and both of the seven segments display, the extra both of the push switches are use to separately provide the inverting and non-inverting input. The low power signal are directly connected to the microcontroller.

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 4

ATMEL INTEGRATED DEVELOPEMENT BOARD

Circuit Diagrams Circuit Diagram of Integrated Development board

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 5

ATMEL INTEGRATED DEVELOPEMENT BOARD

Component DescriptionsThe following is a brief description of some of major components that we used in our hardware design of the system. We also used some boards generously donated by Freescale to the lab in this final project. We used the DS1532 9V battery board and two small soldering boards. Unfortunately the 5V regulator on the battery board could not supply enough current to drive our stepper motor so we soldered into the board a new regulator (LM340T5) to supply the necessary power to the motor. Atmega 32 L298HN

74LS74 74HC244 LM7805 Crystal Oscillator Diodes Resistor

Capacitor Breadboard

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 6

ATMEL INTEGRATED DEVELOPEMENT BOARD

Atmega 32The ATMEGA32 is a low-power, high-performance CMOS 8-bit microcontroller with 32K bytes of in-system programmable Flash memory. The device is manufactured using Atmels high-density non-volatile memory technology and is compatible with the industry- standard 80C51 instruction set and pin out. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional non-volatile memory programmer. By combining a versatile 8-bit CPU with in-system programmable Flash on a monolithic chip, the Atmel ATMEGA32 is a powerful microcontroller which provides a highly-flexible and cost-effective solution to many embedded control applications. The ATMEGA32 provides the following standard features: 32K bytes of Flash, 2K bytes of RAM, 32 I/O lines, Watchdog timer, Two 8-bit and One 16-bit Timer/Counters with Separate Prescalers and Compare Modes, Real Time Counter with Separate Oscillator, Six PWM Channels, 8-channel, 10-bit ADC ,Differential mode with selectable gain at 1x, 10x or 200x, Byte-oriented Two-wire Serial Interface, One Programmable Serial USART, Master/Slave SPI Serial Interface, Programmable On-chip Analog Comparator, Watchdog Timer with Separate On-chip Oscillator,

Interrupt and Wake-up on Pin Change, Special Microcontroller Features, Power-on Reset and Programmable Brown-out Detection. In addition, the ATMEGA644 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. The Power-down mode saves the RAM contents but freezes the oscillator, disabling all other chip functions until the next external interrupt or hardware reset.

Pin diagram

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 7

ATMEL INTEGRATED DEVELOPEMENT BOARD

Figure No. 1.1: Pin Diagram of ATMEGA 32

Features High-performance, Low-power AVR 8-bit Microcontroller Advanced RISC Architecture 131 Powerful Instructions Most Single-clock Cycle Execution 32 x 8 General Purpose Working Registers Fully Static Operation Up to 16 MIPS Throughput at 16 MHz On-chip 2-cycle Multiplier High Endurance Non-volatile Memory segments 32K Bytes of In-System Self-programmable Flash program memory 1024 Bytes EEPROM 2K Byte Internal SRAM Write/Erase Cycles: 10,000 Flash/100,000 EEPROM Data retention: 20 years at 85C/100 years at 25C(1) Optional Boot Code Section with Independent Lock Bits In-System Programming by On-chip Boot Program True Read-While-Write Operation Programming Lock for Software Security JTAG (IEEE std. 1149.1 Compliant) Interface Boundary-scan Capabilities According to the JTAG Standard Extensive On-chip Debug Support Programming of Flash, EEPROM, Fuses, and Lock Bits through the JTAG Interface Peripheral Features Two 8-bit Timer/Counters with Separate Prescalers and Compare Modes One 16-bit Timer/Counter with Separate Prescaler, Compare Mode, and CaptureDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 8

ATMEL INTEGRATED DEVELOPEMENT BOARD Mode Real Time Counter with Separate Oscillator Four PWM Channels 8-channel, 10-bit ADC 8 Single-ended Channels 7 Differential Channels in TQFP Package Only 2 Differential Channels with Programmable Gain at 1x, 10x, or 200x Byte-oriented Two-wire Serial Interface Programmable Serial USART Master/Slave SPI Serial Interface Programmable Watchdog Timer with Separate On-chip Oscillator On-chip Analog Comparator Special Microcontroller Features Power-on Reset and Programmable Brown-out Detection Internal Calibrated RC Oscillator External and Internal Interrupt Sources Six Sleep Modes: Idle, ADC Noise Reduction, Power-save, Powerdown, Standby and Extended Standby I/O and Packages 32 Programmable I/O Lines 40-pin PDIP, 44-lead TQFP, and 44-pad QFN/MLF Operating Voltages 2.7 - 5.5V for ATmega32L 4.5 - 5.5V for ATmega32 Speed Grades 0 - 8 MHz for ATmega32L 0 - 16 MHz for ATmega32 Power Consumption at 1 MHz, 3V, 25C for ATmega32L Active: 1.1 mA Idle Mode: 0.35 mA Power-down Mode: < 1 ADEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 9

ATMEL INTEGRATED DEVELOPEMENT BOARD

.L298HN

The L298 is an integrated monolithic circuit in a 15-lead Multiwatt and PowerSO20 packages. It is a high voltage, high current dual full-bridge driver designed to accept standard TTL logic levels and drive inductive loads such as relays, solenoids, DC and stepping motors. Two enable inputs are provided to enable or disable the device independently of the input signals. The emitters of the lower transistors of each bridge are connected together and the corresponding external terminal can be used for the connection of an external sensing resistor. An additional supply input is provided so that the logic works at a lower voltage. OPERATING . SUPPLY VOLTAGE UP TO 46 V TOTAL DC CURRENT UP TO 4 A LOW SATURATION VOLTAGE OVERTEMPERATURE PROTECTION LOGICAL "0" INPUT

VOLTAGE UP TO 1.5 V (HIGH NOISE IMMUNITY)

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 10

ATMEL INTEGRATED DEVELOPEMENT BOARD

74LS47The SN54/74LS47 are Low Power Scotty BCD to 7-Segment Decoder/Drivers consisting of NAND gates, input buffers and seven AND-OR-INVERT gates. They offer active LOW, high sink current outputs for driving indicators directly. Seven NAND gates and one driver are connected in pairs to make BCD data and its complement available to the seven decoding AND-OR-INVERT gates. The remaining NAND gate and three input buffers provide lamp test, blanking input / ripple-blanking output and ripple-blanking input. The circuits accept 4-bit binary-coded-decimal (BCD) and, depending on the state of the auxiliary inputs, decode this data to drive a 7-segment display indicator. The relative positive-logic output levels, as well as conditions required at the auxiliary inputs, are shown in the truth tables. Output configurations of the SN54/ 74LS47 are designed to withstand the relatively high voltages required for 7-segment indicators. These outputs will withstand 15 V with a maximum reverse current of 250 mA. Indicator segments requiring up to 24 mA of current may be driven directly from the SN74LS47 high performance output transistors. Display patterns for BCD input counts above nine are unique symbols to authenticate input conditions. The SN54/74LS47 incorporates automatic leading and/or trailing-edge zero-blanking control (RBI and RBO). Lamp test (LT) may be performed at any time which the BI /RBO node is a HIGH level. This device also contains an overriding blanking input (BI) which can be used to control the lamp intensity by varying the frequency and duty cycle of the BI input signal or to inhibit the outputs. Lamp Intensity Modulation Capability (BI/RBO) Open Collector OutputsDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 11

ATMEL INTEGRATED DEVELOPEMENT BOARD Lamp Test Provision Leading/Trailing Zero Suppression Input Clamp Diodes Limit High-Speed Termination Effects

74HC244The 74HC244 is an advanced high-speed CMOS OCTAL BUS BUFFER (3STATE) fabricated with silicon gate C2MOS technology. G control input governs four BUS UFFERs. This device is designed to be used with 3 state memory address drivers, etc. All inputs are equipped with protection circuits against static discharge and transient excess voltage. HIGH SPEED: tPD = 10ns (TYP.) at VCC = 6V LOW POWER DISSIPATION: ICC = 4mA(MAX.) at TA=25C HIGH NOISE IMMUNITY: VNIH = VNIL = 28 % VCC (MIN.) SYMMETRICAL OUTPUT IMPEDANCE: |IOH| = IOL = 6mA (MIN) BALANCED PROPAGATION DELAYS: tPLH @ tPHL WIDE OPERATING VOLTAGE RANGE: VCC (OPR) = 2V to 6V PIN AND FUNCTION COMPATIBLE WITH 74 SERIES 244

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 12

ATMEL INTEGRATED DEVELOPEMENT BOARD

LM7805The LM78LXX series of three terminal positive regulators is available with several fixed output voltages making them useful in a wide range of applications. When used as a zener diode/resistor combination replacement, the LM78LXX usually results in an effective output impedance improvement of two orders of magnitude, and lower quiescent current. These regulators can provide local on card regulation, eliminating the distribution problems associated with single point regulation. The voltages available allow the LM78LXX to be used in logic systems, instrumentation, HiFi, and other solid state electronic equipment. The LM78LXX is available in the plastic TO-92 (Z) package, the plastic SO-8 (M) package and a chip sized package (8-Bump micro SMD) using Nationals micro SMD package technology. With adequate heat sinking the regulator can deliver 100 mA output current. Current limiting is included to limit the peak output current to a safe value. Safe area protection for the output transistors is provided to limit internal power dissipation. If internal power dissipation becomes too high for the heat sinking provided, the thermal shutdown circuit takes over preventing the IC from overheating. LM78L05 in micro SMD package Output voltage tolerances of 5% over the temperature range Output current of 100 mA Internal thermal overload protectionDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 13

ATMEL INTEGRATED DEVELOPEMENT BOARD Output transistor safe area protection Internal short circuit current limit Available in plastic TO-92 and plastic SO-8 low profile packages No external components Output voltages of 5.0V, 6.2V, 8.2V, 9.0V, 12V, 15V

Crystal OscillatorA crystal oscillator is an electronic circuit that uses the mechanical resonance of a vibrating crystal of piezoelectric material to create an electrical signal with a very precise frequency. This frequency is commonly used to keep track of time (as in quartz wristwatches), to provide a stable clock signal for digital integrated circuits, and to stabilize frequencies for radio transmitters and receivers. The most common type of piezoelectric resonator used is the quartz crystal, so oscillator circuits designed around them were called "crystal oscillators". Quartz crystals are manufactured for frequencies from a few tens of kilohertz to tens of megahertz. More than two billion (2109) crystals are manufactured annually. Most are small devices for consumer devices such as wristwatches, clocks, radios, computers, and cell phones. Quartz crystals are also found inside test and measurement equipment, such as counters, signal generators, and oscilloscopes. A crystal is a solid in which the constituent atoms, molecules, or ions are packed in a regularly ordered, repeating pattern extending in all three spatial dimensions. Quartz has the further advantage that its elastic constants and its size change in such a way that the frequency dependence on temperature can be very low. The specific characteristics will depend on the mode of vibration and the angle at which the quartz isDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 14

ATMEL INTEGRATED DEVELOPEMENT BOARD cut (relative to its crystallographic axes).[7] Therefore, the resonant frequency of the plate, which depends on its size, will not change much, either. This means that a quartz clock, filter or oscillator will remain accurate. For critical applications the quartz oscillator is mounted in a temperature-controlled container, called a crystal oven, and can also be mounted on shock absorbers to prevent perturbation by external mechanical vibrations.

DiodeIt is s two terminal device consisting of a P-N junction formed either in GE or SI crystal. The P and N type regions are referred to as anode and cathode respectively. Commercially available diodes usually have some means to indicate which lead is P and which lead is N. Standard notations consists the number proceeded by IN such as In 240 & 250. Here 240 and 250 correspond to color band. Diodes are polarized, which means that they must be inserted into the PCB the correct way round. This is because an electric current will only flow through them in one direction (like air will only flow one way through a tyre valve).Diodes have two connections, an anode and a cathode. The cathode is always identified by a dot, ring or some other mark.

The pcb is often marked with a + sign for the cathode end. Diodes come in all shapes and sizes. They are often marked with a type number. Detailed characteristics of a diode can be found by looking up the type number in a data book. If you know how to measure resistance with a meter then test some diodes. A good one has low resistance

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 15

ATMEL INTEGRATED DEVELOPEMENT BOARD in one direction and high in the other. There are specialized types of diode available such as the zener and light emitting diode (LED).

ResistorA resistor is an electrical component, which has been manufacture with a specified amount of resistance. The resistors can conduct current in both the directions. The resistors may be connected in an electric circuit without concern for lead polarization. The resistors are used mainly for two purposes, namely controlling the flow of electric current and providing desired amounts of voltage in electric in electric or electronic circuits.

Resistor specificationsThe resistors are specified in terms of their resistance values, tolerance power rating and thermal stability. By tolerance, we mean the allowed variation permitted in the normal or marred value or the resistor. It means that the actual value of the resistor may be either greater or smaller than that of the indicated value, by a factor given by the specified tolerance. Thus resistors are manufactured with a specified tolerance. For example, a 5000 resistor with a tolerance of + 10% will have an actual resistance value anywhere between 4500 and 5500 or in other words 500 greater or smaller them the rated value.DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 16

ATMEL INTEGRATED DEVELOPEMENT BOARD The power rating of a resistor is given by the maximum wattage it can dissipate, without excessive heating. Since the power rating is proportional to the square of a current, there fore current must not be higher than its safe value. If the current exceeds the safe value, the resistance will burn out. Usually, carbon composition resistors will fail, if operated at near the rated power values. In this case, the resistor will not burn out. But the failure is gradual, which takes many months. It changes gradually to a much lower amount of resistance. This causes an improper operation of an electronic of an electronic circuit particularly in amplifier. Thus in order to increase the life of use a power dissipation of about half of the rating of the resistor. The thermal stability of a resistor is indicated by the temperature coefficient specification, which is usually expressed in parts per million per degree centigrade (+ ppm/C). The smaller value of temperature coefficient will have less variation in the resistance value. Therefore, smaller value of temperature coefficient means a higher thermal stability of a resistor. Classification of resistor Shows the classification of resistors in the from of a family tree. The resistors are basically of two types, namely linear resistors and non- linear resistors. Each type is further subdivided into many types as shown in the figure. Linear resistors The resistors through which the current is directly proportional to the applied voltage, are called linear resistors. Such resistors have a property that their resistance value do not change with the variation in applied voltage, temperature or light intensity. The linear resistors are of two types namely fixed resistors and variable resistors. Nonlinear. The resistors through which the current is not directly proportional to the applied voltage, are called non-linear resistors. Such resistors have a property that their resistance values change with variation in applied voltage, temperature of light intensity. The non-linear resistors are of three namely thermostat, photo resistor and varistor. Fixed Resistors The fixed resistors are those whose do not change with the variation in applied voltage, temperature and light intensity. Such resistors are available in various shapes and sizes, with both axial and radial leads as shown in Fig.7.2. In addition to this, the

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 17

ATMEL INTEGRATED DEVELOPEMENT BOARD fixed resistors are available with sugs for installation by soldering or mounting with screws and rivets.

Resistor Colour Code CalculatorThe Resistor Colour Code Calculator can be used to identify resistors. It consists of three card discs showing the colours and values, these are fastened together so you can simply turn the discs to select the value or colour code required. Simple but effective! There are two versions to download and print on A4 white card (two per sheet): Coloured (for a colour printer) B/W for a black only printer) This version must be coloured manually, it is easiest to do this before cutting out. To make the calculator, carefully cut out the three discs and fasten them together with a small brass paper fastener. The calculator design is copyright but it may be freely copied for educational purposes. The Resistor Colour Code Calculator is supplied as a PDF file. To view and print PDF files you need an Acrobat Reader which may be downloaded free forDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 18

ATMEL INTEGRATED DEVELOPEMENT BOARD Windows Mac,RISE OS, or Unix Linex computers. If you are not sure which type of computer you have it is probably Windows.

CapacitorThis are the storage devices but has in built Resistance thats why the storage voltage does not last for longer period. The use of capacitor is for tuning the circuit, filtering the noise to ground, creating the timing pulse as in our case .The capacitors cannot be fabricated on ICs because of the technical difficulty. The capacitors are selected based on capacitance and voltage rating .Higher the voltage higher the size of the capacitor. These are available in following types

Electrolytic CapacitorThese capacitors have electrolyte as the dielectric between the two plates. These are available with polarity +and-. These are available with vertical mount or horizontal mount configuration.

Paper CapacitorThese capacitors are available in low range of capacitance. The

The Resistor Color CodeColor Black Brown Red Orange Yellow Green Blue Violet Grey White

Number 0 1 2 3 4 5 6 7 paper is used as dieletric media between the two plates.

8

9

Mica CapacitorThese capacitors are also available in low range of capacitance. The mica is used as dieletric media between the two plates.

Disc CapacitorDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 19

ATMEL INTEGRATED DEVELOPEMENT BOARD These are available from 1pF to 1ooooUF

BreadboardA breadboard is used to make up temporary circuits for testing or to try out an idea. No soldering is required so it is easy to change connections and replace components. Parts will not be damaged so they will be available to reuse afterwards. The photograph shows Breadboards have many tiny sockets (called 'holes') arranged on a 0.1" grid. The leads of most components can be pushed straight into the holes. ICs are inserted across the central gap with their notch or dot to the left. Wire links can be made with single-core plastic-coated wire of 0.6mm diameter (the standard size). Stranded wire is not suitable because it will crumple when pushed into a hole and it may damage the board if strands break off. Converting a circuit diagram to a breadboard layout is not straightforward because the arrangement of components on breadboard will look quite different from the circuit diagram. When putting parts on breadboard you must concentrate on their connections, not their positions on the circuit diagram. The IC (chip) is a good starting point so place it in the centre of the breadboard and work round it pin by pin, putting in all the connections and components for each pin in turn.

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 20

ATMEL INTEGRATED DEVELOPEMENT BOARD

Hardware Design PCB DesignTo design the circuit board following material are used. They are:

Express PCB software PCB Plate Screen Printing Etching of PCB with FeCl3

Thinner and Spreading of Soldering wire Drilling Soldering Express PCB SoftwareThis is software to design the circuit layout of our project. This software is divided in two part to design the layout

Express SCHDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 21

ATMEL INTEGRATED DEVELOPEMENT BOARD

Express PCB

Express SCHIn this part firstly we select all the components through the component manager and systematically join the component by the virtual wire according to the circuit diagram. Then we check the schematic for the netlist errors. when all the errors are corrected the schematic is ready.

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 22

ATMEL INTEGRATED DEVELOPEMENT BOARD

Express PCBAfter the schematic of the circuit diagram it is link to the EXPRESS PCB for ease of joining the circuit components according to their pin numbers. We repeat the process to select the components and their connections same as in Express SCH. The connections are based on colors shown in the figure. Green is used for the bottom copper layer; Red for the top copper layer and Yellow is for the components indication.

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 23

ATMEL INTEGRATED DEVELOPEMENT BOARD

PCB Plate:We take PCB plate of size 1515 cm2 and clean it by HARPIC cleaner to remove the oxide over the copper layer. Now the plate is ready for the screen printing of the Circuit layout.

Screen Printing:The print of the above circuit diagram is taken out on a Butter paper for its screen printing on the PCB plate. Nylon bolting cloth (Silk screen cloth) is stretched and attached to a wooden frame. Photosensitive chemical (silcot-6) and ammonium bicarbonate is spread on cloth and dried in total darkness. The screen is exposed to UV light and is developed in water.

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 24

ATMEL INTEGRATED DEVELOPEMENT BOARD

Etching of PCB with FeCl3There are many alternatives for etching liquids, and you can use the one that suits your taste. We use ferric chloride (the brown stuff): its cheap, can be reused many times, and doesnt require heating. Actually, moderate heating can speed up etching, but I find it reasonably fast also at room temperature (1015 minutes).For etching, we place the container on the floor (some scrap cardboard or newspaper to protect the floor from drops). We fit the board and submerge the PCB.

After EtchingDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 25

ATMEL INTEGRATED DEVELOPEMENT BOARD

Thinner and Spreading of Soldering wireA few drops of thinner (nail polish remover works well) on a pinch of cotton wool will remove completely the toner, bringing back the copper surface. Rinse carefully and dry with a clean cloth or kitchen paper. Trim to final size and refine edges with sandpaper.

DrillingWe use the electric drill and hand drill to drill the holes of the components on the PCB plate Under this operation drilling should be done as per circuit lay with the suitable drill and high speed machine. Drilling should always be done from copper side to avoid possibility of coming out of copper circuit and chipping out of Bakelite.

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 26

ATMEL INTEGRATED DEVELOPEMENT BOARD

COMPONENT ASSEMBLES:From the greatest variety of electronic components available today, which runs into tent of thousands of different types it is often a perplexing task to know which the right task for a given job is. There should be damage such as hair line crack intuit opera on PCB that could age a seriousfiec on the operational ability to the completed assemble. If there are than they can and should be repaired fiesta bye soldering a short link of bare copper wire over the affected part. Next will probably be the resistor small signal diodes of other similar size components some capacitor are very small but it would be best to fit these after words when fitting each group of components marks of each one on the components its as it is fitted and if we have to leave the job we know where to recommence. Although transistor & integrated circuit are small items there are good reasons for leaving the soldering of these until the last step the main pint is that these components are sensitive to heart and is subjected to prolonged application to the soldering iron they could be internally damaged. All the components before mounting are rubbed with sandpaper so that oxide layer is removed from their tips. Now they are mounted according to the components layout.

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 27

ATMEL INTEGRATED DEVELOPEMENT BOARD

SolderingAfter drilling the holes, the components are fitted on the PCBs through soldering A soldered connection ensures metal continuity. The soldering process involves: Melting of the flux which in turn removes the oxide films on the metal to be soldered. Melting the solder which removes the impurities. The solder partially dissolve of the metal in the connection. The solder cools and fuses wit the metal. The soldering techniques involves knowledge of : Soldering iron Soldering wire Soldering procedure Replacing components

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 28

ATMEL INTEGRATED DEVELOPEMENT BOARD

ConstructionFor the making the Integrated Development Board it is divide in the following module according to the individual task. The modules are: Power Supply Module Microcontroller Module Programmer Module STK200/300 JTAG SI Prog. Input and Output Module Push Switch LED panel External I/O Connector 7 SegmentsDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 29

ATMEL INTEGRATED DEVELOPEMENT BOARD Stepper Motor Control

Power Supply ModuleIn this module we design the power supply for the Microcontroller and Stepper motor controller and whole other module of the Development Board for the power supply the AC supply convert to the DC through the adapter. In the adepter the step down transformer are use to step down the voltage 230 V AC to 9 V AC the simple PN diode 1N14001 are use to rectify the current. The LM7805 are use to regulated the voltage this IC are use controlled the input 9Volt and provide the 5 volt constant out for the other next Circuit. In the voltage regulator the three capacitor are used between the input (pin1) and ground (pin2) and anather two are placed between the output(pin3) and ground(pin2)these capacitor are use to protect the circuit and LM7805 the simple pn junction diode 1N4001 are also use to protect the LM7805 voltage regulator

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 30

ATMEL INTEGRATED DEVELOPEMENT BOARD

Microcontroller ModuleThe Microcontroller module are the main circuit of the Integrated Development board this have a 40 pin DPI socket for the installing and removing the microcontroller after the processing on it the microcontroller module circuit are have four 8 pin I/O ports (SIP PIN), A six-pin header allows flash memory programming from an STK500 or Atmel Dragon. A

single 36 connection SIP machine-pin plug could be used to attach to another board or to a solder less breadboard. All 32 port pins, plus Vcc, Aref and ground, are available. The 16 MHz Crystal Oscillator is use to provide the clock pulse to microcontroller, 895

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 31

ATMEL INTEGRATED DEVELOPEMENT BOARD

Programmer Module STK200/300 JTAGAtmels AVR microcontroller chips are in-system programmable (ISP), i.e. these can be programmed directly in the target circuit. A special programmer software is used to download the program from the PC into the AVRs flash memory. Atmel offers a software package called the Atmel AVR ISP that allows programming of the AVR microcontrollers in the circuit using a simple dongle. Adongle is nothing but an adaptor cable that connects the PCs parallel port with the ISP pins of the AVR chip for programming. For programming, the four lines required from the AVR chip to the ISP adaptor (dongle) are: 1. MOSI (Master Out, Slave In): Data being transmitted to the AVR being programmed is sent on this pin2. MISO (Master In, Slave Out): Data received from the AVR being programmed is sent on this pin 3. SCK (Shift Clock): Serial clock generated by the programmer from the PC.4. RST (Reset): Reset (low pulse) generated by the program. The AVR is programmed while in reset state. Heres a dongle circuit for in-system programming of Atmels AVR chip AT90S8515 using suchDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 32

ATMEL INTEGRATED DEVELOPEMENT BOARD software packages as Atmel ISP 2.65 and PonyProg2000. Though not exactly the same, a similar dongle circuit can be found at the Website www.iready.org/ projects/uinternet/ispdongle.pdf. The PCs parallel-port pins 4 and 5 drive buffer IC 74LS244 by enabling its pins 19 and 1, respectively. A low pulse on these pins will allow the passing of the serial clock and data during programming. MOSI, LED, SCK and RST outputs are buffered from the parallel ports pins 7, 8, 6 and 9, respectively. The MISO input from the AVR is fed into pin 10 of the parallel port. IC 74LS244 (IC1) acts as a buffer as well as an isolator circuit when the AVR is not in programming mode. In idle mode, all the outputs are tristated so as not to affect the operation of the target system. When the AVRs ISP mode is selected, the lower half of IC 74LS244 is enabled, pulling the target systems Reset line low. Once the target system is in Reset mode, the SCK, MISO and MOSI lines are no longer loaded by the peripheral circuitry, if any, on the target system. Now, it is safe to enable the upper half of 74LS244, driving the MOSI, LED and SCK lines of the dongle. The RST pin becomes high after the AVR is programmed. Glowing of LED2 indicates that the AVR is in programming mode. There are two standard connectors for in-system programming of Atmel AVR microcontroller. One is the 10pin header (dual-in-line (DIL) connector)) used on the Atmel STK kits. The other is a 6-pin header (DIL connector) used in Atmel ISPs. The two loopback connections, pin 2-to-pin 12 and pin 3-to-pin 11 of the parallel port, are used to identify the dongle. With only pin 2-to-pin 12 link, the dongle is called STK300 or AVR ISP dongle. With only pin 3-to-pin 11 link, the dongle is called STK200 or old Kanda ISP dongle. With both links in place, the dongle is identified as a valueadded pack dongle. Here, weve used an 8-pin single-inline (SIL) connector and an additional 6-pin SIL connector for the Atmel programmer circuit. With the buffer and the 40-pin ZIF socket in this circuit, it can beused as a standalone programmer. The 6-pin SIL male connector is used for connection between the dongle and the AVR on the target board. Thus, another 6-line cable of about 30cm length is required for connecting this ISP adaptor (dongle) to the target circuit. If the AVR is not on the target circuit, you can insert the AVR into the ZIF socket and program it. Regulated 5V DC is required for the AVR and the associated dongle circuit, whose terminals are also provided in connector CON4. LED1 is used as the power indicator for the circuit.

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 33

ATMEL INTEGRATED DEVELOPEMENT BOARD

SI PROG This simple AVR Programmer will allow you to painlessly transfer hex programs to most ATMEL AVR microcontrollers without sacrificing your budget and time. It is more reliable than most other simple AVR programmers available out there and can be built in very short amount of time. AVR programmer consists of in-circuit serial programmer (dongle) and small pcb with a DIP socket where can fit microcontroller and have it quickly programmed. You may also use this programmer as a stand alone in-circuit serial programmer that can be used to conveniently program AVR microcontrollers without removing them from the target circuit. Entire AVR programmer has been build with using common parts and fits in the case of the serial connector. The socket pcb has been created to fit a 28-DIP AVRDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 34

ATMEL INTEGRATED DEVELOPEMENT BOARD ATmega8 microcontroller, but you can build a socket pcb for any other AVR microcontroller out there. This AVR programmer is compatible with a popular PonyProg software that shows you a status bar of the programming progress.

Input and Output Module Push SwitchIt is design to provide manually inverting and non-inverting input to the microcontroller, in that the three pin connector for controlled inverting and non inverting input the push switch are use to instantly controlled

LED panelDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 35

ATMEL INTEGRATED DEVELOPEMENT BOARD LED panel are use to check the output of the microcontroller. in its design 8 LED are connected in parallel the two 8 pin input port are use to interchange the input sequence in inverting and non-inverting mode. To change the configuration jumper are use

External I/O ConnectorThe 8 pin socket are use to connect the external input directly are connect to the microcontroller through 8 pin SIP

7 Segments

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 36

ATMEL INTEGRATED DEVELOPEMENT BOARD This 7 segment display works in two ways. one is inverting and other is noninverting which is controlled through the jumpers. the 74LS47 BCD to 7 SEGEMENT DECODER/ DRIVER are used to controlled the 7 segment display. Two 5 pin socket are use to change the 7segement or connect to externals 7segement

Stepper Motor ControlL298 are use to controlled the Bipolar Stepper motor are which is connected to the microcontroller through the 6 SIP pins. The L298 require extra 5 volt supply for drive the motor so use one LM7805 voltage regulator the general 1N4001 diode are use to maintain the voltage across the motor. The Stepper Motors are an alternative to DC motors. They offer something that DC motors don't, reliability. Their movement can be closely tracked by keeping count of how many times you step the motor. Each step is correlated to an angle of movement. The stepping angle depends on the motor but some are very precise, this is probably why stepper motors were used in early computer disc

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 37

ATMEL INTEGRATED DEVELOPEMENT BOARD drives.

Software ToolAvr software tools are use to program the microcontroller through the serial and parallel communication ports AVR Studio Code VisionDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 38

ATMEL INTEGRATED DEVELOPEMENT BOARD PonyProg2000

The software design for our system was implemented using a modular approach on both the ports of the system because of its efficiency and ease of implementation. However, we implemented 2 kinds of execution synchronizations on either side of the system. The ports of the system were synchronized using time counters. Each module in the Board executed after a predetermined specific interval of time using a base clock as a reference (that was implemented using a timer). The other port of the system completely asynchronously and its execution was dependent on the type of the software tools are use with particular microcontroller. The following paragraphs provide a brief description of the various software modules that were implemented on both the sides of the system.

AVR StudioAVR Studio 4 is a professional Integrated Development Environment (IDE) for writing and debugging AVR applications in Windows 9x/NT/2000/XP environments. This tutorial assumes that you have installed AVR Studio 4 on your computer. If you doDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 39

ATMEL INTEGRATED DEVELOPEMENT BOARD not have AVR Studio yet, you may obtain a copy of AVR Studio 4 from one of 3 places: Atmel Corporation: http://www.atmel.com AVR Freaks: http://www.avrfreaks.net Borrow a CD from your instructor This tutorial will guide you through the steps required for: Executing the AVR Studio 4 Integrated Development Environment (IDE), Typing in a program, Assembling the program, and Simulating a program The first program you will enter is shown below (Figure 1). This program will initialize the B and D ports on the ATMega128 AVR processor and then turn on a single LED connected to Port B, pin 0. ;======================================================== ;Project #1 ;Written by: Steve Kuyath ;Date: 5/21/2007 ;ver: 1.0 ;file: C:\Documents and Settings\Stephen Kuyath\My Documents\AVR\Pr1 ;Device: ATMega128 ;======================================================== .nolist .include .list ;=========================== ; Declarations .def temp =r16 ;=========================== ; Start Program rjmp InitDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

"C:\Program

Files\Atmel\AVR

Tools\AvrAssembler2\Appnotes\m128def.inc"

Page 40

ATMEL INTEGRATED DEVELOPEMENT BOARD ;============================ Init: ser temp out DDRB,temp out DDRD,temp clr temp out PortB,temp out PortD,temp ;============================ Start: sbi PortB,0 cbi PortB,0 rjmp Start Figure 1: LED On Program AVR Studio Assembler/Simulator Tutorial Step 1: Open AVR Studio 4 IDE. You should see the program banner shown below:

AVR Studio 4 Banner

Step 2: When IDE opens, you will see the programming and simulator environment as well as a requesting information: are you starting a new project or opening a saved project?DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 41

ATMEL INTEGRATED DEVELOPEMENT BOARD AVR Studio IDE

Step 3: Click on the New Project button:

Welcome Dialog Box AVR Studio Assembler/Simulator Tutorial Step 4: In the next dialog box, choose the Atmel AVR Assembler as the project type:DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 42

ATMEL INTEGRATED DEVELOPEMENT BOARD

Choose Atmel AVR Assembler Step 5: Type in a project name and the initial file name:

Type Project and Initial File Names Step 6: Click on the Next buttonDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 43

ATMEL INTEGRATED DEVELOPEMENT BOARD Step 7: Choose AVR Simulator for the Debug Platform and then scroll down the right window to choose the ATmega128 AVR processor

Choose Simulator and ATmega128 Step 8: Click on the Finish button. You should then see the IDE (you may have to maximize the editing window to see the same thing as shown in Figure) AVR Studio 4 IDE AVR Studio Assembler/Simulator Tutorial

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 44

ATMEL INTEGRATED DEVELOPEMENT BOARD Step 9: Type in the program as shown in Figure 1. Note the color-coded text. This is done automatically by the IDE and helps you to make corrections as you go.

Typed Program Step 10: When you have completed the program save it. It is also good practice to periodically save your program as you type. Step 11: Assemble your program. You may do this by selecting Build from the Build Menu or by striking the [F7] key:

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 45

ATMEL INTEGRATED DEVELOPEMENT BOARD Program Assembled Step 12: Continue assembling and correcting errors until the program assembles without error (note the green dot in the lower window and the comment that states: Assembly complete, 0 errors, 0 warnings) you are ready to simulate. Step 13: Simulate the program. To start the simulator you may choose Start Debugging from the Debug Menu or you may click on the arrow button as shown below:

Start Simulation Step 14: In the I/O View, open the I/O ATMEGA128, and the PortB views by clicking on the symbol.

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 46

ATMEL INTEGRATED DEVELOPEMENT BOARD

I/O Views Step 15: Single step through your program by striking the [F11] key:

FF sent to Data Direction Register B (all pins outputs)

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 47

ATMEL INTEGRATED DEVELOPEMENT BOARD

bit 0 set Note: The sbi PortB,0 (sbi is the set bit) instruction has been executed, although the pointer is pointing at the next instruction. So, bit 0 in PortB is set (equal to 1). It is important to note 2 things: 1. Pin 0 (PinB0) on PortB has not gone high yet, even though bit 0 in PortB is set. PinB0 will go high as the next instruction is executed 2. The instruction: cbi PortB,0 has not been executed yet. Step 16: Continue stepping through the program until you are sure that the program is executing as designed. Note: The next few screens may be a little confusing because the program sets bit 0 in PortB and then immediately clears bit 0 in PortB. The simulators shows this, but shows that bit 0 on PinB (the actual pin on the Atmega128) is one cycle behind bit 0 in PortB:

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 48

ATMEL INTEGRATED DEVELOPEMENT BOARD

PinB0 is high

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 49

ATMEL INTEGRATED DEVELOPEMENT BOARDPinB0 is low

Code Vision IntroductionThe purpose of this application note is to guide the user through the preparation of an example C program using the CodeVisionAVR C Compiler. The example, which is the subject of this application note, is a simple program for the Atmel Atmega32 microcontroller on the STK200 starter kit.

PreparationInstall the CodeVisionAVR C Compiler in the default directory (C:\cvavr), and the Atmel AVR Studio debugger in the default directory (C:\Program Files\Atmel\AVRTools\AVR Studio4). Set up the starter kit according to the instructions in the STK500 User Guide. Make sure that the power is off before inserting the ATmega8515 chip into theDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 50

ATMEL INTEGRATED DEVELOPEMENT BOARD appropriate socket (marked SCKT3000D3). Set the VTARGET, RESET, and XTAL1 jumpers. Also, set the OSCSEL jumper between pins 1 and 2. Connect one 10-pin ribbon cable between the PORTB and LEDs headers to allow for the state of ATmega8515s PORTB outputs to be displayed. Then connect one 6-pin ribbon cable between the ISP6PIN and SPROG3 headers. This will allow the CodeVisionAVR IDE to automatically program the AVR chip after a successful compilation, if the programmer is correctly configured. To configure the programmer, start the CodeVisionAVR IDE and select the SettingsProgrammer menu option. The dialog window shown in Figure 2-1 will open. Programmer Settings.

Set the AVR Chip Programmer Type to Atmel STK200/AVRISP, and the Communication Port to the one used with the STK200 starter kit on your system. In order to be able to invoke the AVR Studio debugger from within the Code Vision AVR IDE, the location of AVR Studio must be set. To do this, select the Settings Debugger menu option. The dialog window as shown in Figure 2-2 will open. Debugger Settings.

Select C:\Program Files\Atmel\AVRTools\AVR Studio4\AvrStudio.exe using the button, then press the OK button to confirm. Creating a New ProjectDEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 51

ATMEL INTEGRATED DEVELOPEMENT BOARD In order to create a new project, select the FileNew menu option or press the toolbar button. The dialog window shown in Figure will be displayed. New Project Dialog.

Select Project, press OK, and the dialog window shown in Figure 3-2 will be displayed. Confirmation Dialog.

Press Yes to use the CodeWizardAVR Automatic Program Generator, and the dialog window shown in Figure will open. Using the CodeWizardAVR Automatic Program Generator The CodeWizardAVR simplifies the task of writing start-up code for different AVR microcontrollers. Configuring the Chip and Clock Settings For this example project, we shall use the Atmega32 microcontroller and the clock rate 16 MHz, since that is the clock rate on the STK200 starter kit. The resulting settings window is shown in FigureChip Settings for Code Wizard AVR

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 52

ATMEL INTEGRATED DEVELOPEMENT BOARD

Configuring the Input/output Ports Select the Ports tab to determine how the I/O ports are to be initialized for the target system. The default setting is to have the ports for all the target systems set as inputs (Data Direction bits to be all 1s) in their Tri-state mode. However, for this example project, we want to set Port B (by selecting the Port B tab) to be output only. This is done by setting all the Data Direction bits to Out (by clicking on them). We also set the Output Values to be all 1s, which will cause the LEDs on the STK500 to initially be turned off. The resulting settings window is shown in Figure 5-1. Port Settings for CodeWizardAVR.

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 53

ATMEL INTEGRATED DEVELOPEMENT BOARD

Configuring Timer1Select the Timers tab to set up the behaviour of the timers. For this project, we want to configure Timer1 to generate overflow interrupts as shown in Figure. We have selected a clock rate of 3.594 kHz, which is the system clock of 3.68 MHz divided by 1024. The timer is set to operate in the default Normal Top=FFFFh mode and to generate interrupts on overflow. To be able to update the LEDs twice per second, we need to reinitialize the Timer1 value to 0x10000-(3594/2) = 0xF8FB on every overflow. Timer Settings for CodeWizardAVR.

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 54

ATMEL INTEGRATED DEVELOPEMENT BOARD

Completing the ProjectBy selecting the File Generate, Save and Exit menu option, the CodeWizardAVR will generate a skeleton C program with, in this case, Port B and Timer1 Overflow Interrupt set up correctly. A dialog window for saving the source code, shown in Figure , will then open. Save Source File Dialog.

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 55

ATMEL INTEGRATED DEVELOPEMENT BOARD

Create a new folder named C:\cvavr\led to hold all the files of our sample project. Open this directory, enter the file name of the C source file, led.c, and press the Save button. A dialog window for saving the project file, shown in Figure 7-2, will open.

Save Project Dialog. Here, specify the file name for the project, led.prj, and save it in the same folder as the C file (C:\cvavr\led). Finally, we will be prompted to save the CodeWizardAVR project file, as shown in Figure 7-3. Saving all the CodeWizardAVR peripherals configuration in the led.cwp project file will allow us to reuse some of our initialization code in future projects.Save CodeWizardAVR Project

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 56

ATMEL INTEGRATED DEVELOPEMENT BOARD

Save CodeWizardAVR Project Dialog.

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING R.K.D.F. COLLEGE OF ENGINEERING, BHOPAL

Page 57

ATMEL INTEGRATED DEVELOPEMENT BOARD

Specify the file name led.cwp and press the Save button. The led.c source file will now automatically be opened, and we may start editing the code produced by the CodeWizardAVR. In this example project, only the interrupt handler code needs to be amended to manage the LEDs. This is shown below. The small bit of code that was added is shown with bold font, while the remainder was supplied by the CodeWizardAVR. // the LED 0 on PORTB will be ON unsigned char led_status=0xFE; // Timer 1 overflow interrupt service routine interrupt [TIM1_OVF] void

timer1_ovf_isr(void) { // Reinitialize Timer 1 value TCNT1H=0xF8; TCNT1L=0xFB; // Place your code here // move the LED led_status