Run assembly code from 68HC11 on S12 series processor

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

Run assembly code from 68HC11 on S12 series processor

1,046 Views
jelenacavar
Contributor I

Hallo everyone,

I have a question about running code written for 68HC11 in assembly. It is for old system which needs a redesign, and one more experienced programmer than me throw me a bug with saying that this code could run as is on this S12 series processors. Is that true, I don't have much experience with this processors or assembly. If there are some changes that still need to be made, are there much of those, or it would be easier just to write new code by system specs?

Labels (1)
0 Kudos
2 Replies

714 Views
iggi
NXP Employee
NXP Employee

Hi Jelena,

You would need to adjust the code for the clock module on S12 device as this is different than on HC11 devices.

The S12 device have Clock and Reset Generator (CRG) block which has more options to configure the clock and set required frequency. The clock source is external crystal just as on HC11, but S12 has PLL implemented which can be used for clock configuration. Therefore some CRG register must be written in order to configure the clock and set required frequency.

The peripheral would not need code modification.

Regards,

iggi

714 Views
RadekS
NXP Employee
NXP Employee

Hi jelenacavar,

It is partially true. The HC11 code is highly compatible with HC(S)12 core. CPU12 instructions are a superset of the M68HC11 instruction set.

HCS12 CPU added:

- Stack pointer and program counter offset indexed addressing

- 11 math instructions

- Fuzzy logic instructions

- Long branch instruction (16 bit offset)

- Move instruction (memory to memory)

- Min/max functions

- Bit manipulations for entire memory map

- Exchange/transfer

- Table lookup and interpolate function

- Looping construct

For more details, please look at our application note AN1284 Transporting M68HC11 Code to M68HC12 Devices

http://www.nxp.com/files/microcontrollers/doc/app_note/AN1284.pdf

AN1716 Using M68HC12 Indexed Indirect Addressing

http://www.nxp.com/files/microcontrollers/doc/app_note/AN1716.pdf

CPU12 Reference manual:

http://www.nxp.com/files/microcontrollers/doc/ref_manual/CPU12RM.pdf

The potential highest problem presents different/updated peripherals.

So, it depends on the complexity of your system whether 68HC11 assembly code import or start from scratch will be a better solution.