Register map for S12 C32?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Register map for S12 C32?

2,667 次查看
Lundin
Senior Contributor IV
I have been using the S12 devices DG128 and C32 for quite a while now. For my C32 projects I have always used the same register map as for my DG128 projects, without problems.

Now I started up a new C32 project with PWM and ATD, parts that I haven't used before for this mcu derivate. I soon discovered that I wouldn't be able to use my old memory map for the D family, since both MODRR and the whole PWM is allocated at different addresses. Ie, S12 processors are not code compatible because of different hardware.

Fair enough, I switch to the register map in the non-standard C header that came with the compiler (CW 3.1). Something in this header file is however fishy, I can't get the ATD working. If I switch back to my old register map, everything works. As far as I know, there shouldn't be any ATD hardware differencies between DG128 and C32, except less silicon bugs in the latter.

I suspect it could be related to "struct padding" or similar compiler options... the CW register map is cluttered with unions and macros, non-standard bitfields and non-standard variable allocation. I'm not too intrigued to track down the cause of the error in that mess.

So I am wondering if there are any known issues with the register map, and if there is a newer register map for C32 available in later versions of CW?

Or even better, is there a register map for this mcu written in pure ANSI/ISO C with #defines?
标签 (1)
0 项奖励
回复
5 回复数

1,226 次查看
bigmac
Specialist III
Hello Lundin,
 
To use the DG128 header file, the main difference for the ATD module seems to be that all register names previously identified by the prefix ATD...  within your code, should now have the prefix ATD0... , to suit the proper header file for the new device.
 
Has this already been taken into account?  You do not say whether the code is failing to compile, or it is compiling but does not work as expected.
 
The use of bit fields, unions and macros to define individual bits within a register seems to be the "CW way".  I don't believe there is any compulsion to use these if you wish to create your own bit mask definitions.  However, I think that the standard register names should continue to be used.
 
Regards,
Mac
 
0 项奖励
回复

1,226 次查看
Lundin
Senior Contributor IV
The code compiles in both cases.

Yeah the register names have changed, I used "ATD0" from my DG128 register map and it worked well. When I use "ATD" without 0 from the CW3.1 header for C32, it isn't working.

Worth mentioning is that the DG128 map was written by myself, since it is from the old "Star12" days when CW didn't come with a register map. So maybe the CW3.1 version of DG128 has the same issues, I don't know. I will try that one and check.
0 项奖励
回复

1,226 次查看
bigmac
Specialist III
Hello Lundin,
 
I have attached the header files from within a V4.5 installation.  You may wish to check for differences with your existing files.
 
Regards,
Mac
 


Message Edited by bigmac on 2008-09-23 03:09 AM
0 项奖励
回复

1,226 次查看
Lundin
Senior Contributor IV
Thank you.

I did a file compare between them and the old files and they seem to be quite different. I will test if I can use that h file together with the old C file. The c file is just a load of dumb allocations so I think it might work, unless they changed the register names between versions, which seems unlikely.
0 项奖励
回复

1,226 次查看
bigmac
Specialist III
Hello Lundin,
 
Sorry, I gave you only half the files.  Here are the related C files from the same CW version.
 
Regards,
Mac
 
0 项奖励
回复