Introduction To CodeWarrior For MC9S12DP256 - PowerPoint PPT Presentation

1 / 24
About This Presentation
Title:

Introduction To CodeWarrior For MC9S12DP256

Description:

Take a careful look of Pin diagram. H2 expansion: Pin 49 (ground) and Pin 50 ( 5v) ... Truncate the sum to the LSB. Checksum = One's complement ... – PowerPoint PPT presentation

Number of Views:100
Avg rating:3.0/5.0
Slides: 25
Provided by: SITE71
Category:

less

Transcript and Presenter's Notes

Title: Introduction To CodeWarrior For MC9S12DP256


1
Introduction To CodeWarrior -For
MC9S12DP256
  • January 23, 2008,
  • Author Jilin Zhou,
  • Modified M. Islam

2
MC9S12DP256
3
General Description
  • 16-bit CPU, 16-bit data bus
  • Memory
  • 256K bytes flash EEPROM
  • 12K bytes of RAM
  • 4K bytes of EEPROM
  • Functionalities
  • 2 asynchronous SCI, 3 SPI
  • 8-channel IC/OC enhanced capture timer
  • 2 10-bit ADC
  • 8-channel PWM
  • and more

4
D-Bug12 EVB Mode Memory Map
5
Registers
  • Address (0000 - 03FF)
  • Data registers
  • Control registers
  • Status registers

6
RAM Interrupt Vector Table
7
Power up
  • Two methods
  • Take a careful look of Pin diagram
  • H2 expansion Pin 49 (ground) and Pin 50 (5v)
  • External DC power 6 12 V
  • Do not power both
  • Bypass capacitor should be put as close to the
    MCU as possible because fast signal transitions
    place high, short-duration current demands on the
    power supply

8
Administrative
  • Each team gets two fixed work stations.
  • Clean up before you leave.
  • Weekly report no later than Saturday night.
  • Email to jzhou_at_discover.uottawa.ca , put
    ELG4910 Team in the email subject
  • www.discover.uottawa.ca/jzhou
  • Try solve the problems by yourselves.
  • Dont forget google ?more powerful than you think!

9
Metrowerks CodeWarrior
  • Important directories
  • C\Program Files\Metrowerks\CodeWarrior
    CW12_V2.0\
  • Application Notes, CodeWarrior Manuals
  • C\Program Files\Metrowerks\CodeWarrior
    CW12_V2.0\lib\HC12c\INCLUDE

10
The 13 Steps
  • Start Metrowerks IDE (Integrated Development
    Environment)
  • Create a Project (container of files and code)
  • Add source, header files to the project
  • Add include files e.g. 6812dp256.h to the Project
  • Go to the Prm folder and adjust the memory map
  • Compile/Assemble the code by click on Make
  • Produce object code with an extension .s19
  • Convert the .s19 files header to the target
    processor
  • Open the MiniIDE (to load the executable to the
    board)
  • Reset the HCS12 board
  • Set Terminal options, COM1 or 2 port, Baud Rate
    etc.
  • Load the executable to the board
  • Go to the address 1829 to start execution

11
  • File?New? HC12 Stationary

12
Creat a project in CodeWarrior
  • Select Legacy? Sdi Target Interface ? 9S12Dp256

13
Create a Project in CodeWarrior
14
Project Files
  • Go to the stored location of the project
  • You should see some directories
  • bin
  • cmd
  • prm
  • sources
  • .ini
  • Your source codes should go to sources directory.

15
Build Process
16
Set Memory Parameters
  • Select Prm directory ?open ram.prm

17
Set Communication to MCU
  • Open MiniIDE

18
Set Communication to MCU
  • Terminal ? options
  • COM1 or COM2
  • No flow control

19
Set Communication to MCU
  • Power the mcu ? reset it

20
Load the program
  • MiniIDE
  • Terminal ?show terminal window
  • Reset the microcontroller
  • You should see the prompt Dbug-12 command window
  • Type Help to see all the commands
  • Type load
  • ? go to Terminal ? Download Files ? choose the
    .s19 file
  • Run the program (be careful with start address)

21
Run the program
  • Find the start address of program in /bin/.map

22
.s19 header problem
  • The .s19 generated by codewarrior cannot be
    downloaded to board directly since it has too
    long header that D-Bug12 cannot recognize. Check
    it.
  • Go to my website and download the converter
  • Put it in /bin and create a .bat file to do it
  • SRecChgHdr oldname.s19 newname.s19

23
Typical S19 File Layout
  • S00600004844521B Header
  • S1130000285F245F2212226A000424290008237C2A
  • S11300100002000800082629001853812341001813
  • S113002041E900084E42234300182342000824A952
  • S107003000144ED492
  • S5030004F8 Count of S1 Recs
  • S9030000FC Last Record, Load address

24
Check sum calculation
  • Byte wise add all fields except the type.
  • Truncate the sum to the LSB
  • Checksum Ones complement
Write a Comment
User Comments (0)
About PowerShow.com