240 likes | 506 Views
Introduction To CodeWarrior - For MC9S12DP256. Jilin Zhou Jan. 21, 2009. MC9S12DP256. 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
E N D
Introduction To CodeWarrior -For MC9S12DP256 Jilin Zhou Jan. 21, 2009
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 ……
Different Registers • Address ($0000 - $03FF) • Data registers • Control registers • Status registers
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
Administrative • email: jzhou@discover.uottawa.ca • Subject: ELG4911 • www.discover.uottawa.ca/~jzhou • www.discover.uottawa.ca/~qchen • Try to solve problems by yourselves. • Work as a team. • Clean up before you leave the lab.
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
Create a project in CodeWarrior (1) • FileNew HC12 Stationary
Create a project in CodeWarrior (2) • Select Legacy Sdi Target Interface 9S12Dp256
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.
Set Memory Parameters • Select Prm directory open ram.prm
Communication with MCU • Open MiniIDE
Communication with MCU • Terminal options • COM1 or COM2 • No flow control
Communication with MCU • Power the mcu reset it
Load the program • 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)
Run the program • Find the start address of program in /bin/*.map
.s19 header problem • The .s19 generated by Code Warrior cannot be downloaded to board directly since it has a 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