avr dev brd user manual

Upload: vipul-mistry

Post on 14-Jan-2016

233 views

Category:

Documents


3 download

DESCRIPTION

AVR DATA MANUAL

TRANSCRIPT

  • PROVOTECH Sense. Innovate. Educate

    For further enquiry please email us at [email protected]

    AVR Development Board

    Package Contents:

    Development Board

    16*2 LCD (as per order)

    ATMEGA16 microcontroller (as per order)

    Xbee Module (as per order)

  • PROVOTECH Sense. Innovate. Educate

    For further enquiry please email us at [email protected]

    Features:

    Supply Voltage: 7V to 15V DC

    Powerful Atmega16/32 microcontroller supports On board features:

    Motor Driver

    Stepper Motor Driver

    Four general purpose LEDs and Switches

    16*2 LCD

    Two seven-segment LED Display

    5 Voltage Regulator

    Sensor interface port (PORTA)

    Programming interface(PROG)

    POT for ADC

    POT for LCD Contrast

    Buzzer

    Relay

    MAX 232 with serial connector(DB9)

    XBee interface provision

    4*4 Keypad Matrix interface provision

    Break-out of I2C, SPI, Display, Motor, Switch, LED, XBee

  • PROVOTECH Sense. Innovate. Educate

    For further enquiry please email us at [email protected]

    Pinout:

    DC IN JACK: DC Input for Microcontroller.

    Power enable switch: This is power enable switch to Turn ON or Turn OFF board.

    Power LED: Board power indicator LED.

    Sensor Port: Provision to connect 8 sensors, also facilitates the extern sensor to get +5V power from VCC and GND.(PORTA.0 to PORTA.7)

    VOUT: Unregulated output.

  • PROVOTECH Sense. Innovate. Educate

    For further enquiry please email us at [email protected]

    General purpose switches: 4 general purpose switch which can be used as input, (in active low configuration).

    General purpose LED: 4 general purposes LED (in active low configuration)

    16*2 LCD interface: 16 pin male connector for connecting 16*2 LCD.

    LCD Contrast potentiometer: To adjust the contrast of LCD.

    Buzzer: onboard general purpose buzzer to generate audible tones.

    Reset switch: to reset the microcontroller.

    Programming interface: Programming pins of the microcontroller through male FRC connector.

    SPI and I2C break-out.

    Microcontroller PINOUT:

    Peripheral connected Microcontroller PORT

    SENOR 1 TO SENSOR 5 PORTA.0 TO PORTA.5

    SENSOR 6/RELAY PORTA.6 SENSOR 7/BUZZER PORTA.7

    LED1 TO LED4(ACTIVE LOW) PORTB.0 TO PORTB.3 SPI CONNECTOR PIN 6 PORTB.4 SPI CONNECTOR PIN 3 PORTB.5 SPI CONNECTOR PIN 4 PORTB.6

    SPI CONNECTOR PIN 5 PORTB.7

    LCD DATA PINS/ INPUT TO 7447

    PC.0 TO PC.3

    LCD ENABLE/ ENABLE OF 7 SEGMENT LED1

    PC.4

    LCD RS/ ENABLE OF 7 SEGMENT LED2

    PC.5

  • PROVOTECH Sense. Innovate. Educate

    For further enquiry please email us at [email protected]

    SWITCH3(ACTIVE LOW) PC.6 SWITCH4(ACTIVE LOW) PC.7

    RX/XBee DOUT PD.0 TX/XBee DIN PD.1

    SWITCH1(ACTIVE LOW) PD.2 SWITCH2(ACTIVE LOW) PD.3

    MOTOR 1 IN PD.4 MOTOR 2 IN PD.5 MOTOR 3 IN PD.6 MOTOR 4 IN PD.7

    Active Low LED: LEDs are connected in Active LOW configuration so to turn ON the LED user has to apply logic low (0) signal at the LED PIN and to turn OFF the LED apply logic high (1) signal at the LED pin.

    Active Low Switches: Switches are connected in Active LOW configuration when switch is pressed it will read logic low (0) at the switch PIN and when not pressed will read logic high (1). Jumper setting:

    JP1 Pin 2 and 1 7 segment LED VCC Pin 2 and 3 LCD VCC

    JP2 Pin 2 and 1 L293D power supply Pin 2 and 3 ULN2003 power supply JP3 Pin 2 and 1 Relay connection

    Pin 2 and 3 ADC7 JP4 Pin 2 and 1 Buzzer Pin 2 and 3 ADC6

  • PROVOTECH Sense. Innovate. Educate

    For further enquiry please email us at [email protected]

    Legent file:

    Pin out Description:

    SD Card Module Pin 1 3.3V Pin 2 GND

    Pin 3 MOSI (Master out slave in) Pin 4 MISO (master in slave out) Pin 5 SCK (Serial clock) Pin 6 SS (slave select)

  • PROVOTECH Sense. Innovate. Educate

    For further enquiry please email us at [email protected]

    I2C Pin 1 GND

    Pin 2 SCL Pin 3 SDA

    UART Pin 1 GND

    Pin 2 RX Pin 3 TX

    4*4 KEYPAD Matrix Pin 1 VCC Pin 2 GND Pin 3,5,7,9 PORTA.0 to PORTA.3 Pin 10,8,6,4 PORTA.7 to PORTA.4

  • PROVOTECH Sense. Innovate. Educate

    For further enquiry please email us at [email protected]

    Programming AVRoN16 development board:

    To start programming the AVRoN16 Board first we will need the compiler

    which will translate the higher level c code to the hex code which can be

    recognize by the microcontroller (microcontroller only understands hex code)

    and a burner which will transfer the hex code generated from the computer to

    the microcontroller program memory.

    There are ample of free softwares available for AVR microcontroller

    programming like AVRStudio (compiler), PonyProg (burner) ,Win-Avr (compiler

    + burner) etc.

    For programming the AVRoN16 board we are going to use WinAvr software

    Software installers:

    Free version of the software package is provided in the CD.

    Install the software before proceeding.

    To start writing a c code, first launch programmers notepad application of

    WinAvr from computers start menu.

    StartAll ProgramsWinAvrProgrammer Notepad [WinAvr]

    Create new file by selecting

    FileNewDefault or by simply using the keyboard shortcut keys Ctrl+N

  • PROVOTECH Sense. Innovate. Educate

    For further enquiry please email us at [email protected]

    Now write the program in the file and save the file with .c (filename.c)

    extension in the folder. (For different programs use different folders)

  • PROVOTECH Sense. Innovate. Educate

    For further enquiry please email us at [email protected]

    Now to compile the code we will be need the Makefile, you can

    find the Makefile in the sample code folder from the CD provided.

    Copy the Makefile to the Project folder where we saved the .c file. (User has

    to keep both the .c file and Makefile in same folder)

    NOTE: Do not rename the Makefile and dont give any extension to file.

    Now open the Makefile in programmers notepad.

    User has

    to

    configure the Makefile for the target microcontroller. Following are the

    configuration settings:

    1. #MCU name : Here write the name of target microcontroller , in AVRoN16

    we are using ATMEGA16 so the name will be MCU=atmega16

  • PROVOTECH Sense. Innovate. Educate

    For further enquiry please email us at [email protected]

    2. Select the clock frequency F_CPU, select the clock frequency applied to the

    microcontroller, in our case the microcontroller is supplied with onboard

    16MHz crystal so the F_CPU will be

    F_CPU=16000000

    3. FORMAT: Select the output format as ihex (intel hex)

    FORMAT = ihex

  • PROVOTECH Sense. Innovate. Educate

    For further enquiry please email us at [email protected]

    4. TARGET: Here write the filename without any .c extension.

    5. Fuse Setting: user can perform different settings, fuse bit determines the

    behavior of the chip, whether it has a boot loader, watchdog timer

    conditions, clock speed definitions etc. so that user can configure the chip

    in accordance with their requirement.

    NOTE: Read the microcontroller datasheet before changing the fuse bits as

    playing with fuse bits may damage the microcontroller permanently.

    Following is the recommended fuse setting for atmega16.

  • PROVOTECH Sense. Innovate. Educate

    For further enquiry please email us at [email protected]

    6. Programming options: This section defines the programming interface for

    the microcontroller.

    AVRDUDE_PROGRAMMER = ponyser (when using serial ISP programmer

    for programming)

    = usbasp (when using USBASP programmer for

    programming)

    AVRDUDE_PORT = com1 (when using serial ISP programmer for

    programming)

    = usb (when using USBASP programmer for

    programming)

  • PROVOTECH Sense. Innovate. Educate

    For further enquiry please email us at [email protected]

    Once the Makefile is configured with above setting, user

    can now compile the c code and load the hex file on

    microcontroller. Follow the steps below to compile and

    load the code on microcontroller.

    Step 1 : Select Tools tab from the winAVR window, in

    Tools click on [winAVR] Make Clean and check out

    the output window for any issues. If output window is

    displaying

    >process Exit Code: 0 then make clean is successful.

    Step 2: Now we will compile the C-code to generate the

    hex file.

  • PROVOTECH Sense. Innovate. Educate

    For further enquiry please email us at [email protected]

    Select Tools tab from the winAVR window, in Tools click on [winAVR]

    Make All and check out the output window for any errors in code. If output

    window is displaying

    >process Exit Code: 0 then make All is successful.

    After successful compilation we are ready to load the hex code from computer

    to the microcontroller program memory.

    Follow following steps to load the code on microcontroller.

    1. Power On the board.

    2. Connect the programmer interface to the board (Serial ISP programmer or

    USBASP programmer. Etc) in case of ISP serial programmers make sure that the

    switch is not pressed on the programmer board.)

    3. Make sure that hyper terminal program is closed. (In case of serial ISP

    programmer if hyper terminal is open while programming you will get error as:

    avrdude: ser_open(): can't open device "com1": Access is denied.)

    4. Now click on Tools and select [winAVR] Program to transfer the code

    from computer to microcontroller, after successful loading of the code on

    microcontroller the output window will display the following message.

    > process Exit Code: 0

  • PROVOTECH Sense. Innovate. Educate

    For further enquiry please email us at [email protected]

  • PROVOTECH Sense. Innovate. Educate

    For further enquiry please email us at [email protected]

    Sample code:

    Program to Blink LED: /* Program to blink LED*/ #include // Header file for IO operations #include //HEader file for using inbuilt delay function ////////MICRO DEFINITIONS/////////// #define bit(p) (1