Getting started with AVR mega16 Kit Elecrom January 21, 2008; Updated On: January 21st, 2008 2 Objective : This article explains how to get acquainted with mega16 kit. We will see how to run default demo program and understand board features. Know your kit Here is how mega16 Kit looks .Kit comes with following items : – mega16 development board with all components mounted. – 2 wire power supply connector – ISP cable (5 wire) – Serial cable (3 wire) – one 8 Pin and two 4 Pin connectors – Free CD : contains sample programs, datasheets, evaluation version of compiler, uC burning software and other documents. – copy of circuit diagram, board layout (also included on CD) Take out all items from the box and keep them on your table. Now lets see each item one by one. mega16 development board : Board has mega16 AVR inserted into ZIF socket. It also has two Motor drivers (L293D) and serial driver (MAX232). For list of all features please refer to other post on blog. 2 wire power supply connector: Use this to give supply to the board. Board input supply should be between 8v to 20v. While connecting this to your power supply make sure that red wire is connected to +ve supply terminal and black wire is connected to -ve supply terminal. When you insert connector onto board make sure that, black wire is near edge of the board and keep power switch in OFF position as shown: ISP cable: Board supports in system programming (ISP). Means you don’t have to take uC out in order to program it. You can just keep it on board and program it. ISP cable connects to printer port (cable connecting to serial port is also available in case your PC doesn’t have printer port). In order to program Microcontroller : you have to give supply to the board, connect ISP cable to printer port, and then insert other end on to board by keeping yellow mark towards crystal as shown : Refer following link to know how to download HEX file into uC using PonyProg2000: http://omkarck.blogspot.com/2007/10/make-your-own-ultra-simple-universal.html Serial cable: Board has MAX232 serial driver. Serial cable is used to connect uC’s UART to PC’s serial port (through max232). MAX232 act as a level translator. This cable has 3 pins Tx,Rx,GND. If you want to use UART, connect one end of serial cable to comm port of PC, connect other end to the board by keeping yellow mark towards downside of the board as shown : You can use, serial port listener provided on CD or CodeVisionAVR’s Terminal tool to view data received on comm port of PC. 8 Pin and 4 Pin connectors : These connectors are provided to easily tap uC’s pins and use them to connect other circuit on bread board or other pcb. Free CD : CD contains following material : – CodeVisionAVR C compiler Evaluation version – PonyProg2000 – Sample code ( board test program, simple line follower, sound generation, etc) – Datasheets of all major components on board – Many application notes from AMTEL – Copy of circuit diagram and board layout – More material will be added in future and the same will be made available for download. Circuit Diagram: Have a look at this circuit diagram before going ahead. It may look slightly complicated at first, but it is quite straight forward. Board layout: This will help you to get quick idea of interconnections of different ICs/components on board. Keep it handy while doing programming. Running Demo program Kit comes with board test program burned into uC. We will run it and observe its output . Keep power supply switch off and insert power supply connector to board as shown above. Connect small jumper wire from PD.2 to speaker connector. Skip, if you don’t want to hear a ‘beep’ or don’t have wire available. Connect serial cable to comm port of PC and to the board. Connect DC motor(s) to L293D outputs DRV and DRV1. Refer board layout sheet. Give any DC voltage between 0 to 5V to input pins of ADC. OR use jumper and short pin1 and pin2 of RS1. You can also repeat same for remaining RSx connectors. This will be used for testing ADC. You can rotate corresponding preset to change divider ratio. This will in-turn change actual input to ADC. Install CodeVisionAVR and start it. -Go to settings>Terminal. -Set Port to COM1 (or whatever applicable in your system). -Set baud rate to 56000. -Other settings should be as shown. -Click OK. -Open Tools>Terminal. Give 12V (or at least 8V) supply and then turn power switch ON. Following things should happen. – supply LED glows. – debugging LEDs will start glowing one after another and all LEDs will be on at the end. – PB.7 Led will flash at 1Hz frequency from thereafter. – L293D – 1 outputs (connector DRV) will be turned for 3 Sec, with following states : pin 1 = 0; pin 2= 1; pin 4=1; pin5=0; -after 3 seconds outputs will change states and will remain in same state for next 3 seconds. pin 1 = 1; pin 2= 0; pin 4=0; pin5=1; -same sequence will repeat for L293D – 2 -ADC inputs will be read and converted into millivolts and will be sent to serial port. This will repeat 3 times. -After this program stops. Press RESET button to restart demo. While all above things are happening you will also see text messages in Terminal window of CVAVR. It will read as follows : Mega16 development board for robotics Speaker demo … done LED Test … done L293D Test … done ADC Test … CH 0: 000 => 2139 mV CH 1: 000 => 0000 mV CH 2: 000 => 0000 mV CH 3: 000 => 0000 mV CH 4: 000 => 0000 mV CH 5: 000 => 0000 mV CH 0: 000 => 2138 mV CH 1: 000 => 0000 mV CH 2: 000 => 0000 mV CH 3: 000 => 0000 mV CH 4: 000 => 0000 mV CH 5: 000 => 0000 mV CH 0: 000 => 2139 mV CH 1: 000 => 0000 mV CH 2: 000 => 0000 mV CH 3: 000 => 0000 mV CH 4: 000 => 0000 mV CH 5: 000 => 0000 mV # DONE. Great. You have just got acquainted with the kit. Now you can start experimenting with it on your own. If you have any doubt/query, post comment.