Porting existing C code from MC9S12DP512 to MC9S12XDP512

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Porting existing C code from MC9S12DP512 to MC9S12XDP512

3,218 Views
kp2309
Contributor I
Hi
I m using MC9S12DP512. Now we have decided to switch to MC9S12XDP512 for some reasons
The existing 'C' code is going to be used as both controllers are pin 2 pin compatible
but it is giving many errors ,some of the registers in dp512 do not exist in xdp512 header file
MISC, PEAR, IBCR, IBFD,IBDR,IBSR,PORT_AD,PORT_K and of course INTCTR. Regarding interrupt logic it is fine.
we will decide it later but right now other than interrupt logic i want to port my existing code (with existing logic) to xgate controller
can anybody help me and suggest me the topics on which i should concentrate?????


Message Edited by kp2309 on 2008-01-07 06:13 AM
Labels (1)
0 Kudos
6 Replies

719 Views
Steve
NXP Employee
NXP Employee
AN2615 covers the principles behind this move so it's worth a read. There's a bunch of app notes on XGATE that should help with the practicalities there but in particular AN3144 covers the software configuration needed to direct interrupts and run code. If your code is already in C then it's mostly just copy and paste into an XGATE file.
0 Kudos

719 Views
sjmelnikoff
Contributor III

Note also when porting code from a D to an XD that AN2615 doesn't mention the following changes in register locations:

 

ATD registers:

HCS12: ATD0 = 0x80; ATD1 = 0x120

HCS12X: ATD0 = 0x2C0; ATD1 = 0x80

 

PWM registers:

HCS12: 0x00A0

HCS12X: 0x0300

 

This is obviously important if you plan on using the orignal DP headers, which may be the simplest option, as the XD uses a single header file with a different register naming convention.

0 Kudos

719 Views
kp2309
Contributor I
Thanks for the suggestions, I would definately look in dat direction.
0 Kudos

719 Views
peterdon
Contributor I

hello friends...
i am very new to mc9sdp512..
my problem is that , i attached a dc motor directally to port B

+ve wire on PORTB_PB0

-ve wire on ground ...............

in the program i have set the PORTB_PB0=1;
and debug it in TBDML mode
and i got output on PORTB_PB0=4.49 volts..i have checked it with multimeter...!!

but my motor is not moving.....!! even i hv tested my motor on 3 volts battery then it is running........................

any suggestion please..........!!

0 Kudos

719 Views
J2MEJediMaster
Specialist I

Please do not cross-post (post the same question) across different forums.

 

---Tom

0 Kudos

719 Views
sjmelnikoff
Contributor III
Hi. Some areas you might want to look at include:

  • Different header files and register definitions for the XD part.
  • Different memory map and address ranges, including (optional) use of banked RAM and EEPROM.
  • IVBR register to have more than interrupt vector table (useful if you're using a bootloader).
  • New interrupts and larger interrupt vector table.
  • New method for assigning interrupt priorities (CFADDR and CFDATAn registers).

Steve M.

0 Kudos