Vx Mega128 e

Embed Size (px)

Citation preview

  • 7/31/2019 Vx Mega128 e

    1/22

    VX-Mega128 : ATmega 128 Mic roc ontroller boa rd d oc umenta tion 1

    VX-Mega128

    ATmega128 Mic rocontroller board

    1. Features

    Sup port the ATmeg a128 with Flash mem ory of 128KB. Cloc k rate 14.7456MHz

    34 I/ O p ort of microc ontroller are using INEXs standard PCB-3 p in co nnec tor.

    LCD16x2 module

    4 of Button switches

    Binary Switc h

    USB po rt w ith FT232RL USB to Seria l c onverter c irc uit.

    ATmega 128 pre-prog ram med Boot loader, prog rammable via USB po rt.

    8-ch. Analog input with 10-bit Analog to Digital Converter

    32KB RAM / 32KB EEPROM mem ory module p lug on top

    Support In-system Programming via ISP connec tor with PX-400 Programmer

    Supply voltage +9V from external. +5V 500mA o n-board regulato r.

    Inc ludes : ATmeg a128 Mic roc ontroller board, Pluga ble Memory module, USB cab le, CD-

    ROM and Documentation.

  • 7/31/2019 Vx Mega128 e

    2/22

    VX-Mega128AVR MicrocontrollerPart 1 : Main section

    4

    IC2

    ATMEGA128-16

    3V317

    Vcc

    C20.1F16V

    TES26

    AGN25

    GND7

    GND18

    GND21

    1TxD

    5RxD

    32PD7 (T2)

    55

    54

    57

    56

    59PF2 (ADC2)

    58PF3 (ADC3)

    61PF0 (ADC0)

    60PF1 (ADC1)

    PF6 (ADC6/TDO)

    PF7 (ADC7/TDI)

    PF4 (ADC4/TCK)

    PF5 (ADC5/TMS)

    GND

    SDA

    RD

    A9

    A11

    A13

    A15

    ALE

    AD6

    AD4

    AD2

    AD0

    +5V

    GND

    SCL

    WR

    A8

    A10

    A12

    A14

    RST

    AD7

    AD5

    AD3

    AD1

    +5V

    +5V

    WR

    RD

    A15

    A14

    A13

    A12

    A11

    A10

    A9

    A8

    AD7

    AD6

    AD5

    AD4

    AD3

    AD2

    AD1

    AD0

    ALE

    +5V

    AVcc

    GND

    ADC0

    ADC2

    ADC4

    ADC6

    64AVcc

    62AREF

    +5V

    PD0(SCL/INT0)

    PD1(SDA/INT1)

    PD2(RXD1/INT2)

    PD3(TXD1/INT3)

    PD4(ICP1)

    +5V

    PB5(PWM5)

    PB6(PWM4)

    PB7(PWM3)

    PE3(PWM2)

    PE4(PWM1)

    PE5(PWM0)

    R547

    18

    19

    RTCX1

    RTCX2

    XTAL232.768kHz

    23

    24

    X1

    X2

    XTAL114.7456MHz

    PG0(WR)

    PG1(RD)

    PC7(A15)

    PC6(A14)

    PC5(A13)

    PC4(A12)

    PC3(A11)

    PC2(A10)

    PC1(A9)

    PC0(A8)

    PA7(AD7)

    PA6(AD6)

    PA5(AD5)

    PA4(AD4)

    PA3(AD3)

    PA2(AD2)

    PA1(AD1)

    PA0(AD0)

    PG2(ALE)

    33

    34

    42

    41

    40

    39

    38

    37

    36

    35

    43

    44

    45

    46

    47

    48

    49

    50

    51

    EN

    AD0

    AD1

    AD2

    AD3

    AD4

    AD5

    AD6

    AD7

    R/WR

    SVee

    Vcc

    GND

    LCD Module

    16 Char. x 2 Lines

    31PD6 (T1)

    30PD5 (XCK)

    65 10

    7 12

    11

    14

    13

    PE4(OC3B/INT4)

    PE3(OC3A/AIN1)

    PB0(SS)

    PE5(OC3C/INT5)

    PB2(MOSI)

    PB1(SCK)

    PB4(OC0)

    PB3(MISO)

    16

    15

    17

    PB6(OC1B)

    PB5(OC1A)

    PB7(OC2/OC1C)

    23

    PE0(RXD0/PDI)

    PE1(TXD0/PDO)

    1

    PEN

    PB0(SS)

    PB1(SCK)

    PB2(MOSI)

    PB3(MISO)

    PB4(OC0)

    29PD4 (ICP1)

    28

    27

    26

    25

    PD3 (TxD1/INT3)

    PD2 (RxD1/INT2)

    PD1 (SDA/INT1)

    PD0 (SCL/INT0)

    RST20

    RST

    C722pF

    R92.2k

    R82.2k

    VR110kLCD

    CONTRAST

    +5V

    21

    Vcc

    52

    Vcc

    GND22

    GND53

    GND63

    +5V

    R610k

    (Optional)

    to I/O section

    R710k

    +5V

    S1

    RESET

    K3

    ISP : In-SystemProgramming

    PORT

    GND

    Vcc

    GND

    GND

    GNDMISO

    MOSI

    RST

    SCK

    C10.1F16V

    C30.1F16V

    C40.1F16V

    JP1AVcc

    K2ADC po

    C50.1F16V

    C60.1F16V

    C822pF

    C90.1F16V

    DSP1K4

    ATmega128EXPANSION BUS

    Figure1

    Microcontrollerscetiob

    sche

    matiucdiagramofVX-M

    ega128board

  • 7/31/2019 Vx Mega128 e

    3/22

    VX-Mega128 : ATmega 128 Mic roc ontroller boa rd d oc umenta tion 3

    +5V

    Y0

    Y1

    Y2

    Y3

    Y4

    8

    A0

    A1

    A2

    CS35

    3

    2

    1

    11

    12

    13

    14

    15

    0xF800 WR - PORT D.OUT

    0xF400 RD

    0xF400 WR

    0xF000 RD

    16

    0xF000 WR

    IC374AC138

    Y5

    Y6

    Y77

    910 0xF800 RD - PORT D.IN

    0xFC00 WR

    0xFC00 RD - SWITCH

    R12-R19

    150 x 8

    2

    3

    4

    5

    6

    7

    8

    9

    19

    18

    17

    16

    15

    14

    13

    12

    D0

    D1

    D2

    D3

    D4D5

    D6

    D7

    Q0

    Q1

    Q2

    Q3

    Q4Q5

    Q6

    Q7

    11 1LE OE

    IC574AC573

    10GND

    +5V

    20

    D.IN0

    D.IN1

    D.IN2

    D.IN3

    D.IN4

    D.IN5

    D.IN6

    D.IN7

    R1010k*8

    +5V

    D.OUT0

    D.OUT1

    D.OUT2

    D.OUT3

    D.OUT4

    D.OUT5

    D.OUT6

    D.OUT7

    +5V

    2

    3

    4

    5

    6

    7

    8

    9

    18

    17

    16

    15

    14

    13

    12

    11

    I0

    I1

    I2

    I3

    I4I5

    I6

    I7

    D0

    D1

    D2

    D3

    D4D5

    D6

    D7

    1OE1

    IC474AC541 19

    OE210

    GND

    +5V

    20

    SW1

    2

    3

    4

    5

    6

    7

    89

    18

    17

    16

    15

    14

    13

    1211

    I0

    I1

    I2

    I3

    I4

    I5

    I6

    I7

    D0

    D1

    D2

    D3

    D4

    D5

    D6

    D7

    1OE1

    IC674AC541

    19OE2

    10GND

    +5V

    20

    1

    4

    3

    6

    D0

    D1

    D2

    D3

    2

    5C0

    C1

    R2010k*8S2

    BINARY

    SWITCH

    AD0

    AD1

    AD2

    AD3

    AD4

    AD5

    AD6

    AD7

    AD0

    AD1

    AD2

    AD3

    AD4

    AD5

    AD6AD7

    AD0

    AD1

    AD2

    AD3

    AD4

    AD5

    AD6

    AD7

    R1110k*8

    31

    2

    89

    10

    A12

    A13

    6

    4

    5

    RD

    WR CS16

    CS24

    1112

    13

    A14

    A15

    +5V

    14

    7IC4

    74AC00

    WR

    A10

    A11

    to MAIN section

    IC778R05

    J1

    DC.input6-12V

    C151000F

    6.3V

    +5V

    S3

    ONBD1

    1A50V

    GND

    OUT

    IN SHDN

    LED3

    POWER

    R21510

    VX-Mega128AVR MicrocontrollerPart 2 : I/O sectionand power supply

    C10

    0.1F50V

    IC4/1

    IC4/2

    IC4/3

    C110.1F

    50V

    C13

    0.1F

    50V

    C12

    0.1F

    50V

    IC4/4

    R12

    R13

    R14

    R15

    R16

    R17

    R18

    R19

    SW2 SW3 SW4

    C14

    220F

    25V

    C16

    220F25V

    Figure 2 I/O port and external device interface schematic diagram of VX-Mega128 microcontroller board

    2 . C irc u it a nd M e m ory m a p

    The VX-Meg a128 mic roc ontroller board schem atic d iagram is sp lited to 3 sec tions.

    The microc ont roller sec tion sc hem atic d iagram is show n in figure 1. Input/ Output port

    and external device interface schematic diagram is shown in figure 2 and figure 3 shows

    the circuit of Memory extension module.

  • 7/31/2019 Vx Mega128 e

    4/22

    4VX-Mega128 : ATmega 128 Microc ontroller boa rd d oc umenta tion

    ATme ga 128 op erates with c loc k freq uenc y 14.7546MHz from external c rysta lc ircuit. The c rysta l 32.768kHz is connec tede to ATmeg a128 for set ting the c lock freq uenc y

    to support internal Rea l-time counte r. Supp ly voltag e +5V comes from external DC a daptor

    +9V (+16V ma ximum) via +5V reg ulator c irc uit with 78R05 ICs.

    VX-Meg a 128 sup p orts b ot h in Sing le c hip m icroc ont rol ler mo d e a nd

    Microp roc essor mo d e. ATme ga 128 interfac es with a ll external d evice via a d d ress

    assignment. In figure 4 shows the memory and I/O map of VX-Mega128 board.

    External device tha t c onnec ted with ATmega 128 are a ssigned in a ddress F000H

    to FFFFH inc luded :

    (1) LC D m od ule 16x2 : connec t 8-bit data bus with AD0 to AD7 of ATmega 128.

    It causes reading and writing via data bus instead direct interface.

    (2) 4 of Input Switches (SW1 to SW4) : address at upper nibble of FC00H.

    Signa l is buffered via 74AC541 IC.

    (3) 4-bit binary Switch : trhis switch g ives 4 bina ry bits. It mea ns 16 d ifferent

    da ta 0000 to 1111 in binary base o r 0 to 15 in dec ima l and 0 to F in HEX. Data from Binary

    switch are tranfered to data bus ; AD0 to AD3 via 74AC541 buffer IC and assigned at

    lowewr nibble of FC00H.

    GND

    SDARD

    A9

    A11

    A13

    A15

    ALE

    D6

    D4

    D2

    D0

    +5V

    GND

    SCLWR

    A8

    A10

    A12

    A14

    RST

    D7

    D5

    D3

    D1

    +5V

    A0

    A1

    A2

    A3

    A4

    A5

    A6

    A73

    4

    5

    6

    7

    8

    9

    10

    A8

    A9

    A10

    A11

    A122

    23

    21

    24

    25

    19

    18

    17

    16

    15

    13

    12

    11

    27WR

    OE22

    D7

    D6

    D5

    D4

    D3

    D2

    D1

    D0

    CE20

    A13

    A141

    26

    12

    +5V

    24

    +5V

    D0

    D1

    D2

    D3

    D4

    D5

    D6

    D7

    11LE

    20

    OE

    1 10

    Q0

    Q1

    Q2

    Q3

    Q4

    Q5

    Q6

    Q712

    13

    14

    15

    16

    17

    18

    19

    A7

    A6

    A5

    A4

    A3

    A2

    A1

    A0

    9

    8

    7

    6

    5

    4

    3

    2

    AD7

    AD6

    AD5

    AD4

    AD3

    AD2

    AD1

    AD0

    IC974AHC573

    IC10SRAM62256

    (32K x 8bit)

    A0

    A1

    A2

    A3

    A4

    A5

    A6

    A7

    A8

    A9

    A10

    A11

    A12

    WR

    RD

    A15

    A13

    A14

    ALE

    AD7

    AD6

    AD5

    AD4

    AD3

    AD2

    AD1

    AD0

    K4ATmega128

    EXPANSION BUS

    +5V

    +5V

    A0

    A1

    A2

    WP

    8

    Vcc

    SCL

    SDA5

    6

    7

    3

    2

    1

    GND4

    IC824C256

    (32K x 8bit)

    C18

    0.1F50V

    C190.1F50V

    C170.1F50V

    Figure 3 Data memory extension module schematic diagram

  • 7/31/2019 Vx Mega128 e

    5/22

    VX-Mega128 : ATmega 128 Mic roc ontroller boa rd d oc umenta tion 5

    Also the digital input and output port of VX-Mega128 board are assigned via

    address map system as follows :

    Digital input port D.IN0 to D.IN7 are assigned at F800Haddress.

    Digita l outpu t po rt D.O UT0 to D .O UT7 are assigned at F800H address too.

    but active with WR signal insterad.

    All interface port include Analog to Dital converter module input are connect to

    INEX 3-pin PCB connector. User can connect with INEX many sensors and modules.

    VX-Mega128 board supports 8-channel of Analog to digital converter. User can

    select supply voltage and reference for ADC module with 2 jumpers JP1 and JP2. If fit

    all, selects ADC module to use supply and reference voltage at +5V. If remove all, user

    c an ap ply the vo ltage a t these p oints. The limita tion is refe renc e vo ltage must low er or

    equal the supply voltage of ADC module. Normally, fit both jumpers on the board.

    Comp uter interfac e o f VX-Meg a128 board via USB. The hea rt o f this func tion is

    FT232RL the USB to Serial conve rter c hip. Thus, interface signal is seria l and conne c t to

    UART1 module in ATmeg a128. The prog ramming sha ll be easier and supports a ll mo dern

    computer includes labtop which not serial port available.

    Ad d ition user ca n prog ra m m icroc ont rollers fla h me mo ry via USB inte rfac e.

    Bec ause ATmega 128 microcontroller will be pre-prog ram med the bo otload er rea dy. It

    means this microc ontroller ba ord c an prog ram the flash 2 ways. One is via ISP connec torwith exte rnal In-System Programmer suc h as PX-400. Another is via USB with bootloa der

    (Atmega128 must pre-rpogrammed ready).

    0000H

    7FFFH

    8000H

    FFFFH

    0FFFH

    1000H

    ATmega128

    EFFFH

    F000H

    R/W = "0"Write mode

    Not used

    Not used

    FFFFH

    Not used

    SwitchInput

    F000H

    F3FFH

    FC00H

    F800H

    FBFFH

    F400H

    F7FFH

    F000H

    F3FFH

    FC00H

    FFFFH

    F800H

    FBFFH

    F400H

    F7FFH

    Not used

    Not used28KB from 62256external RAM

    Not used

    Internal 4KB ofATmega128

    I/O address

    Digital portdata Output

    Digital portdata Input

    R/W = "1"Read mode

    Figure 4 Memory and Input Output port organization of VX-Mega128

    micrcocontroller board

  • 7/31/2019 Vx Mega128 e

    6/22

    6VX-Mega128 : ATmega 128 Microc ontroller boa rd d oc umenta tion

    3. How to p rog ra m the VX- M e ga 128 boa rd

    Flash prog ramm ing ATmega128 on VX-Meg a128 board has 2 method s.

    (1) via ISP co nnec tor with e xte rna l In-Syste m Prog ra m m e r : The suggession

    programmer is INEXs PX-400 amd Atmels AVR ISP In-System Programmer

    (2) via USB with b oo tloa d e r : This method ATmega128 must p re-prog ramm ed

    bootloader firmware. INEX prepare ready to using. However user can re-program the

    bootload er with yourself by external programmer via ISP connec tor. In CD-ROM conta in

    the HEX file o f this boo tloa der. On VX-Mega128 boa rd has FT232RL USB to Serial converter

    chip to interface the USB but in software will loo k as COM port. Signa l from FT232RL are

    c onnec ted to SPI p rogramming p in PDI (PE0) and PDO (PE1) of ATmega128. With this

    me thod , user no ne ed the external p rog ramer to flash p rog ram ming. Only plug USB

    cable between baord and computer. Open the suitable software. You can work with

    this microcontroller board.

    4. Extension memory board

    The mem ory b oa rd o f VX-Mega128 is 64KB. Divides 2 parts. One is Sta tic RAM 32KB

    ; 62256. However user can work only lower 28KB. Because upper 4KB is reserved by

    internal RAM d a ta me mo ry of ATme g a 128. Inte rfa c ing of t his RAM wo rk via the

    EXPANSION BUS. This bus provides 8-bit data /address lines; AD0 to AD7 and Ad dress line

    A8 to A15, and a ll control signal.

    Another memory part is seria l EEPROM 32KB; 24C256. ATmeg a128 inte rfac es via

    I2C bus or Two-Wire Interfac e (TWI).

    If you need to use this memeory board with VX-Mega128 board, must plug this

    module on top at EXPANSION c onnec tor.

    5. Software in VX-Mega128 board

    The related softwa re work with VX-Meg a128 mic roc ont roller board that suggessionhas 4 softwares as follows :

    (1) IDE development tool - introduce AVR Studio . It support both Assembly

    and C programming. Download the latest version at w w w . a t m e l . c om

    (2) C compiler - suggess WinAVR. It is powerful GCC c ompiler and imp ortant

    Free of c harge. It c an wo rk with AVR Stud io. User ca n deve lop C p rog ram und er AVR

    Stud io an d u se WinAVR to c om p i le. Dow nloa d t he lat est ve rsion a t h t tp : / /

    so u rc e f o rg e . n e t/ p r o je c t s/ w i n a v r

  • 7/31/2019 Vx Mega128 e

    7/22

    VX-Mega128 : ATmega 128 Mic roc ontroller boa rd d oc umenta tion 7

    (3) Flash programming software - suggess 2 softwares; AVR Prog and AVR-

    O SP II. The AVR Prog will insta ll with AVR Stud io. Avr-Osp II is sep arated . But user ca n a dd

    Avr-OSP II into AVR Stud io for easier to using. Downloa d the late st version a t http :/ /

    esnips.com/web/AtmelAVR

    (4) Boo t loader - It is sma ll firmwa re that p rog ram into Flash prog ram mem ory

    of ATme ga 128. Its func tion is write the HEX cod e with itself via c ontrolling from computer

    via seria l p ort. Prog ram ming this c od e into ATmga 128 must use e xterna l In-Syste m

    Programmer in first time. However the manufacturer pre-program the bootloader ready.

    The insta lla tion m ust d o fo llow ing these step as follow s

    (1) Insta ll AVR Stud io

    (2) Install WinAVR compiler

    (3) Install Virtual COM port (VCP) driver

    (4) Install Avr-Osp II software if require

    5.1 A V R Stud io insta lla tio n

    5.1.1 Insert the AVR CD-ROM and look for th is file in the AVR Stud io d irec to ry;

    aStud io4b460.exe. Doub le-c lick this file.

    5.1.2 Enter the Installation Wizard. Click on the Next button to continue.

    5.1.3 In the license a greement w indow, Selec t the box : I ac ce pt the te rm s of the

    l icense agreement and Click on the N e x t button.

  • 7/31/2019 Vx Mega128 e

    8/22

    8VX-Mega128 : ATmega 128 Microc ontroller boa rd d oc umenta tion

    5.1.4 Choose Destination Location windows will appear. You can change the

    pa th by c licking on the C h a n g e button and setting a new path. After this, click on the

    N e x t button.

    5.1.5 The Driver USB Upgrade w indow will now a ppea r. Click on the N e x t button

    to pass this step.

    5.1.6 In the beg in insta lla tion w indow , c lick on the Insta ll button to sta rt insta lla tion.

    5.1.7 After the installation is complete, click on the Finish button to end the

    insta lla tion of AVR Studio.

  • 7/31/2019 Vx Mega128 e

    9/22

    VX-Mega128 : ATmega 128 Mic roc ontroller boa rd d oc umenta tion 9

    5.1.8 Next step is updating the software with service pack 4. Open CD-ROM .

    Enter to Software folder AVR Studio 4.12. Loo k for this file in the Update fo lder ;aStudio412SP4b497 .exe . Doub le-clic k this file. The we lco me insta lla tion w indo ws will

    appear. Click the N e x t button to continue.

    5.1.9 The Selec t Fea tures wind ow appea r. Clic k the Next but ton to insta ll theupdate files.

  • 7/31/2019 Vx Mega128 e

    10/22

    10VX-Mega128 : ATmega 128 Microc ontroller boa rd d oc umenta tion

    5.1.10 The Setup Sta tus window a ppea r and shows the insta lla tion p rogress bar.

    Wait until finish.

    5.1.11 After installation complete, click the Finish button.

  • 7/31/2019 Vx Mega128 e

    11/22

  • 7/31/2019 Vx Mega128 e

    12/22

    12VX-Mega128 : ATmega 128 Microc ontroller boa rd d oc umenta tion

    5.2.3 The Welc om e insta l la tion soft w a re w indo w a p p ea rs a nd sho ws the

    installation information. Click on the N e x t button.

    5.2.4 In the License agreement window, Click on the I agree button.

    5.2.5 Choose Install Location window appears. User can change the path and

    the folder for the installation of WinAVR by clicking at the Browse button and selecting

    the respec tive folde r. The p rop osed folde r is C :\ W in A V R . After selection, click N e x t

    button to continue to the next step.5.2.6 In the Choose Components window, select the components which you

    want to install or follow according to the below diagram. Click on the Insta ll button to

    begin the installation.

    5.2.7 The insta lla tion process sta rts and reports the sta tus bac k on the sc reen. The

    User needs to wait until the installation is complete. Click on the Finish button to end

    once its done.

  • 7/31/2019 Vx Mega128 e

    13/22

    VX-Mega128 : ATmega 128 Mic roc ontroller boa rd d oc umenta tion 13

    5.3 Insta ll V irtua l C O M p o rt (V C P) d rive r

    5.3.1 Connec t USB cable b etw een VX-Mega128 boa rd and computers USB po rt.

    Put the ACR CD-ROM in CD-ROM drive. Apply the supply voltage to VX-Mega128 board.

    5.3.2 Computer will detect the new hardware.

    5.3.3 After that the New Hardware w indow app ea r. Selec t Insta ll fro m a list orspe c i fic loc a tion (Adva nce d) header and click the Next > button to continue.

    5.3.4 Next, click to select at Search for the best dr iver in theses locat ion and

    Include this location in the search header. After that click Browse button to looks for

    Driver direc tory in CD-ROM. The driver file will co nta in infolder USB-VCP_driver WinNT_XP

    Click the N e x t button to continue.

    5.3.5 All driver files will install to computer.

    5.3.6 The USB High Speed Seria l Converter insta lla tion c om plete window appea r.

    Click the Finish button. USB ind icator on VX-Mega128 boa rd lights.

    5.3.7 Wait a moment, the Virtual COM port installation driver window will appear.

    Selec t Install from a l ist or specif ic location (Advanced) header similar step 5.1.3.3 and

    click the Next > button.

  • 7/31/2019 Vx Mega128 e

    14/22

    14VX-Mega128 : ATmega 128 Microc ontroller boa rd d oc umenta tion

    5.3.8 Selec t Se a rc h for the b e st drive r in the se s loc a tion and Include this loc a tion

    in the search header. Click Browse button to looks for Driver directory in CD-ROM. Must

    select the same destination from step 5.1.3.4. Click the Next > button to continue.

    5.3.9 All driver files will insta ll to c omputer.

    5.3.10 The USB Serial po rt insta lla tion c om plete windo w a ppea r. Click the Finish

    button to finish installation.

    5.3.11 After installation complete, user can check the position of the Virtual COM

    port or USB Serial port. Open Contro l Pane l. Selec t System H a r d w a r e D e v i c e M a n a g e r and see Port (C O M & LPT). You will found USB Se ria l Port position. Remeber it

    for interfacing later.

    6. F lash programming on VX-Mega128 board

    6.1 V ia USB p o rt w ith Bo o tlo a d e r

    6.1.1 Apply the supply voltage in range +6 to 12Vdc to VX-Mega128 board. Press

    the SW1 switc h and turn-on power switc h. The green POWER LED lights. Release the SW1.

    At LCD screen shows message below :

    VX-Mega128VX-Mega128VX-Mega128VX-Mega128VX-Mega128Run > BootloaderRun > BootloaderRun > BootloaderRun > BootloaderRun > Bootloader

    Now the VX-Mega128 board enter to Bootloader mode. Ready for flash

    prog ramm ing via USB port.

    6.1.2 Connec t USB cable be tween PC s USB port and VX-Meg a128 board. Chec k

    the USB Seria l po rt p osition from Device Ma nager follow ing the figure 5.

    6.1.3 Open AVR STudio to d eve lop C p rog ram and com pile to HEX file rea dy.

    F:\VX-M128v070101\USB-VCP_Driver\WinNT_XP

  • 7/31/2019 Vx Mega128 e

    15/22

    VX-Mega128 : ATmega 128 Mic roc ontroller boa rd d oc umenta tion 15

    6.1.4 At menu, selects Tool Program AVR Connect . . . following the illustratedbelow fo r sett ing the VX-Mega128 baord to connec t with AVR Stud io.

    Figure 5 The Device Manager window shows the USB Serial port that installed

    in computer

  • 7/31/2019 Vx Mega128 e

    16/22

    16VX-Mega128 : ATmega 128 Microc ontroller boa rd d oc umenta tion

    6.1.5 The Selec t AVR Prog ramm er windo w appea rs below.

    Set a ll pa rameter as follow s

    Pla tfo rm : STK500 or A V RISP

    Po rt: C O M 2 (the USB Seria l port p osition tha t set by c om pute r)

    Click on the Connect button to connecting.

    6.1.6 The AVRISP windo w appea rs below.

  • 7/31/2019 Vx Mega128 e

    17/22

    VX-Mega128 : ATmega 128 Mic roc ontroller boa rd d oc umenta tion 17

    Set a ll pa rameter as follows

    De v ic e : A tm e g a 128

    Pro g ra m m ing m o d e : ISP m o d e

    Fla sh : Inp ut He x File

    After that click on the Browse button to select HEX file which required to

    download. Example f i le is V X 1 2 8 _ D m . H E X . Its path is C : \ D o c u m e n ts a n d

    Se t tin g s\ A d m in istra to r\ D e sk to p \ V X 1 2 8 _D m \ d e fa u lt (The result file - HEX file from

    compiler will be store in default folder)

    6.1.7 Click on the Program button in Flash hea der for downloading VX128_Dm.HEX

    file to Atmega128 microcontroller on the VX-Mega128 board.

    The prog ramm ing step s are :

    6.1.7.1 Erase

    6.1.7.2 Program the HEX file. It is VX128_Dm.HEX file.

    6.1.7.3 Verify programming

    At AVRISP window w ill show the sta tus a t the bot tom left c orner of AVR

    Stud io ma in w indow. Until the donwloa d finish, sc reen w ill show the me ssage Leaving

    p r o g r a m m i n g m o d e . . O K !

    6.1.8 Now the flash programming ready. Press RESET switch to run the program.

    Observe the operation of VX-Mega128 board.

  • 7/31/2019 Vx Mega128 e

    18/22

    18VX-Mega128 : ATmega 128 Microc ontroller boa rd d oc umenta tion

    6.2 With PX- 400 p rog ra m m e r via ISP c onne c tor6.2.1App ly the supp ly voltage during 6 to 12Vdc to VX-Mega128 board. Turn-on

    power switch. The green POWER indic a to r lights.

    6.2.2 Co nne c t PX-400 betwe en Seria l port and ISP c onnec tor on VX-Meg a128

    boa rd. If your com pute r has only USB port, the USB to Seria l port c onverte r req uired . The

    UCON-232S is rec ommended . See the d iagram in figure 5.

    6.2.3 Open AVR STudio to d eve lop C p rog ram and com pile to HEX file rea dy.

    6.2.4 At menu, Selec t Tool AVR Prog...

    PX-400

    ISPRS-232

    VX-Mega128

    DC

    input

    UCON-232S

    CX-4 cable

    CX-4 cable

    Connect to USB port in casePC has only USB

    USB to Serial portconverter

    Connect to Serialor COM port

    Figure 5 The diagram of Flash programming via ISP connector with PX-400

    programmer

  • 7/31/2019 Vx Mega128 e

    19/22

    VX-Mega128 : ATmega 128 Mic roc ontroller boa rd d oc umenta tion 19

    6.2.5 The AVRprog window appea r.

    6.2.6 For first time using AVRProg program, developer must set some parameter

    of flash programming fo r AVR Prog. The step is as follows :

    6.2.6.1 Dev ice box select A Tm e g a 1 2 8

    6.2.6.2 Click on the A d v a n c e . . button. The Adva nce window ap pear.

  • 7/31/2019 Vx Mega128 e

    20/22

    20VX-Mega128 : ATmega 128 Microc ontroller boa rd d oc umenta tion

    6.2.6.3 Set a ll parameters identic a l the illustrate in step 6.2.6.2. After tha t

    c lic k on the Write b utton once for writing the parameters. Theses parameters will store

    and set to default value for next working.

    6.2.6.4 Click on the Close button to exit this window.

    6.2.7 Back to the m ain w indow of AVRProg , at He x file bo rder, c lic k on the Browse

    button to find the HEX file. For example, load file V X 1 2 8 _ D m . H E X from this path

    C : \ D o c u m e n ts a n d Se t tin g s\ A d m in istra to r\ D e sk to p \ V X 1 2 8 _D m \ d e fa u lt

    6.2.8 Click on the Program button in Fla sh border. The prog ress bar will ac tive to

    shows the progress status.

    6.2.9 After downloading finished, the program will run immediately. The file

    VX128_Dm.HEX is Hardware testing program for VX-Mega128 board.

    6.3 How to program bootloader with your own.

    If you make the flash prog ramming of the VX-Mega 128 board with the external In-

    System Prog ramm er, possib le to delete the Boo tloader firmw are. If you need to prog ram

    Flash memory with bootloader again.Your can re-program the bootloadr by your own

    with the externa l programme r via ISP c onnec tor.

    The bootloder HEX file is VX -M 128_Boo t.HEX. It is c onta ine d in fold e r Boo tloa de r in

    CD-ROM that bundled with VX-Mega128 set. Programming procedure is similar the flash

    programming with ant HEX file with extrernal programmer.

    After the bootloa der is programmed rea dy, you c an program ATmega 128 flash

    memory with Bootloader procedure at topic 6.1

  • 7/31/2019 Vx Mega128 e

    21/22

    VX-Mega128 : ATmega 128 Mic roc ontroller boa rd d oc umenta tion 21

    7. Summary of Teting f i le of VX-Mega128 board

    The VX128_Dm.HEX is HEX file for te sting the o perat ion o f VX-Me ga128 boa rd.

    Normally, maker will pre-programmed ready to test. In first time operation, after apply

    the supply voltage. LCD screen on the board will show this message :

    VX-Mega128VX-Mega128VX-Mega128VX-Mega128VX-Mega128

    Run > User codeRun > User codeRun > User codeRun > User codeRun > User code

    and c hange to

    VX-Mega128VX-Mega128VX-Mega128VX-Mega128VX-Mega128

    DemoDemoDemoDemoDemo

    Afte r tha t MCU will rea d d ata from 4-bit Binary Switc h to d isp lay on the LCD sc reen.

    The b inary switch c an supply 4-b it d igita l da ta and is ca lled Knob . User ca n c hange the

    shaft at Binary switch and see the correct position.

    Summ ay of a ll functuion c an show as follows :

    0 : Disp lay the Knobs va lue 000 on LCD16x2 mo dule

    1 : Testing the switc hes SW1 to SW4

    2 : ADC m od ule testing

    3 : Test D.IN0 to D.IN7 inp ut d igita l po rt

    4 : Test the D.OUT0 to D.OUT7 for output port

    5 : Read port B (PB0 to PB7)

    6 : Read port D (PD2 to PD4)

    7 : Read port E (PE2 to PE7)

    8 : Test the RAM on the m emory extension module (must p lug the memory

    boa rd on top of VX-Mega128 board at EXPANSION c onnector).

    9 : Test the EEPROM on the m em ory extension mod ule (must p lug the memory

    boa rd on top of VX-Mega128 board at EXPANSION c onnector).

    A : Disp lay the Knobs va lue 010 on LCD16x2 mod ule

    B : Disp lay the Knob s va lue 011 on LCD16x2 mod ule

    C : Disp lay the Knobs va lue 012 on LCD16x2 mo dule

    D : Disp lay the Knobs va lue 013 on LCD16x2 mod ule

    E : Disp lay the Knob s va lue 014 on LCD16x2 mo duleF : Disp lay the Knob s va lue 015 on LCD16x2 mod ule

  • 7/31/2019 Vx Mega128 e

    22/22

    22VX-Mega128 : ATmega 128 Microc ontroller boa rd d oc umenta tion

    www.inex.co.thwww.inexglobal.com

    8. Resource

    All sourcec od e in C prog ram is conta ined in Examp le c od e > VX128_Dm. You c an

    see and edit by your own to make the new code.

    For more informa tion of ATme ga 128 mic roc ontroller, c an see and d ow nloa d

    datasheet and many applicatiobn notes from www.atmel.com.

    Spec ia l thanks for

    1. Atmel Corp. ab out the perfec t IDE softw are; AVR Stud io.

    2. Many people who develops the nicely C compiler in name WinAVR.